Exact Lean source
ScalarTaylorRemainder
formalization/Cloning/ScalarTaylorRemainder.lean
Source hash: 5f37609b99fc629b81d8abd937c2be41efff14958bcc383e285deb6f539f25ca
Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.
The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.
Declarations in this module
1import Mathlib.Analysis.Calculus.Taylor
2import Mathlib.Analysis.Asymptotics.Defs
3import Mathlib.Tactic
4
5/-! Local scalar Taylor estimates with the precise next-order remainder. -/
6noncomputable section
7open scoped Topology
8open Filter Set Asymptotics
9namespace Cloning.ScalarTaylor
10set_option backward.isDefEq.respectTransparency false
11variable {f : ℝ → ℝ} {a : ℝ}
12
13theorem local_taylor_isLittleO (n : ℕ) (hf : ContDiffAt ℝ n f a) :
14 (fun x => f x - taylorWithinEval f n univ a x) =o[𝓝 a]
15 (fun x => (x-a)^n) := by
16 have hf' : ContDiffWithinAt ℝ n f univ a := hf.contDiffWithinAt
17 obtain ⟨u,hu,hau,hfu⟩ := hf'.contDiffOn' le_rfl (by simp)
18 simp only [Set.insert_eq_of_mem (Set.mem_univ a), univ_inter] at hfu
19 obtain ⟨l,r,ham,hsub⟩ := mem_nhds_iff_exists_Ioo_subset.mp (hu.mem_nhds hau)
20 have h := taylor_isLittleO (convex_Ioo l r) ham (hfu.mono hsub)
21 rw [nhdsWithin_eq_nhds.mpr (Ioo_mem_nhds ham.1 ham.2)] at h
22 have he (x : ℝ) : taylorWithinEval f n (Ioo l r) a x =
23 taylorWithinEval f n univ a x := by
24 simp only [taylor_within_apply, iteratedDerivWithin_univ]
25 apply Finset.sum_congr rfl
26 intro k hk
27 rw [iteratedDerivWithin_eq_iteratedDeriv isOpen_Ioo.uniqueDiffOn
28 (hf.of_le (by exact_mod_cast Nat.le_of_lt_succ (Finset.mem_range.mp hk))) ham]
29 simpa only [he] using h
30
31theorem local_taylor_isBigO (n : ℕ) (hf : ContDiffAt ℝ (n+1) f a) :
32 (fun x => f x - taylorWithinEval f n univ a x) =O[𝓝 a]
33 (fun x => (x-a)^(n+1)) := by
34 have h := (local_taylor_isLittleO (n+1) hf).isBigO
35 have ht := isBigO_const_mul_self
36 (((((n+1 : ℕ) : ℝ) * n.factorial)⁻¹) * iteratedDeriv (n+1) f a)
37 (fun x : ℝ => (x-a)^(n+1)) (𝓝 a)
38 convert h.add ht using 1
39 ext x
40 simp only [taylorWithinEval_succ, iteratedDerivWithin_univ, smul_eq_mul,
41 Nat.cast_add, Nat.cast_one]
42 ring
43
44/-- The usual second-order expansion, with a cubic big-O error. -/
45theorem quadratic_remainder (hf : ContDiffAt ℝ 3 f 0) :
46 (fun x => f x - (f 0 + deriv f 0*x + deriv (deriv f) 0/2*x^2))
47 =O[𝓝 (0:ℝ)] (fun x => x^3) := by
48 have h := local_taylor_isBigO 2 hf
49 convert h using 1
50 · ext x
51 simp only [taylorWithinEval_succ, taylor_within_zero_eval,
52 iteratedDerivWithin_univ, iteratedDeriv_one, iteratedDeriv_succ,
53 smul_eq_mul, sub_zero]
54 norm_num
55 ring
56 · simp
57
58end Cloning.ScalarTaylor