import Mathlib.Analysis.Calculus.ContDiff.CPolynomial import Mathlib.Analysis.Calculus.TaylorIntegral import Mathlib.Analysis.Calculus.BumpFunction.InnerProduct import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.SpecialFunctions.Pow.Integral /-! Concrete radial/Taylor subtraction utilities on the full smooth test class. -/ set_option autoImplicit false noncomputable section namespace YM.MultipleContact open Set Function Filter MeasureTheory TopologicalSpace open scoped Topology ContDiff InnerProductSpace BigOperators Classical variable {E: Type*}[NormedAddCommGroup E][InnerProductSpace ℝ E] /-- Common C∞ radial profile. -/ def χ : ContDiffBump (0:ℝ):=⟨1,4,zero_lt_one,by norm_num⟩ def cutoff (s:ℝ) (x:E) : ℝ:=χ (‖x‖^2/s^2) omit [InnerProductSpace ℝ E] in lemma cutoff_eq_one {s:ℝ}(hs:0.comp ((contDiff_id.norm_sq (𝕜:=ℝ)).div_const _) def coeff (i:ℕ)(f : E→ℂ)(y:E) := (↑(i.factorial):ℝ)⁻¹ • iteratedFDeriv ℝ i f 0 (fun _=>y) def polyJet (m:ℕ)(f : E→ℂ)(y:E) :=∑ i∈ Finset.range (m+1),coeff i f y def diff (s:ℝ)(m:Option ℕ)(f:E→ℂ):E→ℂ:=match m with | none=> f | some m=> fun y=>f y-cutoff s y • polyJet m f y lemma coeff_contDiff (f:E→ℂ)(i:ℕ):ContDiff ℝ ∞ (coeff i f):=by refine (iterate_after _).const_smul _ where iterate_after (i:ℕ):ContDiff ℝ ∞ (fun x=>iteratedFDeriv ℝ i f (0:E) fun _=>x):=by exact (iteratedFDeriv ℝ i f 0).contDiff.comp (contDiff_pi.mpr fun _=>contDiff_id) lemma polyJet_contDiff (m:ℕ)(f:E→ℂ):ContDiff ℝ ∞ (polyJet m f):=by exact ContDiff.sum (fun i _=>coeff_contDiff f i) lemma diff_contDiff {f:E→ℂ}(hf:ContDiff ℝ ∞ f) (s:ℝ) : ∀ m,ContDiff ℝ ∞ (diff s m f) | none=>hf | some m=>hf.sub ((cutoff_smooth s).smul (polyJet_contDiff m f)) lemma poly_integral {f:E→ℂ} (hs:ContDiff ℝ ∞ f) (m:ℕ) (y:E): f y= polyJet m f y + (↑m.factorial:ℝ)⁻¹ • ∫ t:ℝ in 0..1,(1-t)^m • iteratedFDeriv ℝ (m+1) f (t • y) (fun _=>y):=by simpa only [zero_add, coeff,polyJet] using (map_add_eq_sum_add_integral_iteratedFDeriv (x:=(0:E)) (n:=m) (y:=y) fun t _=> hs.contDiffAt.of_le (by norm_cast;exact le_top)) def JetBounds (m:ℕ) (f:E→ℂ) (A:ℝ) : Prop:= 0 ≤ A ∧ ∀ y:E,∀ i:ℕ,i≤m→ ‖iteratedFDeriv ℝ i f y‖ ≤ A theorem JetBounds.value {m:ℕ}{f:E→ℂ}{A:ℝ}(h:JetBounds m f A)(x:E):‖f x‖≤A:=by simpa only [norm_iteratedFDeriv_zero] using h.2 x 0 (Nat.zero_le _) theorem JetBounds.weaker {m k:ℕ}{f:E→ℂ}{A:ℝ}(h:JetBounds k f A)(hm:m ≤ k):JetBounds m f A:=⟨h.1,fun y i hi=> h.2 y i (hi.trans hm)⟩ theorem fact_mul_bound {x:ℂ}{n:ℕ}:‖(↑n.factorial:ℝ)⁻¹ • x‖≤‖x‖:=by rw [norm_smul]; refine mul_le_of_le_one_left (norm_nonneg _) ?_ rw [norm_inv,Real.norm_natCast]; exact inv_le_one_of_one_le₀ (by exact_mod_cast (Nat.one_le_iff_ne_zero.mpr (Nat.factorial_pos n|>.ne'))) lemma JetBounds.peak {m:ℕ}{f:E→ℂ}{B}(h:JetBounds m f B)(z y:E)(i:ℕ)(hi:i≤m):‖(iteratedFDeriv ℝ i f z) (fun _=>y)‖ ≤ B*‖y‖^i:= by refine ((iteratedFDeriv ℝ i f z).le_opNorm (fun _=>y)).trans ?_; simp only [Finset.prod_const,Finset.card_univ,Fintype.card_fin]; exact (mul_le_mul_of_nonneg_right (h.2 z i hi) (by positivity)) theorem poly_bound {f:E→ℂ}{A:ℝ}{m:ℕ} (hs:ContDiff ℝ ∞ f)(ha:JetBounds (m+1) f A) (y:E): ‖f y - polyJet m f y‖ ≤ A*‖y‖^(m+1):=by nth_rw 1 [poly_integral hs m y]; rw [add_sub_cancel_left]; apply fact_mul_bound.trans refine (intervalIntegral.norm_integral_le_of_norm_le_const (C:=A*‖y‖^(m+1)) ?_).trans (by norm_num) intro t ht have ht : t∈Set.Ioc 0 1:=by rwa [Set.uIoc_of_le zero_le_one] at ht apply le_trans ?_ (ha.peak (t•y) y (m+1) le_rfl) rw [norm_smul]; refine mul_le_of_le_one_left (norm_nonneg _) ?_ rw [norm_pow,Real.norm_eq_abs,abs_of_nonneg (by linarith [ht.2])]; exact pow_le_one₀ (by linarith [ht.2]) (by linarith [ht.1]) -- test with normalized Jacobian and arbitrary shrinking length r. def scaled [FiniteDimensional ℝ E](r:ℝ)(f:E→ℂ)(x:E):ℂ := (r^(Module.finrank ℝ E))⁻¹ • f (r⁻¹ • x) lemma scaled_jet [FiniteDimensional ℝ E]{f:E→ℂ}(hs:ContDiff ℝ ∞ f)(r:ℝ)(m:ℕ)(y:E): polyJet m (scaled r f) y=(r^(Module.finrank ℝ E))⁻¹ • polyJet m f (r⁻¹ • y):=by have he (i:ℕ):coeff i (scaled r f) y=(r^(Module.finrank ℝ E))⁻¹ • coeff i f (r⁻¹ • y):=by let L : E →L[ℝ] E := (r⁻¹:ℝ) • .id ℝ E let q := r^(Module.finrank ℝ E); unfold coeff change (↑i.factorial:ℝ)⁻¹ • (iteratedFDeriv ℝ i (q⁻¹ • (f ∘ (L:E→E))) 0 (fun _=>y))=_ rw [iteratedFDeriv_const_smul_apply, L.iteratedFDeriv_comp_right hs] · change (↑i.factorial:ℝ)⁻¹ • (q⁻¹ • iteratedFDeriv ℝ i f (L 0) (fun _=>L y))=_ rw [map_zero]; exact smul_comm .. · norm_cast; exact le_top · exact (hs.comp L.contDiff).contDiffAt.of_le (by norm_cast; exact le_top) unfold polyJet; simp only [he,Finset.smul_sum] lemma diff_scaled [FiniteDimensional ℝ E]{f:E→ℂ}(hs:ContDiff ℝ ∞ f) (r s:ℝ)(hr:0hh i (Finset.mem_range.mp hi))).trans ?_ simp) rw [min_eq_right (pow_le_pow_right₀ hg' (Nat.le_succ _))] refine (mul_le_mul_of_nonneg_left (a:=(r^Module.finrank ℝ E)⁻¹) (c:=A+‖polyJet m f (r⁻¹ • y)‖) ?_ (by positivity)).trans ?_ · apply (norm_sub_le ..).trans (add_le_add (ha.value _) ?_) rw [norm_smul]; exact mul_le_of_le_one_left (norm_nonneg _) (by rw [Real.norm_of_nonneg (cutoff_mem s y).1]; exact (cutoff_mem s y).2) have hp:g=‖y‖/r:=rfl; rw [hp] at *; exact (mul_le_mul_of_nonneg_left (by rw [add_mul]; rw [add_mul]; nlinarith only [hv,mul_nonneg (sub_nonneg.mpr (one_le_pow₀ hg' (n:=m))) ha.1,ha.1] : A+‖polyJet m f _‖ ≤ (m+2:ℝ)* A*(‖y‖/r)^m) (by positivity : 0≤(r^(Module.finrank ℝ E))⁻¹)).trans (by nlinarith only [show 0 ≤ (‖y‖/r)^m * A* (r^(Module.finrank ℝ E))⁻¹ by have h := ha.1; positivity] ) lemma diff_bound {s:ℝ}{f:E→ℂ}(hs:0 (@fact_mul_bound _ i).trans ((h.peak 0 y i (Nat.le_of_lt (Finset.mem_range.mp hi))).trans (mul_le_mul_of_nonneg_left (hu i (Nat.le_of_lt (Finset.mem_range.mp hi))) h.1)))) (by simp)) have hl: ‖polyJet m f y‖ ≥ ‖cutoff s y • polyJet m f y‖:=by rw [norm_smul]; exact mul_le_of_le_one_left (norm_nonneg _) (by rw [Real.norm_of_nonneg (cutoff_mem s y).1]; exact (cutoff_mem s y).2) refine (norm_sub_le ..).trans ((add_le_add ((h.value y).trans (le_trans ?_ (mul_le_mul_of_nonneg_left (hu 0 (by omega)) h.1))) hl).trans ?_) · simp change A * _ + _ ≤ (m+2:ℝ)*T*A*_; linarith only [hg] end YM.MultipleContact