l3lab/ntp-mathlib huggingface dataset:
theorem set_integral_eq_zero_of_ae_eq_zero (ht_eq : ∀ᵐ x ∂μ, x ∈ t → f x = 0) :
    ∫ x in t, f x ∂μ = 0 := by
  by_cases hf : AEStronglyMeasurable f (μ.restrict t); swap
  · rw [integral_undef]
    contrapose! hf
    exact hf.1
  have : ∫ x in t, hf.mk f x ∂μ = 0 := by
    refine' integral_eq_zero_of_ae _
    rw [EventuallyEq,
      ae_restrict_iff (hf.stronglyMeasurable_mk.measurableSet_eq_fun stronglyMeasurable_zero)]
    

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂μ, x ∈ t → f x = 0
hf : AEStronglyMeasurable f (Measure.restrict μ t)
⊢ ∀ᵐ (x : α) ∂μ, x ∈ t → AEStronglyMeasurable.mk f hf x = OfNat.ofNat 0 x

Next tactic:
filter_upwards [ae_imp_of_ae_restrict hf.ae_eq_mk, ht_eq] with x hx h'x h''x
theorem set_integral_eq_zero_of_ae_eq_zero (ht_eq : ∀ᵐ x ∂μ, x ∈ t → f x = 0) :
    ∫ x in t, f x ∂μ = 0 := by
  by_cases hf : AEStronglyMeasurable f (μ.restrict t); swap
  · rw [integral_undef]
    contrapose! hf
    exact hf.1
  have : ∫ x in t, hf.mk f x ∂μ = 0 := by
    refine' integral_eq_zero_of_ae _
    rw [EventuallyEq,
      ae_restrict_iff (hf.stronglyMeasurable_mk.measurableSet_eq_fun stronglyMeasurable_zero)]
    filter_upwards [ae_imp_of_ae_restrict hf.ae_eq_mk, ht_eq] with x hx h'x h''x
    

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂μ, x ∈ t → f x = 0
hf : AEStronglyMeasurable f (Measure.restrict μ t)
x : α
hx : x ∈ t → f x = AEStronglyMeasurable.mk f hf x
h'x : x ∈ t → f x = 0
h''x : x ∈ t
⊢ AEStronglyMeasurable.mk f hf x = OfNat.ofNat 0 x

Next tactic:
rw [← hx h''x]
theorem set_integral_eq_zero_of_ae_eq_zero (ht_eq : ∀ᵐ x ∂μ, x ∈ t → f x = 0) :
    ∫ x in t, f x ∂μ = 0 := by
  by_cases hf : AEStronglyMeasurable f (μ.restrict t); swap
  · rw [integral_undef]
    contrapose! hf
    exact hf.1
  have : ∫ x in t, hf.mk f x ∂μ = 0 := by
    refine' integral_eq_zero_of_ae _
    rw [EventuallyEq,
      ae_restrict_iff (hf.stronglyMeasurable_mk.measurableSet_eq_fun stronglyMeasurable_zero)]
    filter_upwards [ae_imp_of_ae_restrict hf.ae_eq_mk, ht_eq] with x hx h'x h''x
    rw [← hx h''x]
    

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂μ, x ∈ t → f x = 0
hf : AEStronglyMeasurable f (Measure.restrict μ t)
x : α
hx : x ∈ t → f x = AEStronglyMeasurable.mk f hf x
h'x : x ∈ t → f x = 0
h''x : x ∈ t
⊢ f x = OfNat.ofNat 0 x

Next tactic:
exact h'x h''x
theorem set_integral_eq_zero_of_ae_eq_zero (ht_eq : ∀ᵐ x ∂μ, x ∈ t → f x = 0) :
    ∫ x in t, f x ∂μ = 0 := by
  by_cases hf : AEStronglyMeasurable f (μ.restrict t); swap
  · rw [integral_undef]
    contrapose! hf
    exact hf.1
  have : ∫ x in t, hf.mk f x ∂μ = 0 := by
    refine' integral_eq_zero_of_ae _
    rw [EventuallyEq,
      ae_restrict_iff (hf.stronglyMeasurable_mk.measurableSet_eq_fun stronglyMeasurable_zero)]
    filter_upwards [ae_imp_of_ae_restrict hf.ae_eq_mk, ht_eq] with x hx h'x h''x
    rw [← hx h''x]
    exact h'x h''x
  

Proof state:
case pos
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂μ, x ∈ t → f x = 0
hf : AEStronglyMeasurable f (Measure.restrict μ t)
this : ∫ (x : α) in t, AEStronglyMeasurable.mk f hf x ∂μ = 0
⊢ ∫ (x : α) in t, f x ∂μ = 0

