l3lab/ntp-mathlib huggingface dataset:
/-- Fundamental theorem of calculus for set integrals:
if `μ` is a measure that is finite at a filter `l` and
`f` is a measurable function that has a finite limit `b` at `l ⊓ μ.ae`, then
`∫ x in s i, f x ∂μ = μ (s i) • b + o(μ (s i))` at a filter `li` provided that
`s i` tends to `l.smallSets` along `li`.
Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).toReal` in the actual statement.

Often there is a good formula for `(μ (s i)).toReal`, so the formalization can take an optional
argument `m` with this formula and a proof of `(fun i => (μ (s i)).toReal) =ᶠ[li] m`. Without these
arguments, `m i = (μ (s i)).toReal` is used in the output. -/
theorem Filter.Tendsto.integral_sub_linear_isLittleO_ae [NormedSpace ℝ E] [CompleteSpace E]
    {μ : Measure α} {l : Filter α} [l.IsMeasurablyGenerated] {f : α → E} {b : E}
    (h : Tendsto f (l ⊓ μ.ae) (𝓝 b)) (hfm : StronglyMeasurableAtFilter f l μ)
    (hμ : μ.FiniteAtFilter l) {s : ι → Set α} {li : Filter ι} (hs : Tendsto s li l.smallSets)
    (m : ι → ℝ := fun i => (μ (s i)).toReal)
    (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) :
    (fun i => (∫ x in s i, f x ∂μ) - m i • b) =o[li] m := by
  suffices
      (fun s => (∫ x in s, f x ∂μ) - (μ s).toReal • b) =o[l.smallSets] fun s => (μ s).toReal from
    (this.comp_tendsto hs).congr'
      (hsμ.mono fun a ha => by dsimp only [Function.comp_apply] at ha ⊢; rw [ha]) hsμ
  refine' isLittleO_iff.2 fun ε ε₀ => _
  have : ∀ᶠ s in l.smallSets, ∀ᶠ x in μ.ae, x ∈ s → f x ∈ closedBall b ε :=
    eventually_smallSets_eventually.2 (h.eventually <| closedBall_mem_nhds _ ε₀)
  filter_upwards [hμ.eventually, (hμ.integrableAtFilter_of_tendsto_ae hfm h).eventually,
    hfm.eventually, this]
  simp only [mem_closedBall, dist_eq_norm]
  

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁴ : MeasurableSpace α
ι : Type u_5
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
μ : Measure α
l : Filter α
inst✝ : IsMeasurablyGenerated l
f : α → E
b : E
h : Tendsto f (l ⊓ Measure.ae μ) (𝓝 b)
hfm : StronglyMeasurableAtFilter f l
hμ : Measure.FiniteAtFilter μ l
s : ι → Set α
li : Filter ι
hs : Tendsto s li (smallSets l)
m : optParam (ι → ℝ) fun i => ENNReal.toReal (↑↑μ (s i))
hsμ : autoParam ((fun i => ENNReal.toReal (↑↑μ (s i))) =ᶠ[li] m) _auto✝
ε : ℝ
ε₀ : 0 < ε
this : ∀ᶠ (s : Set α) in smallSets l, ∀ᵐ (x : α) ∂μ, x ∈ s → f x ∈ closedBall b ε
⊢ ∀ (a : Set α),
    ↑↑μ a < ⊤ →
      IntegrableOn f a →
        AEStronglyMeasurable f (Measure.restrict μ a) →
          (∀ᵐ (x : α) ∂μ, x ∈ a → ‖f x - b‖ ≤ ε) →
            ‖∫ (x : α) in a, f x ∂μ - ENNReal.toReal (↑↑μ a) • b‖ ≤ ε * ‖ENNReal.toReal (↑↑μ a)‖

Next tactic:
intro s hμs h_integrable hfm h_norm
/-- Fundamental theorem of calculus for set integrals:
if `μ` is a measure that is finite at a filter `l` and
`f` is a measurable function that has a finite limit `b` at `l ⊓ μ.ae`, then
`∫ x in s i, f x ∂μ = μ (s i) • b + o(μ (s i))` at a filter `li` provided that
`s i` tends to `l.smallSets` along `li`.
Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).toReal` in the actual statement.

