Theorem: hasFDerivAt_integral_of_dominated_of_fderiv_le
File: Mathlib/Analysis/Calculus/ParametricIntegral.lean

tactic: letI : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
state_before: α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
⊢ HasFDerivAt (fun x => ∫ (a : α), F x a ∂μ) (∫ (a : α), F' x₀ a ∂μ) x₀

tactic: have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
state_before: α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
⊢ HasFDerivAt (fun x => ∫ (a : α), F x a ∂μ) (∫ (a : α), F' x₀ a ∂μ) x₀

tactic: have diff_x₀ : ∀ᵐ a ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
  h_diff.mono fun a ha => ha x₀ x₀_in
state_before: α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
⊢ HasFDerivAt (fun x => ∫ (a : α), F x a ∂μ) (∫ (a : α), F' x₀ a ∂μ) x₀

tactic: have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x => F x a) (ball x₀ ε) := by
  apply (h_diff.and h_bound).mono
  rintro a ⟨ha_deriv, ha_bound⟩
  refine'
    (convex_ball _ _).lipschitzOnWith_of_nnnorm_hasFDerivWithin_le
      (fun x x_in => (ha_deriv x x_in).hasFDerivWithinAt) fun x x_in => _
  rw [← NNReal.coe_le_coe, coe_nnnorm, Real.coe_nnabs]
  exact (ha_bound x x_in).trans (le_abs_self _)
state_before: α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀
⊢ HasFDerivAt (fun x => ∫ (a : α), F x a ∂μ) (∫ (a : α), F' x₀ a ∂μ) x₀

tactic: exact (hasFDerivAt_integral_of_dominated_loc_of_lip ε_pos hF_meas hF_int hF'_meas this
  bound_integrable diff_x₀).2
state_before: α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this✝ : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀
this : ∀ᵐ (a : α) ∂μ, LipschitzOnWith (↑Real.nnabs (bound a)) (fun x => F x a) (ball x₀ ε)
⊢ HasFDerivAt (fun x => ∫ (a : α), F x a ∂μ) (∫ (a : α), F' x₀ a ∂μ) x₀

tactic: apply (h_diff.and h_bound).mono
state_before: α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀
⊢ ∀ᵐ (a : α) ∂μ, LipschitzOnWith (↑Real.nnabs (bound a)) (fun x => F x a) (ball x₀ ε)

tactic: rintro a ⟨ha_deriv, ha_bound⟩
state_before: α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀
⊢ ∀ (x : α),
    ((∀ (x_1 : H), x_1 ∈ ball x₀ ε → HasFDerivAt (fun x_2 => F x_2 x) (F' x_1 x) x_1) ∧
        ∀ (x_1 : H), x_1 ∈ ball x₀ ε → ‖F' x_1 x‖ ≤ bound x) →
      LipschitzOnWith (↑Real.nnabs (bound x)) (fun x_1 => F x_1 x) (ball x₀ ε)

tactic: refine'
  (convex_ball _ _).lipschitzOnWith_of_nnnorm_hasFDerivWithin_le
    (fun x x_in => (ha_deriv x x_in).hasFDerivWithinAt) fun x x_in => _
state_before: case intro
α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀
a : α
ha_deriv : ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
ha_bound : ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
⊢ LipschitzOnWith (↑Real.nnabs (bound a)) (fun x => F x a) (ball x₀ ε)

tactic: rw [← NNReal.coe_le_coe, coe_nnnorm, Real.coe_nnabs]
state_before: case intro
α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀
a : α
ha_deriv : ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
ha_bound : ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
x : H
x_in : x ∈ ball x₀ ε
⊢ ‖F' x a‖₊ ≤ ↑Real.nnabs (bound a)

tactic: exact (ha_bound x x_in).trans (le_abs_self _)
state_before: case intro
α : Type u_4
inst✝⁷ : MeasurableSpace α
μ : MeasureTheory.Measure α
𝕜 : Type u_1
inst✝⁶ : IsROrC 𝕜
E : Type u_3
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompleteSpace E
H : Type u_2
inst✝¹ : NormedAddCommGroup H
inst✝ : NormedSpace 𝕜 H
F : H → α → E
F' : H → α → H →L[𝕜] E
x₀ : H
bound : α → ℝ
ε : ℝ
ε_pos : 0 < ε
hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, AEStronglyMeasurable (F x) μ
hF_int : Integrable (F x₀)
hF'_meas : AEStronglyMeasurable (F' x₀) μ
h_bound : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
bound_integrable : Integrable bound
h_diff : ∀ᵐ (a : α) ∂μ, ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
this : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
x₀_in : x₀ ∈ ball x₀ ε
diff_x₀ : ∀ᵐ (a : α) ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀
a : α
ha_deriv : ∀ (x : H), x ∈ ball x₀ ε → HasFDerivAt (fun x => F x a) (F' x a) x
ha_bound : ∀ (x : H), x ∈ ball x₀ ε → ‖F' x a‖ ≤ bound a
x : H
x_in : x ∈ ball x₀ ε
⊢ ‖F' x a‖ ≤ abs (bound a)