import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Unit.SpeedInitialPeriod import Mathlib.Analysis.Calculus.ContDiff.Deriv /-! # Smooth initial arclength on the actual physical period The actual speed primitive and its positive derivative upgrade the existing C2 arclength homeomorphism for smooth initial curves. MT2007 Claim 19.1, p. 437 and Lemma 19.6, pp. 441-442; `2026-09-22-smooth-unit-speed-initial-parameter.md`. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Set open scoped Manifold ContDiff Bundle universe u namespace PoincareMT.M63 variable {n : β„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓑 n) ∞ M] {a b : ℝ} /-- A smooth immersed spatial slice has smooth actual speed for each selected metric, without a time equation. MT2007 Lemma 19.6, p. 441; smooth initial unit-speed parameter derivation, statement 1. -/ theorem speed_contDiff_of_smooth (F : RicciFlow n M (Icc a b)) (q : ℝ β†’ ℝ β†’ M) {t : ℝ} (hspace : ContMDiff π“˜(ℝ, ℝ) (𝓑 n) ∞ (fun x => q x t)) (himm : βˆ€ x, curveVelocity (n := n) (fun y => q y t) x β‰  0) : ContDiff ℝ ∞ (curveSpeed F q t) := by have hone : ContMDiff π“˜(ℝ, ℝ) (π“˜(ℝ, ℝ)).tangent ∞ (fun x : ℝ => (⟨x, 1⟩ : TangentBundle π“˜(ℝ, ℝ) ℝ)) := by apply contMDiff_vectorSpace_iff_contDiff.mpr exact contDiff_const have hX : ContMDiff π“˜(ℝ, ℝ) ((𝓑 n).prod (𝓑 n)) ∞ (fun x => (⟨q x t, curveVelocity (n := n) (fun y => q y t) x⟩ : TangentBundle (𝓑 n) M)) := (hspace.contMDiff_tangentMap (m := ∞) (by simp)).comp hone have hpair : ContMDiff π“˜(ℝ, ℝ) ((𝓑 n).prod π“˜(ℝ, ℝ)) ∞ (fun x => Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) (q x t) ((F.metric t).inner (q x t) (curveVelocity (fun y => q y t) x) (curveVelocity (fun y => q y t) x))) := ((F.metric t).contMDiff.comp hspace).clm_bundle_applyβ‚‚ hX hX have hsq : ContMDiff π“˜(ℝ, ℝ) π“˜(ℝ, ℝ) ∞ (fun x => (F.metric t).inner (q x t) (curveVelocity (fun y => q y t) x) (curveVelocity (fun y => q y t) x)) := by intro x exact (Bundle.contMDiffAt_totalSpace.mp (hpair x)).2 exact hsq.contDiff.sqrt fun x => ((F.metric t).pos _ _ (himm x)).ne' /-- Smooth initial data upgrade the same actual arclength witness and its inverse to smooth maps, preserving every physical period and unit-speed identity. MT2007 Claim 19.1, p. 437 and Lemma 19.6, pp. 441-442; smooth initial unit-speed parameter, statement 2. -/ theorem exists_smooth_unit_speed_parameter (F : RicciFlow n M (Icc a b)) (gamma : ℝ β†’ M) (t : ℝ) (hperiod : Function.Periodic gamma curvePeriod) (hgamma : ContMDiff π“˜(ℝ, ℝ) (𝓑 n) ∞ gamma) (himm : βˆ€ x, curveVelocity (n := n) gamma x β‰  0) : let v := curveSpeed F (fun x _ => gamma x) t let ell := ∫ x in (0 : ℝ)..curvePeriod, v x 0 < ell ∧ βˆƒ sigma : ℝ β‰ƒβ‚œ ℝ, (βˆ€ x, sigma x = ∫ y in (0 : ℝ)..x, v y) ∧ ContDiff ℝ ∞ (sigma : ℝ β†’ ℝ) ∧ ContDiff ℝ ∞ (sigma.symm : ℝ β†’ ℝ) ∧ sigma 0 = 0 ∧ (βˆ€ x, 0 < deriv sigma x) ∧ (βˆ€ y, 0 < deriv sigma.symm y) ∧ (βˆ€ x, sigma (x + curvePeriod) = sigma x + ell) ∧ (βˆ€ y, sigma.symm (y + ell) = sigma.symm y + curvePeriod) ∧ Function.Periodic (fun y => gamma (sigma.symm y)) ell ∧ ContMDiff π“˜(ℝ, ℝ) (𝓑 n) ∞ (fun y => gamma (sigma.symm y)) ∧ (βˆ€ y, curveVelocity (n := n) (fun z => gamma (sigma.symm z)) y β‰  0) ∧ (βˆ€ y, curveSpeed F (fun z _ => gamma (sigma.symm z)) t y = 1) ∧ (βˆ€ y, (curveSpeed F (fun z _ => gamma (sigma.symm z)) t y ^ 2)⁻¹ = 1) ∧ βˆ€ x, gamma (sigma.symm (sigma x)) = gamma x := by let v := curveSpeed F (fun x _ => gamma x) t obtain ⟨hell, sigma, hformula, hsigma, _hinv, hzero, hpos, hinvpos, hshift, hinvshift, hper, _hreg, himm', hunit, hprincipal, hrecovery⟩ := exists_c2_unit_speed_parameter F gamma t hperiod (hgamma.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)) himm have hv : ContDiff ℝ ∞ v := speed_contDiff_of_smooth F (fun x _ => gamma x) hgamma himm have hd (x : ℝ) : HasDerivAt sigma (v x) x := by have hprimitive : (sigma : ℝ β†’ ℝ) = fun x => ∫ y in (0 : ℝ)..x, v y := funext hformula rw [hprimitive] exact intervalIntegral.integral_hasDerivAt_right (hv.continuous.intervalIntegrable 0 x) (hv.continuous.stronglyMeasurableAtFilter _ _) hv.continuous.continuousAt have hderiv : deriv sigma = v := funext fun x => (hd x).deriv have hsmooth : ContDiff ℝ ∞ (sigma : ℝ β†’ ℝ) := contDiff_infty_iff_deriv.mpr ⟨hsigma.differentiable (by norm_num), hderiv β–Έ hv⟩ have hinvsmooth : ContDiff ℝ ∞ (sigma.symm : ℝ β†’ ℝ) := sigma.contDiff_symm_deriv (fun x => by simpa only [← hderiv] using (hpos x).ne') hd hsmooth exact ⟨hell, sigma, hformula, hsmooth, hinvsmooth, hzero, hpos, hinvpos, hshift, hinvshift, hper, hgamma.comp hinvsmooth.contMDiff, himm', hunit, hprincipal, hrecovery⟩ end PoincareMT.M63