Often there is a good formula for `(μ (s i)).toReal`, so the formalization can take an optional
argument `m` with this formula and a proof of `(fun i => (μ (s i)).toReal) =ᶠ[li] m`. Without these
arguments, `m i = (μ (s i)).toReal` is used in the output. -/
theorem Filter.Tendsto.integral_sub_linear_isLittleO_ae [NormedSpace ℝ E] [CompleteSpace E]
    {μ : Measure α} {l : Filter α} [l.IsMeasurablyGenerated] {f : α → E} {b : E}
    (h : Tendsto f (l ⊓ μ.ae) (𝓝 b)) (hfm : StronglyMeasurableAtFilter f l μ)
    (hμ : μ.FiniteAtFilter l) {s : ι → Set α} {li : Filter ι} (hs : Tendsto s li l.smallSets)
    (m : ι → ℝ := fun i => (μ (s i)).toReal)
    (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) :
    (fun i => (∫ x in s i, f x ∂μ) - m i • b) =o[li] m := by
  suffices
      (fun s => (∫ x in s, f x ∂μ) - (μ s).toReal • b) =o[l.smallSets] fun s => (μ s).toReal from
    (this.comp_tendsto hs).congr'
      (hsμ.mono fun a ha => by dsimp only [Function.comp_apply] at ha ⊢; rw [ha]) hsμ
  refine' isLittleO_iff.2 fun ε ε₀ => _
  have : ∀ᶠ s in l.smallSets, ∀ᶠ x in μ.ae, x ∈ s → f x ∈ closedBall b ε :=
    eventually_smallSets_eventually.2 (h.eventually <| closedBall_mem_nhds _ ε₀)
  filter_upwards [hμ.eventually, (hμ.integrableAtFilter_of_tendsto_ae hfm h).eventually,
    hfm.eventually, this]
  simp only [mem_closedBall, dist_eq_norm]
  intro s hμs h_integrable hfm h_norm
  

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁴ : MeasurableSpace α
ι : Type u_5
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
μ : Measure α
l : Filter α
inst✝ : IsMeasurablyGenerated l
f : α → E
b : E
h : Tendsto f (l ⊓ Measure.ae μ) (𝓝 b)
hfm✝ : StronglyMeasurableAtFilter f l
hμ : Measure.FiniteAtFilter μ l
s✝ : ι → Set α
li : Filter ι
hs : Tendsto s✝ li (smallSets l)
m : optParam (ι → ℝ) fun i => ENNReal.toReal (↑↑μ (s✝ i))
hsμ : autoParam ((fun i => ENNReal.toReal (↑↑μ (s✝ i))) =ᶠ[li] m) _auto✝
ε : ℝ
ε₀ : 0 < ε
this : ∀ᶠ (s : Set α) in smallSets l, ∀ᵐ (x : α) ∂μ, x ∈ s → f x ∈ closedBall b ε
s : Set α
hμs : ↑↑μ s < ⊤
h_integrable : IntegrableOn f s
hfm : AEStronglyMeasurable f (Measure.restrict μ s)
h_norm : ∀ᵐ (x : α) ∂μ, x ∈ s → ‖f x - b‖ ≤ ε
⊢ ‖∫ (x : α) in s, f x ∂μ - ENNReal.toReal (↑↑μ s) • b‖ ≤ ε * ‖ENNReal.toReal (↑↑μ s)‖

Next tactic:
rw [← set_integral_const, ← integral_sub h_integrable (integrableOn_const.2 <| Or.inr hμs),
    Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg]