Next tactic:
rw [← this]
theorem set_integral_eq_zero_of_ae_eq_zero (ht_eq : ∀ᵐ x ∂μ, x ∈ t → f x = 0) :
    ∫ x in t, f x ∂μ = 0 := by
  by_cases hf : AEStronglyMeasurable f (μ.restrict t); swap
  · rw [integral_undef]
    contrapose! hf
    exact hf.1
  have : ∫ x in t, hf.mk f x ∂μ = 0 := by
    refine' integral_eq_zero_of_ae _
    rw [EventuallyEq,
      ae_restrict_iff (hf.stronglyMeasurable_mk.measurableSet_eq_fun stronglyMeasurable_zero)]
    filter_upwards [ae_imp_of_ae_restrict hf.ae_eq_mk, ht_eq] with x hx h'x h''x
    rw [← hx h''x]
    exact h'x h''x
  rw [← this]
  

Proof state:
case pos
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂μ, x ∈ t → f x = 0
hf : AEStronglyMeasurable f (Measure.restrict μ t)
this : ∫ (x : α) in t, AEStronglyMeasurable.mk f hf x ∂μ = 0
⊢ ∫ (x : α) in t, f x ∂μ = ∫ (x : α) in t, AEStronglyMeasurable.mk f hf x ∂μ

Next tactic:
exact integral_congr_ae hf.ae_eq_mk
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
let k := f ⁻¹' {0}
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
⊢ MeasurableSet k

Next tactic:
borelize E
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
this✝¹ : MeasurableSpace E := borel E
this✝ : BorelSpace E
⊢ MeasurableSet k

Next tactic:
exact haux.measurable (measurableSet_singleton _)
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
h's : IntegrableOn f s
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
have A : ∀ u : Set α, ∫ x in u ∩ k, f x ∂μ = 0 := fun u =>
    set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
  have A : ∀ u : Set α, ∫ x in u ∩ k, f x ∂μ = 0 := fun u =>
    set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
h's : IntegrableOn f s
A : ∀ (u : Set α), ∫ (x : α) in u ∩ k, f x ∂μ = 0
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add,
    union_diff_distrib, union_comm]
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
  have A : ∀ u : Set α, ∫ x in u ∩ k, f x ∂μ = 0 := fun u =>
    set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2
  rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add,
    union_diff_distrib, union_comm]
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
h's : IntegrableOn f s
A : ∀ (u : Set α), ∫ (x : α) in u ∩ k, f x ∂μ = 0
⊢ ∫ (x : α) in t \ k ∪ s \ k, f x ∂μ = ∫ (x : α) in s \ k, f x ∂μ

Next tactic:
apply set_integral_congr_set_ae
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
  have A : ∀ u : Set α, ∫ x in u ∩ k, f x ∂μ = 0 := fun u =>
    set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2
  rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add,
    union_diff_distrib, union_comm]
  apply set_integral_congr_set_ae
  

Proof state:
case hst
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
h's : IntegrableOn f s
A : ∀ (u : Set α), ∫ (x : α) in u ∩ k, f x ∂μ = 0
⊢ t \ k ∪ s \ k =ᵐ[μ] s \ k

Next tactic:
rw [union_ae_eq_right]
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
  have A : ∀ u : Set α, ∫ x in u ∩ k, f x ∂μ = 0 := fun u =>
    set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2
  rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add,
    union_diff_distrib, union_comm]
  apply set_integral_congr_set_ae
  rw [union_ae_eq_right]
  

Proof state:
case hst
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
h's : IntegrableOn f s
A : ∀ (u : Set α), ∫ (x : α) in u ∩ k, f x ∂μ = 0
⊢ ↑↑μ ((t \ k) \ (s \ k)) = 0

Next tactic:
apply measure_mono_null (diff_subset _ _)
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
  have A : ∀ u : Set α, ∫ x in u ∩ k, f x ∂μ = 0 := fun u =>
    set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2
  rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add,
    union_diff_distrib, union_comm]
  apply set_integral_congr_set_ae
  rw [union_ae_eq_right]
  apply measure_mono_null (diff_subset _ _)
  

Proof state:
case hst
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
h's : IntegrableOn f s
A : ∀ (u : Set α), ∫ (x : α) in u ∩ k, f x ∂μ = 0
⊢ ↑↑μ (t \ k) = 0

