l3lab/ntp-mathlib huggingface dataset:
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
⊢ Set.piecewise s f g =ᶠ[ae μ] Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg)

Next tactic:
refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · 

Proof state:
case refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ s,
    Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
have h := hf.ae_eq_mk
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    

Proof state:
case refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : f =ᶠ[ae (Measure.restrict μ s)] AEStronglyMeasurable.mk f hf
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ s,
    Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    

Proof state:
case refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ s → f x = AEStronglyMeasurable.mk f hf x
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ s,
    Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
rw [ae_restrict_iff' hs]
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    

Proof state:
case refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ s → f x = AEStronglyMeasurable.mk f hf x
⊢ ∀ᵐ (x : α) ∂μ,
    x ∈ s → Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
filter_upwards [h] with x hx
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ s → f x = AEStronglyMeasurable.mk f hf x
x : α
hx : x ∈ s → f x = AEStronglyMeasurable.mk f hf x
⊢ x ∈ s → Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
intro hx_mem
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ s → f x = AEStronglyMeasurable.mk f hf x
x : α
hx : x ∈ s → f x = AEStronglyMeasurable.mk f hf x
hx_mem : x ∈ s
⊢ Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
  · 

Proof state:
case refine_2
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ sᶜ,
    Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
have h := hg.ae_eq_mk
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
  · have h := hg.ae_eq_mk
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : g =ᶠ[ae (Measure.restrict μ sᶜ)] AEStronglyMeasurable.mk g hg
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ sᶜ,
    Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
rw [Filter.EventuallyEq, ae_restrict_iff' hs.compl] at h
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
  · have h := hg.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs.compl] at h
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ sᶜ,
    Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
rw [ae_restrict_iff' hs.compl]
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
  · have h := hg.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs.compl] at h
    rw [ae_restrict_iff' hs.compl]
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
⊢ ∀ᵐ (x : α) ∂μ,
    x ∈ sᶜ → Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
filter_upwards [h] with x hx
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
  · have h := hg.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs.compl] at h
    rw [ae_restrict_iff' hs.compl]
    filter_upwards [h] with x hx
    

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
x : α
hx : x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
⊢ x ∈ sᶜ → Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
intro hx_mem
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
  · have h := hg.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs.compl] at h
    rw [ae_restrict_iff' hs.compl]
    filter_upwards [h] with x hx
    intro hx_mem
    

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
x : α
hx : x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
hx_mem : x ∈ sᶜ
⊢ Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
rw [Set.mem_compl_iff] at hx_mem
theorem piecewise {s : Set α} [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : AEStronglyMeasurable f (μ.restrict s))
    (hg : AEStronglyMeasurable g (μ.restrict sᶜ)) :
    AEStronglyMeasurable (s.piecewise f g) μ := by
  refine ⟨s.piecewise (hf.mk f) (hg.mk g),
    StronglyMeasurable.piecewise hs hf.stronglyMeasurable_mk hg.stronglyMeasurable_mk, ?_⟩
  refine ae_of_ae_restrict_of_ae_restrict_compl s ?_ ?_
  · have h := hf.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs] at h
    rw [ae_restrict_iff' hs]
    filter_upwards [h] with x hx
    intro hx_mem
    simp only [hx_mem, Set.piecewise_eq_of_mem, hx hx_mem]
  · have h := hg.ae_eq_mk
    rw [Filter.EventuallyEq, ae_restrict_iff' hs.compl] at h
    rw [ae_restrict_iff' hs.compl]
    filter_upwards [h] with x hx
    intro hx_mem
    rw [Set.mem_compl_iff] at hx_mem
    

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m : MeasurableSpace α
μ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : AEStronglyMeasurable f (Measure.restrict μ s)
hg : AEStronglyMeasurable g (Measure.restrict μ sᶜ)
h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
x : α
hx : x ∈ sᶜ → g x = AEStronglyMeasurable.mk g hg x
hx_mem : x ∉ s
⊢ Set.piecewise s f g x = Set.piecewise s (AEStronglyMeasurable.mk f hf) (AEStronglyMeasurable.mk g hg) x

Next tactic:
simp only [hx_mem, not_false_eq_true, Set.piecewise_eq_of_not_mem, hx hx_mem]
theorem sum_measure [PseudoMetrizableSpace β] {m : MeasurableSpace α} {μ : ι → Measure α}
    (h : ∀ i, AEStronglyMeasurable f (μ i)) : AEStronglyMeasurable f (Measure.sum μ) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m✝ : MeasurableSpace α
μ✝ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
inst✝ : PseudoMetrizableSpace β
m : MeasurableSpace α
μ : ι → Measure α
h : ∀ (i : ι), AEStronglyMeasurable f (μ i)
⊢ AEStronglyMeasurable f (sum μ)

Next tactic:
borelize β
theorem sum_measure [PseudoMetrizableSpace β] {m : MeasurableSpace α} {μ : ι → Measure α}
    (h : ∀ i, AEStronglyMeasurable f (μ i)) : AEStronglyMeasurable f (Measure.sum μ) := by
  borelize β
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m✝ : MeasurableSpace α
μ✝ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
inst✝ : PseudoMetrizableSpace β
m : MeasurableSpace α
μ : ι → Measure α
h : ∀ (i : ι), AEStronglyMeasurable f (μ i)
this✝¹ : MeasurableSpace β := borel β
this✝ : BorelSpace β
⊢ AEStronglyMeasurable f (sum μ)

Next tactic:
refine'
    aestronglyMeasurable_iff_aemeasurable_separable.2
      ⟨AEMeasurable.sum_measure fun i => (h i).aemeasurable, _⟩
theorem sum_measure [PseudoMetrizableSpace β] {m : MeasurableSpace α} {μ : ι → Measure α}
    (h : ∀ i, AEStronglyMeasurable f (μ i)) : AEStronglyMeasurable f (Measure.sum μ) := by
  borelize β
  refine'
    aestronglyMeasurable_iff_aemeasurable_separable.2
      ⟨AEMeasurable.sum_measure fun i => (h i).aemeasurable, _⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m✝ : MeasurableSpace α
μ✝ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
inst✝ : PseudoMetrizableSpace β
m : MeasurableSpace α
μ : ι → Measure α
h : ∀ (i : ι), AEStronglyMeasurable f (μ i)
this✝¹ : MeasurableSpace β := borel β
this✝ : BorelSpace β
⊢ ∃ t, IsSeparable t ∧ ∀ᵐ (x : α) ∂sum μ, f x ∈ t

Next tactic:
have A : ∀ i : ι, ∃ t : Set β, IsSeparable t ∧ f ⁻¹' t ∈ (μ i).ae := fun i =>
    (aestronglyMeasurable_iff_aemeasurable_separable.1 (h i)).2
theorem sum_measure [PseudoMetrizableSpace β] {m : MeasurableSpace α} {μ : ι → Measure α}
    (h : ∀ i, AEStronglyMeasurable f (μ i)) : AEStronglyMeasurable f (Measure.sum μ) := by
  borelize β
  refine'
    aestronglyMeasurable_iff_aemeasurable_separable.2
      ⟨AEMeasurable.sum_measure fun i => (h i).aemeasurable, _⟩
  have A : ∀ i : ι, ∃ t : Set β, IsSeparable t ∧ f ⁻¹' t ∈ (μ i).ae := fun i =>
    (aestronglyMeasurable_iff_aemeasurable_separable.1 (h i)).2
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m✝ : MeasurableSpace α
μ✝ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
inst✝ : PseudoMetrizableSpace β
m : MeasurableSpace α
μ : ι → Measure α
h : ∀ (i : ι), AEStronglyMeasurable f (μ i)
this✝¹ : MeasurableSpace β := borel β
this✝ : BorelSpace β
A : ∀ (i : ι), ∃ t, IsSeparable t ∧ f ⁻¹' t ∈ ae (μ i)
⊢ ∃ t, IsSeparable t ∧ ∀ᵐ (x : α) ∂sum μ, f x ∈ t

Next tactic:
choose t t_sep ht using A
theorem sum_measure [PseudoMetrizableSpace β] {m : MeasurableSpace α} {μ : ι → Measure α}
    (h : ∀ i, AEStronglyMeasurable f (μ i)) : AEStronglyMeasurable f (Measure.sum μ) := by
  borelize β
  refine'
    aestronglyMeasurable_iff_aemeasurable_separable.2
      ⟨AEMeasurable.sum_measure fun i => (h i).aemeasurable, _⟩
  have A : ∀ i : ι, ∃ t : Set β, IsSeparable t ∧ f ⁻¹' t ∈ (μ i).ae := fun i =>
    (aestronglyMeasurable_iff_aemeasurable_separable.1 (h i)).2
  choose t t_sep ht using A
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m✝ : MeasurableSpace α
μ✝ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
inst✝ : PseudoMetrizableSpace β
m : MeasurableSpace α
μ : ι → Measure α
h : ∀ (i : ι), AEStronglyMeasurable f (μ i)
this✝¹ : MeasurableSpace β := borel β
this✝ : BorelSpace β
t : ι → Set β
t_sep : ∀ (i : ι), IsSeparable (t i)
ht : ∀ (i : ι), f ⁻¹' t i ∈ ae (μ i)
⊢ ∃ t, IsSeparable t ∧ ∀ᵐ (x : α) ∂sum μ, f x ∈ t

Next tactic:
refine' ⟨⋃ i, t i, isSeparable_iUnion t_sep, _⟩
theorem sum_measure [PseudoMetrizableSpace β] {m : MeasurableSpace α} {μ : ι → Measure α}
    (h : ∀ i, AEStronglyMeasurable f (μ i)) : AEStronglyMeasurable f (Measure.sum μ) := by
  borelize β
  refine'
    aestronglyMeasurable_iff_aemeasurable_separable.2
      ⟨AEMeasurable.sum_measure fun i => (h i).aemeasurable, _⟩
  have A : ∀ i : ι, ∃ t : Set β, IsSeparable t ∧ f ⁻¹' t ∈ (μ i).ae := fun i =>
    (aestronglyMeasurable_iff_aemeasurable_separable.1 (h i)).2
  choose t t_sep ht using A
  refine' ⟨⋃ i, t i, isSeparable_iUnion t_sep, _⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m✝ : MeasurableSpace α
μ✝ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
inst✝ : PseudoMetrizableSpace β
m : MeasurableSpace α
μ : ι → Measure α
h : ∀ (i : ι), AEStronglyMeasurable f (μ i)
this✝¹ : MeasurableSpace β := borel β
this✝ : BorelSpace β
t : ι → Set β
t_sep : ∀ (i : ι), IsSeparable (t i)
ht : ∀ (i : ι), f ⁻¹' t i ∈ ae (μ i)
⊢ ∀ᵐ (x : α) ∂sum μ, f x ∈ ⋃ i, t i

Next tactic:
simp only [Measure.ae_sum_eq, mem_iUnion, eventually_iSup]
theorem sum_measure [PseudoMetrizableSpace β] {m : MeasurableSpace α} {μ : ι → Measure α}
    (h : ∀ i, AEStronglyMeasurable f (μ i)) : AEStronglyMeasurable f (Measure.sum μ) := by
  borelize β
  refine'
    aestronglyMeasurable_iff_aemeasurable_separable.2
      ⟨AEMeasurable.sum_measure fun i => (h i).aemeasurable, _⟩
  have A : ∀ i : ι, ∃ t : Set β, IsSeparable t ∧ f ⁻¹' t ∈ (μ i).ae := fun i =>
    (aestronglyMeasurable_iff_aemeasurable_separable.1 (h i)).2
  choose t t_sep ht using A
  refine' ⟨⋃ i, t i, isSeparable_iUnion t_sep, _⟩
  simp only [Measure.ae_sum_eq, mem_iUnion, eventually_iSup]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝³ : Countable ι
m✝ : MeasurableSpace α
μ✝ : Measure α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
f g : α → β
inst✝ : PseudoMetrizableSpace β
m : MeasurableSpace α
μ : ι → Measure α
h : ∀ (i : ι), AEStronglyMeasurable f (μ i)
this✝¹ : MeasurableSpace β := borel β
this✝ : BorelSpace β
t : ι → Set β
t_sep : ∀ (i : ι), IsSeparable (t i)
ht : ∀ (i : ι), f ⁻¹' t i ∈ ae (μ i)
⊢ ∀ (b : ι), ∀ᵐ (x : α) ∂μ b, ∃ i, f x ∈ t i

Next tactic:
intro i