Skip to content

Commit

Permalink
chore(Calculus/ParametricIntegralInterval): small clean-ups (#10005)
Browse files Browse the repository at this point in the history
- collect some very common variables
- use refine and \mapsto instead of refine' and => (both are preferred now)
  • Loading branch information
grunweg committed Jan 26, 2024
1 parent 1fec3c4 commit ab48003
Showing 1 changed file with 53 additions and 48 deletions.
101 changes: 53 additions & 48 deletions Mathlib/Analysis/Calculus/ParametricIntegral.lean
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,32 @@ variable {α : Type*} [MeasurableSpace α] {μ : Measure α} {𝕜 : Type*} [IsR
[NormedAddCommGroup E] [NormedSpace ℝ E] [NormedSpace 𝕜 E] [CompleteSpace E] {H : Type*}
[NormedAddCommGroup H] [NormedSpace 𝕜 H]

variable {F : H → α → E} {x₀ : H} {bound : α → ℝ} {ε : ℝ}

/-- Differentiation under integral of `x ↦ ∫ F x a` at a given point `x₀`, assuming `F x₀` is
integrable, `‖F x a - F x₀ a‖ ≤ bound a * ‖x - x₀‖` for `x` in a ball around `x₀` for ae `a` with
integrable Lipschitz bound `bound` (with a ball radius independent of `a`), and `F x` is
ae-measurable for `x` in the same ball. See `hasFDerivAt_integral_of_dominated_loc_of_lip` for a
slightly less general but usually more useful version. -/
theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F : H → α → E} {F' : α → H →L[𝕜] E} {x₀ : H}
{bound : α → ℝ} {ε : ℝ} (ε_pos : 0 < ε)
theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F' : α → H →L[𝕜] E} (ε_pos : 0 < ε)
(hF_meas : ∀ x ∈ ball x₀ ε, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ)
(hF'_meas : AEStronglyMeasurable F' μ)
(h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ bound a * ‖x - x₀‖)
(bound_integrable : Integrable (bound : α → ℝ) μ)
(h_diff : ∀ᵐ a ∂μ, HasFDerivAt (fun x => F x a) (F' a) x₀) :
Integrable F' μ ∧ HasFDerivAt (fun x => ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
(h_diff : ∀ᵐ a ∂μ, HasFDerivAt (F · a) (F' a) x₀) :
Integrable F' μ ∧ HasFDerivAt (fun x ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
have nneg : ∀ x, 0 ≤ ‖x - x₀‖⁻¹ := fun x => inv_nonneg.mpr (norm_nonneg _)
set b : α → ℝ := fun a => |bound a|
have nneg : ∀ x, 0 ≤ ‖x - x₀‖⁻¹ := fun x inv_nonneg.mpr (norm_nonneg _)
set b : α → ℝ := fun a |bound a|
have b_int : Integrable b μ := bound_integrable.norm
have b_nonneg : ∀ a, 0 ≤ b a := fun a => abs_nonneg _
have b_nonneg : ∀ a, 0 ≤ b a := fun a abs_nonneg _
replace h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖
exact h_lipsch.mono fun a ha x hx =>
exact h_lipsch.mono fun a ha x hx
(ha x hx).trans <| mul_le_mul_of_nonneg_right (le_abs_self _) (norm_nonneg _)
have hF_int' : ∀ x ∈ ball x₀ ε, Integrable (F x) μ := fun x x_in ↦ by
have : ∀ᵐ a ∂μ, ‖F x₀ a - F x a‖ ≤ ε * b a := by
simp only [norm_sub_rev (F x₀ _)]
refine' h_lipsch.mono fun a ha => (ha x x_in).trans _
refine h_lipsch.mono fun a ha (ha x x_in).trans ?_
rw [mul_comm ε]
rw [mem_ball, dist_eq_norm] at x_in
exact mul_le_mul_of_nonneg_left x_in.le (b_nonneg _)
Expand All @@ -97,9 +98,9 @@ theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F : H → α → E} {F' :
have : ∀ᵐ a ∂μ, ‖F' a‖ ≤ b a := by
apply (h_diff.and h_lipsch).mono
rintro a ⟨ha_diff, ha_lip⟩
refine' ha_diff.le_of_lip' (b_nonneg a) (mem_of_superset (ball_mem_nhds _ ε_pos) <| ha_lip)
exact ha_diff.le_of_lip' (b_nonneg a) (mem_of_superset (ball_mem_nhds _ ε_pos) <| ha_lip)
b_int.mono' hF'_meas this
refine' ⟨hF'_int, _⟩
refine ⟨hF'_int, ?_⟩
have h_ball : ball x₀ ε ∈ 𝓝 x₀ := ball_mem_nhds x₀ ε_pos
have : ∀ᶠ x in 𝓝 x₀, ‖x - x₀‖⁻¹ * ‖((∫ a, F x a ∂μ) - ∫ a, F x₀ a ∂μ) - (∫ a, F' a ∂μ) (x - x₀)‖ =
‖∫ a, ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀)) ∂μ‖ := by
Expand Down Expand Up @@ -135,9 +136,9 @@ theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F : H → α → E} {F' :
· exact b_int.add hF'_int.norm
· apply h_diff.mono
intro a ha
suffices Tendsto (fun x => ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))) (𝓝 x₀) (𝓝 0) by simpa
suffices Tendsto (fun x ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))) (𝓝 x₀) (𝓝 0) by simpa
rw [tendsto_zero_iff_norm_tendsto_zero]
have : (fun x => ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a - F' a (x - x₀)‖) = fun x =>
have : (fun x ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a - F' a (x - x₀)‖) = fun x
‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ := by
ext x
rw [norm_smul_of_nonneg (nneg _)]
Expand All @@ -148,18 +149,18 @@ theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F : H → α → E} {F' :
`F x₀` is integrable, `x ↦ F x a` is locally Lipschitz on a ball around `x₀` for ae `a`
(with a ball radius independent of `a`) with integrable Lipschitz bound, and `F x` is ae-measurable
for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasFDerivAt_integral_of_dominated_loc_of_lip {F : H → α → E} {F' : α → H →L[𝕜] E} {x₀ : H}
{bound : α → ℝ} {ε : ℝ} (ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
theorem hasFDerivAt_integral_of_dominated_loc_of_lip {F' : α → H →L[𝕜] E}
(ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
(hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable F' μ)
(h_lip : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs <| bound a) (fun x => F x a) (ball x₀ ε))
(h_lip : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs <| bound a) (F · a) (ball x₀ ε))
(bound_integrable : Integrable (bound : α → ℝ) μ)
(h_diff : ∀ᵐ a ∂μ, HasFDerivAt (fun x => F x a) (F' a) x₀) :
Integrable F' μ ∧ HasFDerivAt (fun x => ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
(h_diff : ∀ᵐ a ∂μ, HasFDerivAt (F · a) (F' a) x₀) :
Integrable F' μ ∧ HasFDerivAt (fun x ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ x ∈ ball x₀ δ, AEStronglyMeasurable (F x) μ ∧ x ∈ ball x₀ ε
exact eventually_nhds_iff_ball.mp (hF_meas.and (ball_mem_nhds x₀ ε_pos))
choose hδ_meas hδε using hδ
replace h_lip : ∀ᵐ a : α ∂μ, ∀ x ∈ ball x₀ δ, ‖F x a - F x₀ a‖ ≤ |bound a| * ‖x - x₀‖
exact h_lip.mono fun a lip x hx => lip.norm_sub_le (hδε x hx) (mem_ball_self ε_pos)
exact h_lip.mono fun a lip x hx lip.norm_sub_le (hδε x hx) (mem_ball_self ε_pos)
replace bound_integrable := bound_integrable.norm
apply hasFDerivAt_integral_of_dominated_loc_of_lip' δ_pos <;> assumption
#align has_fderiv_at_integral_of_dominated_loc_of_lip hasFDerivAt_integral_of_dominated_loc_of_lip
Expand All @@ -168,44 +169,46 @@ theorem hasFDerivAt_integral_of_dominated_loc_of_lip {F : H → α → E} {F' :
`F x₀` is integrable, `x ↦ F x a` is differentiable on a ball around `x₀` for ae `a` with
derivative norm uniformly bounded by an integrable function (the ball radius is independent of `a`),
and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasFDerivAt_integral_of_dominated_of_fderiv_le {F : H → α → E} {F' : H → α → H →L[𝕜] E}
{x₀ : H} {bound : α → ℝ} {ε : ℝ} (ε_pos : 0 < ε)
theorem hasFDerivAt_integral_of_dominated_of_fderiv_le {F' : H → α → H →L[𝕜] E} (ε_pos : 0 < ε)
(hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ)
(hF'_meas : AEStronglyMeasurable (F' x₀) μ)
(h_bound : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a)
(bound_integrable : Integrable (bound : α → ℝ) μ)
(h_diff : ∀ᵐ a ∂μ, ∀ 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₀ := by
(h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasFDerivAt (F · a) (F' x a) x) :
HasFDerivAt (fun x ∫ a, F x a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
letI : NormedSpace ℝ H := NormedSpace.restrictScalars ℝ 𝕜 H
have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
have diff_x₀ : ∀ᵐ a ∂μ, HasFDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
h_diff.mono fun a ha => ha x₀ x₀_in
have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x => F x a) (ball x₀ ε) := by
have diff_x₀ : ∀ᵐ a ∂μ, HasFDerivAt (fun x F x a) (F' x₀ a) x₀ :=
h_diff.mono fun a ha ha x₀ x₀_in
have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (F · 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 => _
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 _)
exact (hasFDerivAt_integral_of_dominated_loc_of_lip ε_pos hF_meas hF_int hF'_meas this
bound_integrable diff_x₀).2
#align has_fderiv_at_integral_of_dominated_of_fderiv_le hasFDerivAt_integral_of_dominated_of_fderiv_le

section

variable {F : 𝕜 → α → E} {x₀ : 𝕜}

/-- Derivative under integral of `x ↦ ∫ F x a` at a given point `x₀ : 𝕜`, `𝕜 = ℝ` or `𝕜 = ℂ`,
assuming `F x₀` is integrable, `x ↦ F x a` is locally Lipschitz on a ball around `x₀` for ae `a`
(with ball radius independent of `a`) with integrable Lipschitz bound, and `F x` is
ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasDerivAt_integral_of_dominated_loc_of_lip {F : 𝕜 → α → E} {F' : α → E} {x₀ : 𝕜} {ε : ℝ}
(ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
(hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable F' μ) {bound : α → ℝ}
(h_lipsch : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs <| bound a) (fun x => F x a) (ball x₀ ε))
theorem hasDerivAt_integral_of_dominated_loc_of_lip {F' : α → E} (ε_pos : 0 < ε)
(hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ)
(hF'_meas : AEStronglyMeasurable F' μ)
(h_lipsch : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs <| bound a) (F · a) (ball x₀ ε))
(bound_integrable : Integrable (bound : α → ℝ) μ)
(h_diff : ∀ᵐ a ∂μ, HasDerivAt (fun x => F x a) (F' a) x₀) :
Integrable F' μ ∧ HasDerivAt (fun x => ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
(h_diff : ∀ᵐ a ∂μ, HasDerivAt (F · a) (F' a) x₀) :
Integrable F' μ ∧ HasDerivAt (fun x ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
set L : E →L[𝕜] 𝕜 →L[𝕜] E := ContinuousLinearMap.smulRightL 𝕜 𝕜 E 1
replace h_diff : ∀ᵐ a ∂μ, HasFDerivAt (fun x => F x a) (L (F' a)) x₀ :=
h_diff.mono fun x hx => hx.hasFDerivAt
replace h_diff : ∀ᵐ a ∂μ, HasFDerivAt (F · a) (L (F' a)) x₀ :=
h_diff.mono fun x hx hx.hasFDerivAt
have hm : AEStronglyMeasurable (L ∘ F') μ := L.continuous.comp_aestronglyMeasurable hF'_meas
cases'
hasFDerivAt_integral_of_dominated_loc_of_lip ε_pos hF_meas hF_int hm h_lipsch bound_integrable
Expand All @@ -217,7 +220,7 @@ theorem hasDerivAt_integral_of_dominated_loc_of_lip {F : 𝕜 → α → E} {F'
ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_restrict_scalarsL',
ContinuousLinearMap.norm_restrictScalars, ContinuousLinearMap.norm_smulRightL_apply] using
hF'_int
refine' ⟨hF'_int, _⟩
refine ⟨hF'_int, ?_⟩
simp_rw [hasDerivAt_iff_hasFDerivAt] at h_diff ⊢
simpa only [(· ∘ ·), ContinuousLinearMap.integral_comp_comm _ hF'_int] using key
#align has_deriv_at_integral_of_dominated_loc_of_lip hasDerivAt_integral_of_dominated_loc_of_lip
Expand All @@ -226,23 +229,25 @@ theorem hasDerivAt_integral_of_dominated_loc_of_lip {F : 𝕜 → α → E} {F'
`F x₀` is integrable, `x ↦ F x a` is differentiable on an interval around `x₀` for ae `a`
(with interval radius independent of `a`) with derivative uniformly bounded by an integrable
function, and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
theorem hasDerivAt_integral_of_dominated_loc_of_deriv_le {F : 𝕜 → α → E} {F' : 𝕜 → α → E} {x₀ : 𝕜}
{ε : ℝ} (ε_pos : 0 < ε) (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ)
(hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable (F' x₀) μ) {bound : α → ℝ}
theorem hasDerivAt_integral_of_dominated_loc_of_deriv_le (ε_pos : 0 < ε)
(hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ)
{F' : 𝕜 → α → E} (hF'_meas : AEStronglyMeasurable (F' x₀) μ)
(h_bound : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F' x a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
(h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (fun x => F x a) (F' x a) x) :
Integrable (F' x₀) μ ∧ HasDerivAt (fun n => ∫ a, F n a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
(h_diff : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, HasDerivAt (F · a) (F' x a) x) :
Integrable (F' x₀) μ ∧ HasDerivAt (fun n ∫ a, F n a ∂μ) (∫ a, F' x₀ a ∂μ) x₀ := by
have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
have diff_x₀ : ∀ᵐ a ∂μ, HasDerivAt (fun x => F x a) (F' x₀ a) x₀ :=
h_diff.mono fun a ha => ha x₀ x₀_in
have : ∀ᵐ a ∂μ, LipschitzOnWith (Real.nnabs (bound a)) (fun x : 𝕜 => F x a) (ball x₀ ε) := by
have diff_x₀ : ∀ᵐ a ∂μ, HasDerivAt (F · a) (F' x₀ a) x₀ :=
h_diff.mono fun a ha ha x₀ x₀_in
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_hasDerivWithin_le
(fun x x_in => (ha_deriv x x_in).hasDerivWithinAt) fun x x_in => _
refine (convex_ball _ _).lipschitzOnWith_of_nnnorm_hasDerivWithin_le
(fun x x_in (ha_deriv x x_in).hasDerivWithinAt) fun x x_in ↦ ?_
rw [← NNReal.coe_le_coe, coe_nnnorm, Real.coe_nnabs]
exact (ha_bound x x_in).trans (le_abs_self _)
exact
hasDerivAt_integral_of_dominated_loc_of_lip ε_pos hF_meas hF_int hF'_meas this bound_integrable
diff_x₀
#align has_deriv_at_integral_of_dominated_loc_of_deriv_le hasDerivAt_integral_of_dominated_loc_of_deriv_le

end

0 comments on commit ab48003

Please sign in to comment.