Next tactic:
rw [measure_zero_iff_ae_nmem]
theorem integral_union_eq_left_of_ae_aux (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0)
    (haux : StronglyMeasurable f) (H : IntegrableOn f (s ∪ t) μ) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  let k := f ⁻¹' {0}
  have hk : MeasurableSet k := by borelize E; exact haux.measurable (measurableSet_singleton _)
  have h's : IntegrableOn f s μ := H.mono (subset_union_left _ _) le_rfl
  have A : ∀ u : Set α, ∫ x in u ∩ k, f x ∂μ = 0 := fun u =>
    set_integral_eq_zero_of_forall_eq_zero fun x hx => hx.2
  rw [← integral_inter_add_diff hk h's, ← integral_inter_add_diff hk H, A, A, zero_add, zero_add,
    union_diff_distrib, union_comm]
  apply set_integral_congr_set_ae
  rw [union_ae_eq_right]
  apply measure_mono_null (diff_subset _ _)
  rw [measure_zero_iff_ae_nmem]
  

Proof state:
case hst
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
haux : StronglyMeasurable f
H : IntegrableOn f (s ∪ t)
k : Set α := f ⁻¹' {0}
hk : MeasurableSet k
h's : IntegrableOn f s
A : ∀ (u : Set α), ∫ (x : α) in u ∩ k, f x ∂μ = 0
⊢ ∀ᵐ (a : α) ∂μ, a ∉ t \ k

Next tactic:
filter_upwards [ae_imp_of_ae_restrict ht_eq] with x hx h'x using h'x.2 (hx h'x.1)
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
⊢ IntegrableOn f t

Next tactic:
apply integrableOn_zero.congr_fun_ae
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
⊢ (fun x => 0) =ᵐ[Measure.restrict μ t] f

Next tactic:
symm
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
⊢ f =ᵐ[Measure.restrict μ t] fun x => 0

Next tactic:
exact ht_eq
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
ht : IntegrableOn f t
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
by_cases H : IntegrableOn f (s ∪ t) μ
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq
  by_cases H : IntegrableOn f (s ∪ t) μ; 

Proof state:
case pos
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
ht : IntegrableOn f t
H : IntegrableOn f (s ∪ t)
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ
case neg
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
ht : IntegrableOn f t
H : ¬IntegrableOn f (s ∪ t)
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
swap
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq
  by_cases H : IntegrableOn f (s ∪ t) μ; swap
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
ht : IntegrableOn f t
H : ¬IntegrableOn f (s ∪ t)
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
rw [integral_undef H, integral_undef]
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq
  by_cases H : IntegrableOn f (s ∪ t) μ; swap
  · rw [integral_undef H, integral_undef]; 

Proof state:
case neg
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
ht : IntegrableOn f t
H : ¬IntegrableOn f (s ∪ t)
⊢ ¬Integrable fun x => f x

Next tactic:
simpa [integrableOn_union, ht] using H
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq
  by_cases H : IntegrableOn f (s ∪ t) μ; swap
  · rw [integral_undef H, integral_undef]; simpa [integrableOn_union, ht] using H
  

Proof state:
case pos
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
ht : IntegrableOn f t
H : IntegrableOn f (s ∪ t)
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
let f' := H.1.mk f
theorem integral_union_eq_left_of_ae (ht_eq : ∀ᵐ x ∂μ.restrict t, f x = 0) :
    ∫ x in s ∪ t, f x ∂μ = ∫ x in s, f x ∂μ := by
  have ht : IntegrableOn f t μ := by apply integrableOn_zero.congr_fun_ae; symm; exact ht_eq
  by_cases H : IntegrableOn f (s ∪ t) μ; swap
  · rw [integral_undef H, integral_undef]; simpa [integrableOn_union, ht] using H
  let f' := H.1.mk f
  

Proof state:
case pos
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
ht_eq : ∀ᵐ (x : α) ∂Measure.restrict μ t, f x = 0
ht : IntegrableOn f t
H : IntegrableOn f (s ∪ t)
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ (s ∪ t)))
⊢ ∫ (x : α) in s ∪ t, f x ∂μ = ∫ (x : α) in s, f x ∂μ

Next tactic:
calc
    ∫ x : α in s ∪ t, f x ∂μ = ∫ x : α in s ∪ t, f' x ∂μ := integral_congr_ae H.1.ae_eq_mk
    _ = ∫ x in s, f' x ∂μ := by
      apply
        integral_union_eq_left_of_ae_aux _ H.1.stronglyMeasurable_mk (H.congr_fun_ae H.1.ae_eq_mk)
      filter_upwards [ht_eq,
        ae_mono (Measure.restrict_mono (subset_union_right s t) le_rfl) H.1.ae_eq_mk] with x hx h'x
      rw [← h'x, hx]
    _ = ∫ x in s, f x ∂μ :=
      integral_congr_ae
        (ae_mono (Measure.restrict_mono (subset_union_left s t) le_rfl) H.1.ae_eq_mk.symm)