/-- Fundamental theorem of calculus for set integrals:
if `μ` is a measure that is finite at a filter `l` and
`f` is a measurable function that has a finite limit `b` at `l ⊓ μ.ae`, then
`∫ x in s i, f x ∂μ = μ (s i) • b + o(μ (s i))` at a filter `li` provided that
`s i` tends to `l.smallSets` along `li`.
Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).toReal` in the actual statement.

Often there is a good formula for `(μ (s i)).toReal`, so the formalization can take an optional
argument `m` with this formula and a proof of `(fun i => (μ (s i)).toReal) =ᶠ[li] m`. Without these
arguments, `m i = (μ (s i)).toReal` is used in the output. -/
theorem Filter.Tendsto.integral_sub_linear_isLittleO_ae [NormedSpace ℝ E] [CompleteSpace E]
    {μ : Measure α} {l : Filter α} [l.IsMeasurablyGenerated] {f : α → E} {b : E}
    (h : Tendsto f (l ⊓ μ.ae) (𝓝 b)) (hfm : StronglyMeasurableAtFilter f l μ)
    (hμ : μ.FiniteAtFilter l) {s : ι → Set α} {li : Filter ι} (hs : Tendsto s li l.smallSets)
    (m : ι → ℝ := fun i => (μ (s i)).toReal)
    (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) :
    (fun i => (∫ x in s i, f x ∂μ) - m i • b) =o[li] m := by
  suffices
      (fun s => (∫ x in s, f x ∂μ) - (μ s).toReal • b) =o[l.smallSets] fun s => (μ s).toReal from
    (this.comp_tendsto hs).congr'
      (hsμ.mono fun a ha => by dsimp only [Function.comp_apply] at ha ⊢; rw [ha]) hsμ
  refine' isLittleO_iff.2 fun ε ε₀ => _
  have : ∀ᶠ s in l.smallSets, ∀ᶠ x in μ.ae, x ∈ s → f x ∈ closedBall b ε :=
    eventually_smallSets_eventually.2 (h.eventually <| closedBall_mem_nhds _ ε₀)
  filter_upwards [hμ.eventually, (hμ.integrableAtFilter_of_tendsto_ae hfm h).eventually,
    hfm.eventually, this]
  simp only [mem_closedBall, dist_eq_norm]
  intro s hμs h_integrable hfm h_norm
  rw [← set_integral_const, ← integral_sub h_integrable (integrableOn_const.2 <| Or.inr hμs),
    Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg]
  

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁴ : MeasurableSpace α
ι : Type u_5
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace ℝ E
inst✝¹ : CompleteSpace E
μ : Measure α
l : Filter α
inst✝ : IsMeasurablyGenerated l
f : α → E
b : E
h : Tendsto f (l ⊓ Measure.ae μ) (𝓝 b)
hfm✝ : StronglyMeasurableAtFilter f l
hμ : Measure.FiniteAtFilter μ l
s✝ : ι → Set α
li : Filter ι
hs : Tendsto s✝ li (smallSets l)
m : optParam (ι → ℝ) fun i => ENNReal.toReal (↑↑μ (s✝ i))
hsμ : autoParam ((fun i => ENNReal.toReal (↑↑μ (s✝ i))) =ᶠ[li] m) _auto✝
ε : ℝ
ε₀ : 0 < ε
this : ∀ᶠ (s : Set α) in smallSets l, ∀ᵐ (x : α) ∂μ, x ∈ s → f x ∈ closedBall b ε
s : Set α
hμs : ↑↑μ s < ⊤
h_integrable : IntegrableOn f s
hfm : AEStronglyMeasurable f (Measure.restrict μ s)
h_norm : ∀ᵐ (x : α) ∂μ, x ∈ s → ‖f x - b‖ ≤ ε
⊢ ‖∫ (a : α) in s, f a - b ∂μ‖ ≤ ε * ENNReal.toReal (↑↑μ s)

Next tactic:
exact norm_set_integral_le_of_norm_le_const_ae' hμs h_norm (hfm.sub aestronglyMeasurable_const)
theorem continuous_integral_comp_L1 (L : E →L[𝕜] F) :
    Continuous fun φ : α →₁[μ] E => ∫ a : α, L (φ a) ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁶ : MeasurableSpace α
ι : Type u_5
inst✝⁵ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁴ : IsROrC 𝕜
inst✝³ : NormedSpace 𝕜 E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝ : NormedSpace ℝ F
L : E →L[𝕜] F
⊢ Continuous fun φ => ∫ (a : α), L (↑↑φ a) ∂μ

Next tactic:
rw [← funext L.integral_compLp]
theorem continuous_integral_comp_L1 (L : E →L[𝕜] F) :
    Continuous fun φ : α →₁[μ] E => ∫ a : α, L (φ a) ∂μ := by
  rw [← funext L.integral_compLp]; 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁶ : MeasurableSpace α
ι : Type u_5
inst✝⁵ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁴ : IsROrC 𝕜
inst✝³ : NormedSpace 𝕜 E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝ : NormedSpace ℝ F
L : E →L[𝕜] F
⊢ Continuous fun x => ∫ (a : α), ↑↑(compLp L x) a ∂μ

Next tactic:
exact continuous_integral.comp (L.compLpL 1 μ).continuous
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
⊢ ∫ (a : α), L (φ a) ∂μ = L (∫ (a : α), φ a ∂μ)

Next tactic:
apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · 

Proof state:
case h_ind
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
⊢ ∀ (c : E) ⦃s : Set α⦄,
    MeasurableSet s →
      ↑↑?m.456616 s < ⊤ → ∫ (a : α), L (indicator s (fun x => c) a) ∂μ = L (∫ (a : α), indicator s (fun x => c) a ∂μ)

Next tactic:
intro e s s_meas _
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    

Proof state:
case h_ind
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
e : E
s : Set α
s_meas : MeasurableSet s
a✝ : ↑↑?m.456616 s < ⊤
⊢ ∫ (a : α), L (indicator s (fun x => e) a) ∂μ = L (∫ (a : α), indicator s (fun x => e) a ∂μ)

Next tactic:
rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    

Proof state:
case h_ind
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
e : E
s : Set α
s_meas : MeasurableSet s
a✝ : ↑↑?m.456616 s < ⊤
⊢ ∫ (a : α), L (indicator s (fun x => e) a) ∂μ = ∫ (a : α), indicator s (fun x => L e) a ∂μ

Next tactic:
congr 1 with a
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    

Proof state:
case h_ind.e_f.h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
e : E
s : Set α
s_meas : MeasurableSet s
a✝ : ↑↑?m.456616 s < ⊤
a : α
⊢ L (indicator s (fun x => e) a) = indicator s (fun x => L e) a

Next tactic:
erw [Set.indicator_comp_of_zero L.map_zero]
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    erw [Set.indicator_comp_of_zero L.map_zero]
    

Proof state:
case h_ind.e_f.h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
e : E
s : Set α
s_meas : MeasurableSet s
a✝ : ↑↑?m.456616 s < ⊤
a : α
⊢ L (indicator s (fun x => e) a) = (⇑L ∘ indicator s fun x => e) a

Next tactic:
rfl
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    erw [Set.indicator_comp_of_zero L.map_zero]
    rfl
  · 

Proof state:
case h_add
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
⊢ ∀ ⦃f g : α → E⦄,
    Disjoint (support f) (support g) →
      Integrable f →
        Integrable g →
          ∫ (a : α), L (f a) ∂μ = L (∫ (a : α), f a ∂μ) →
            ∫ (a : α), L (g a) ∂μ = L (∫ (a : α), g a ∂μ) → ∫ (a : α), L ((f + g) a) ∂μ = L (∫ (a : α), (f + g) a ∂μ)

Next tactic:
intro f g _ f_int g_int hf hg
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    erw [Set.indicator_comp_of_zero L.map_zero]
    rfl
  · intro f g _ f_int g_int hf hg
    

Proof state:
case h_add
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
f g : α → E
a✝ : Disjoint (support f) (support g)
f_int : Integrable f
g_int : Integrable g
hf : ∫ (a : α), L (f a) ∂μ = L (∫ (a : α), f a ∂μ)
hg : ∫ (a : α), L (g a) ∂μ = L (∫ (a : α), g a ∂μ)
⊢ ∫ (a : α), L ((f + g) a) ∂μ = L (∫ (a : α), (f + g) a ∂μ)

Next tactic:
simp [L.map_add, integral_add (μ := μ) f_int g_int,
      integral_add (μ := μ) (L.integrable_comp f_int) (L.integrable_comp g_int), hf, hg]
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    erw [Set.indicator_comp_of_zero L.map_zero]
    rfl
  · intro f g _ f_int g_int hf hg
    simp [L.map_add, integral_add (μ := μ) f_int g_int,
      integral_add (μ := μ) (L.integrable_comp f_int) (L.integrable_comp g_int), hf, hg]
  · 

Proof state:
case h_closed
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
⊢ IsClosed {f | ∫ (a : α), L (↑↑f a) ∂μ = L (∫ (a : α), ↑↑f a ∂μ)}

Next tactic:
exact isClosed_eq L.continuous_integral_comp_L1 (L.continuous.comp continuous_integral)
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    erw [Set.indicator_comp_of_zero L.map_zero]
    rfl
  · intro f g _ f_int g_int hf hg
    simp [L.map_add, integral_add (μ := μ) f_int g_int,
      integral_add (μ := μ) (L.integrable_comp f_int) (L.integrable_comp g_int), hf, hg]
  · exact isClosed_eq L.continuous_integral_comp_L1 (L.continuous.comp continuous_integral)
  · 

Proof state:
case h_ae
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
⊢ ∀ ⦃f g : α → E⦄,
    f =ᵐ[μ] g →
      Integrable f → ∫ (a : α), L (f a) ∂μ = L (∫ (a : α), f a ∂μ) → ∫ (a : α), L (g a) ∂μ = L (∫ (a : α), g a ∂μ)

Next tactic:
intro f g hfg _ hf
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    erw [Set.indicator_comp_of_zero L.map_zero]
    rfl
  · intro f g _ f_int g_int hf hg
    simp [L.map_add, integral_add (μ := μ) f_int g_int,
      integral_add (μ := μ) (L.integrable_comp f_int) (L.integrable_comp g_int), hf, hg]
  · exact isClosed_eq L.continuous_integral_comp_L1 (L.continuous.comp continuous_integral)
  · intro f g hfg _ hf
    

Proof state:
case h_ae
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
f g : α → E
hfg : f =ᵐ[μ] g
a✝ : Integrable f
hf : ∫ (a : α), L (f a) ∂μ = L (∫ (a : α), f a ∂μ)
⊢ ∫ (a : α), L (g a) ∂μ = L (∫ (a : α), g a ∂μ)

Next tactic:
convert hf using 1
theorem integral_comp_comm (L : E →L[𝕜] F) {φ : α → E} (φ_int : Integrable φ μ) :
    (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ) := by
  apply Integrable.induction (P := fun φ => (∫ a, L (φ a) ∂μ) = L (∫ a, φ a ∂μ))
  · intro e s s_meas _
    rw [integral_indicator_const e s_meas, ← @smul_one_smul E ℝ 𝕜 _ _ _ _ _ (μ s).toReal e,
      ContinuousLinearMap.map_smul, @smul_one_smul F ℝ 𝕜 _ _ _ _ _ (μ s).toReal (L e), ←
      integral_indicator_const (L e) s_meas]
    congr 1 with a
    erw [Set.indicator_comp_of_zero L.map_zero]
    rfl
  · intro f g _ f_int g_int hf hg
    simp [L.map_add, integral_add (μ := μ) f_int g_int,
      integral_add (μ := μ) (L.integrable_comp f_int) (L.integrable_comp g_int), hf, hg]
  · exact isClosed_eq L.continuous_integral_comp_L1 (L.continuous.comp continuous_integral)
  · intro f g hfg _ hf
    convert hf using 1 <;> 

Proof state:
case h.e'_2
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝⁹ : MeasurableSpace α
ι : Type u_5
inst✝⁸ : NormedAddCommGroup E
μ : Measure α
𝕜 : Type u_6
inst✝⁷ : IsROrC 𝕜
inst✝⁶ : NormedSpace 𝕜 E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
p : ℝ≥0∞
inst✝³ : NormedSpace ℝ F
inst✝² : CompleteSpace E
inst✝¹ : CompleteSpace F
inst✝ : NormedSpace ℝ E
L : E →L[𝕜] F
φ : α → E
φ_int : Integrable φ
f g : α → E
hfg : f =ᵐ[μ] g
a✝ : Integrable f
hf : ∫ (a : α), L (f a) ∂μ = L (∫ (a : α), f a ∂μ)
⊢ ∫ (a : α), L (g a) ∂μ = ∫ (a : α), L (f a) ∂μ

Next tactic:
clear hf