Skip to content

Commit

Permalink
feat: Basic theorems for iteratedFDerivWithin (#10733)
Browse files Browse the repository at this point in the history
Basic theorems for iteratedFDerivWithin
  • Loading branch information
jvlmdr committed Feb 20, 2024
1 parent 300250f commit 73c0d3b
Showing 1 changed file with 51 additions and 17 deletions.
68 changes: 51 additions & 17 deletions Mathlib/Analysis/Calculus/ContDiff/Basic.lean
Expand Up @@ -58,17 +58,21 @@ variable {π•œ : Type*} [NontriviallyNormedField π•œ] {D : Type uD} [NormedAddC

/-! ### Constants -/

-- porting note: TODO: prove `HasFTaylorSeriesUpToOn` theorems for zero and a constant

@[simp]
theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun _ : E => (0 : F)) = 0 := by
induction' n with n IH
Β· ext m; simp
Β· ext x m
rw [iteratedFDeriv_succ_apply_left, IH]
change (fderiv π•œ (fun _ : E => (0 : E[Γ—n]β†’L[π•œ] F)) x : E β†’ E[Γ—n]β†’L[π•œ] F) (m 0) (tail m) = _
rw [fderiv_const]
theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) {i : β„•} :
iteratedFDerivWithin π•œ i (fun _ : E ↦ (0 : F)) s x = 0 := by
induction i generalizing x with
| zero => ext; simp
| succ i IH =>
ext m
rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ ↦ IH) (IH hx)]
rw [fderivWithin_const_apply _ (hs x hx)]
rfl

@[simp]
theorem iteratedFDeriv_zero_fun {n : β„•} : (iteratedFDeriv π•œ n fun _ : E ↦ (0 : F)) = 0 :=
funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun

theorem contDiff_zero_fun : ContDiff π•œ n fun _ : E => (0 : F) :=
Expand Down Expand Up @@ -119,18 +123,31 @@ theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π•œ n f s := b
rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
#align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton

-- porting note: TODO: add a `fderivWithin` version
theorem iteratedFDerivWithin_succ_const (n : β„•) (c : F) (hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
iteratedFDerivWithin π•œ (n + 1) (fun _ : E ↦ c) s x = 0 := by
ext m
rw [iteratedFDerivWithin_succ_apply_right hs hx]
rw [iteratedFDerivWithin_congr (fun y hy ↦ fderivWithin_const_apply c (hs y hy)) hx]
rw [iteratedFDerivWithin_zero_fun hs hx]
simp [ContinuousMultilinearMap.zero_apply (R := π•œ)]

theorem iteratedFDeriv_succ_const (n : β„•) (c : F) :
(iteratedFDeriv π•œ (n + 1) fun _ : E => c) = 0 := by
ext x
simp only [iteratedFDeriv_succ_eq_comp_right, fderiv_const, Pi.zero_apply,
iteratedFDeriv_zero_fun, comp_apply, LinearIsometryEquiv.map_zero]
(iteratedFDeriv π•œ (n + 1) fun _ : E ↦ c) = 0 :=
funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
iteratedFDerivWithin_succ_const n c uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_succ_const iteratedFDeriv_succ_const

theorem iteratedFDerivWithin_const_of_ne {n : β„•} (hn : n β‰  0) (c : F)
(hs : UniqueDiffOn π•œ s) (hx : x ∈ s) :
iteratedFDerivWithin π•œ n (fun _ : E ↦ c) s x = 0 := by
cases n with
| zero => contradiction
| succ n => exact iteratedFDerivWithin_succ_const n c hs hx

theorem iteratedFDeriv_const_of_ne {n : β„•} (hn : n β‰  0) (c : F) :
(iteratedFDeriv π•œ n fun _ : E => c) = 0 := by
cases' Nat.exists_eq_succ_of_ne_zero hn with k hk
rw [hk, iteratedFDeriv_succ_const]
(iteratedFDeriv π•œ n fun _ : E ↦ c) = 0 :=
funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
iteratedFDerivWithin_const_of_ne hn c uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_const_of_ne iteratedFDeriv_const_of_ne

/-! ### Smoothness of linear functions -/
Expand Down Expand Up @@ -1429,6 +1446,23 @@ theorem ContDiff.sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {s : Finset ΞΉ}
simp only [← contDiffOn_univ] at *; exact ContDiffOn.sum h
#align cont_diff.sum ContDiff.sum

theorem iteratedFDerivWithin_sum_apply {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {u : Finset ΞΉ} {i : β„•} {x : E}
(hs : UniqueDiffOn π•œ s) (hx : x ∈ s) (h : βˆ€ j ∈ u, ContDiffOn π•œ i (f j) s) :
iteratedFDerivWithin π•œ i (βˆ‘ j in u, f j Β·) s x =
βˆ‘ j in u, iteratedFDerivWithin π•œ i (f j) s x := by
induction u using Finset.cons_induction with
| empty => ext; simp [hs, hx]
| @cons a u ha IH =>
simp only [Finset.mem_cons, forall_eq_or_imp] at h
simp only [Finset.sum_cons]
rw [iteratedFDerivWithin_add_apply' h.1 (ContDiffOn.sum h.2) hs hx, IH h.2]

theorem iteratedFDeriv_sum {ΞΉ : Type*} {f : ΞΉ β†’ E β†’ F} {u : Finset ΞΉ} {i : β„•}
(h : βˆ€ j ∈ u, ContDiff π•œ i (f j)) :
iteratedFDeriv π•œ i (βˆ‘ j in u, f j Β·) = βˆ‘ j in u, iteratedFDeriv π•œ i (f j) :=
funext fun x ↦ by simpa [iteratedFDerivWithin_univ] using
iteratedFDerivWithin_sum_apply uniqueDiffOn_univ (mem_univ x) fun j hj ↦ (h j hj).contDiffOn

/-! ### Product of two functions -/

section MulProd
Expand Down

0 comments on commit 73c0d3b

Please sign in to comment.