Theorem: MeasureTheory.set_integral_eq_of_subset_of_ae_diff_eq_zero
File: Mathlib/MeasureTheory/Integral/SetIntegral.lean

tactic: by_cases h : IntegrableOn f t μ
state_before: α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
⊢ (∫ (x : α) in t, f x ∂μ) = ∫ (x : α) in s, f x ∂μ

tactic: swap
state_before: case pos
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
⊢ (∫ (x : α) in t, f x ∂μ) = ∫ (x : α) in s, f x ∂μ

case neg
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : ¬IntegrableOn f t
⊢ (∫ (x : α) in t, f x ∂μ) = ∫ (x : α) in s, f x ∂μ

tactic: let f' := h.1.mk f
state_before: case pos
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
⊢ (∫ (x : α) in t, f x ∂μ) = ∫ (x : α) in s, f x ∂μ

tactic: calc
  (∫ x in t, f x ∂μ) = ∫ x in t, f' x ∂μ := integral_congr_ae h.1.ae_eq_mk
  _ = ∫ x in s, f' x ∂μ := by
    apply
      set_integral_eq_of_subset_of_ae_diff_eq_zero_aux hts _ h.1.stronglyMeasurable_mk
        (h.congr h.1.ae_eq_mk)
    filter_upwards [h't, ae_imp_of_ae_restrict h.1.ae_eq_mk] with x hx h'x h''x
    rw [← h'x h''x.1, hx h''x]
  _ = ∫ x in s, f x ∂μ := by
    apply integral_congr_ae
    apply ae_restrict_of_ae_restrict_of_subset hts
    exact h.1.ae_eq_mk.symm
state_before: case pos
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t))
⊢ (∫ (x : α) in t, f x ∂μ) = ∫ (x : α) in s, f x ∂μ

tactic: have : ¬IntegrableOn f s μ := fun H => h (H.of_ae_diff_eq_zero ht h't)
state_before: case neg
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : ¬IntegrableOn f t
⊢ (∫ (x : α) in t, f x ∂μ) = ∫ (x : α) in s, f x ∂μ

tactic: rw [integral_undef h, integral_undef this]
state_before: case neg
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : ¬IntegrableOn f t
this : ¬IntegrableOn f s
⊢ (∫ (x : α) in t, f x ∂μ) = ∫ (x : α) in s, f x ∂μ

tactic: apply
  set_integral_eq_of_subset_of_ae_diff_eq_zero_aux hts _ h.1.stronglyMeasurable_mk
    (h.congr h.1.ae_eq_mk)
state_before: α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t))
⊢ (∫ (x : α) in t, f' x ∂μ) = ∫ (x : α) in s, f' x ∂μ

tactic: filter_upwards [h't, ae_imp_of_ae_restrict h.1.ae_eq_mk] with x hx h'x h''x
state_before: α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t))
⊢ ∀ᵐ (x : α) ∂μ, x ∈ t \ s → AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t)) x = 0

tactic: rw [← h'x h''x.1, hx h''x]
state_before: case h
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t))
x : α
hx : x ∈ t \ s → f x = 0
h'x : x ∈ t → f x = AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t)) x
h''x : x ∈ t \ s
⊢ AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t)) x = 0

tactic: apply integral_congr_ae
state_before: α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t))
⊢ (∫ (x : α) in s, f' x ∂μ) = ∫ (x : α) in s, f x ∂μ

tactic: apply ae_restrict_of_ae_restrict_of_subset hts
state_before: case h
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t))
⊢ (fun a => f' a) =ᵐ[Measure.restrict μ s] fun a => f a

tactic: exact h.1.ae_eq_mk.symm
state_before: case h
α : Type u_1
β : Type ?u.95878
E : Type u_2
F : Type ?u.95884
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : CompleteSpace E
inst✝ : NormedSpace ℝ E
ht : NullMeasurableSet t
hts : s ⊆ t
h't : ∀ᵐ (x : α) ∂μ, x ∈ t \ s → f x = 0
h : IntegrableOn f t
f' : α → E := AEStronglyMeasurable.mk f (_ : AEStronglyMeasurable f (Measure.restrict μ t))
⊢ ∀ᵐ (x : α) ∂Measure.restrict μ t, (fun a => f' a) x = (fun a => f a) x