Skip to content

Commit e5c478f

Browse files
committed
chore: golf proofs in FDeriv/Symmetric (#37785)
This PR shortens two proofs by using existing lemmas and more standard constructions. * In `Analysis/Calculus/FDeriv/Symmetric`, it replaces a manual construction of the restricted second derivative with `bilinearRestrictScalars`, and streamlines the `ContDiffWithinAt.isSymmSndFDerivWithinAt` argument by passing through the corresponding `ContDiffAt` result.
1 parent b1ac64f commit e5c478f

File tree

2 files changed

+9
-53
lines changed

2 files changed

+9
-53
lines changed

Mathlib/Analysis/Calculus/ContDiff/FTaylorSeries.lean

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -654,10 +654,7 @@ lemma iteratedFDerivWithin_comp_add_left' (n : ℕ) (a : E) :
654654
| zero => simp [iteratedFDerivWithin]
655655
| succ n IH =>
656656
ext v
657-
rw [iteratedFDerivWithin_succ_eq_comp_left, iteratedFDerivWithin_succ_eq_comp_left]
658-
simp only [Nat.succ_eq_add_one, IH, comp_apply, continuousMultilinearCurryLeftEquiv_symm_apply]
659-
congr 2
660-
rw [fderivWithin_comp_add_left]
657+
simp [iteratedFDerivWithin_succ_eq_comp_left, IH, fderivWithin_comp_add_left]
661658

662659
/-- The iterated derivative commutes with shifting the function by a constant on the left. -/
663660
lemma iteratedFDerivWithin_comp_add_left (n : ℕ) (a : E) (x : E) :
@@ -714,25 +711,9 @@ lemma HasFTaylorSeriesUpTo.fderiv_eq (h : HasFTaylorSeriesUpTo n f p)
714711

715712
theorem hasFTaylorSeriesUpToOn_univ_iff :
716713
HasFTaylorSeriesUpToOn n f p univ ↔ HasFTaylorSeriesUpTo n f p := by
717-
constructor
718-
· intro H
719-
constructor
720-
· exact fun x => H.zero_eq x (mem_univ x)
721-
· intro m hm x
722-
rw [← hasFDerivWithinAt_univ]
723-
exact H.fderivWithin m hm x (mem_univ x)
724-
· intro m hm
725-
rw [← continuousOn_univ]
726-
exact H.cont m hm
727-
· intro H
728-
constructor
729-
· exact fun x _ => H.zero_eq x
730-
· intro m hm x _
731-
rw [hasFDerivWithinAt_univ]
732-
exact H.fderiv m hm x
733-
· intro m hm
734-
rw [continuousOn_univ]
735-
exact H.cont m hm
714+
constructor <;> refine fun H ↦ ⟨by simpa using H.zero_eq, ?_, by simpa using H.cont⟩
715+
· simpa using H.fderivWithin
716+
· simpa using H.fderiv
736717

737718
theorem HasFTaylorSeriesUpTo.hasFTaylorSeriesUpToOn (h : HasFTaylorSeriesUpTo n f p) (s : Set E) :
738719
HasFTaylorSeriesUpToOn n f p s :=
@@ -883,11 +864,7 @@ theorem norm_fderiv_iteratedFDeriv {n : ℕ} :
883864

884865
theorem iteratedFDerivWithin_univ {n : ℕ} :
885866
iteratedFDerivWithin 𝕜 n f univ = iteratedFDeriv 𝕜 n f := by
886-
induction n with
887-
| zero => ext x; simp
888-
| succ n IH =>
889-
ext x m
890-
rw [iteratedFDeriv_succ_apply_left, iteratedFDerivWithin_succ_apply_left, IH, fderivWithin_univ]
867+
simp [iteratedFDerivWithin, iteratedFDeriv]
891868

892869
variable (𝕜) in
893870
/-- If two functions agree in a neighborhood, then so do their iterated derivatives. -/
@@ -916,20 +893,9 @@ theorem HasFTaylorSeriesUpTo.eq_iteratedFDeriv
916893
derivative. -/
917894
theorem iteratedFDerivWithin_of_isOpen (n : ℕ) (hs : IsOpen s) :
918895
EqOn (iteratedFDerivWithin 𝕜 n f s) (iteratedFDeriv 𝕜 n f) s := by
919-
induction n with
920-
| zero =>
921-
intro x _
922-
ext1
923-
simp only [iteratedFDerivWithin_zero_apply, iteratedFDeriv_zero_apply]
924-
| succ n IH =>
925-
intro x hx
926-
rw [iteratedFDeriv_succ_eq_comp_left, iteratedFDerivWithin_succ_eq_comp_left]
927-
dsimp
928-
congr 1
929-
rw [fderivWithin_of_isOpen hs hx]
930-
apply Filter.EventuallyEq.fderiv_eq
931-
filter_upwards [hs.mem_nhds hx]
932-
exact IH
896+
intro x hx
897+
rw [← iteratedFDerivWithin_univ]
898+
exact iteratedFDerivWithin_congr_set (Filter.eventuallyEq_univ.mpr <| hs.mem_nhds hx) n
933899

934900
theorem ftaylorSeriesWithin_univ : ftaylorSeriesWithin 𝕜 f univ = ftaylorSeries 𝕜 f := by
935901
ext1 x; ext1 n

Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -469,19 +469,9 @@ theorem second_derivative_symmetric_of_eventually [IsRCLikeNormedField 𝕜]
469469
let _ : LinearMap.CompatibleSMul E F ℝ 𝕜 := LinearMap.IsScalarTower.compatibleSMul
470470
let _ : LinearMap.CompatibleSMul E (E →L[𝕜] F) ℝ 𝕜 := LinearMap.IsScalarTower.compatibleSMul
471471
let f'R : E → E →L[ℝ] F := fun x ↦ (f' x).restrictScalars ℝ
472+
let f''R : E →L[ℝ] E →L[ℝ] F := f''.bilinearRestrictScalars ℝ
472473
have hfR : ∀ᶠ y in 𝓝 x, HasFDerivAt f (f'R y) y := by
473474
filter_upwards [hf] with y hy using HasFDerivAt.restrictScalars ℝ hy
474-
let f''Rl : E →ₗ[ℝ] E →ₗ[ℝ] F :=
475-
{ toFun := fun x ↦
476-
{ toFun := fun y ↦ f'' x y
477-
map_add' := by simp
478-
map_smul' := by simp }
479-
map_add' := by intros; ext; simp
480-
map_smul' := by intros; ext; simp }
481-
let f''R : E →L[ℝ] E →L[ℝ] F := by
482-
refine LinearMap.mkContinuous₂ f''Rl (‖f''‖) (fun x y ↦ ?_)
483-
simp only [LinearMap.coe_mk, AddHom.coe_mk, f''Rl]
484-
exact ContinuousLinearMap.le_opNorm₂ f'' x y
485475
have : HasFDerivAt f'R f''R x := by
486476
simp only [hasFDerivAt_iff_tendsto] at hx ⊢
487477
exact hx

0 commit comments

Comments
 (0)