import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.SmoothSquarePath import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.LocalSmoothPrimitive /-! # Smooth actions of local square-time comparison families Compactness keeps nearby integration segments in the genuine smooth domain. The resulting primitive equals the frozen action on a neighborhood. -/ set_option autoImplicit false set_option maxSynthPendingDepth 3 open scoped Manifold ContDiff Bundle Topology intervalIntegral open Filter universe u namespace PoincareMT.ReducedLength variable {n : β„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓑 n) ∞ M] {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] theorem contDiffAt_smoothSquareFamily_action {J : Set ℝ} (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) (T Ο„max : ℝ) (hΟ„max : 0 < Ο„max) (hwindow : Set.Icc (T - Ο„max) T βŠ† J) (f : E Γ— ℝ β†’ M) (U : Set (E Γ— ℝ)) (hU : IsOpen U) (hf : ContMDiffOn (π“˜(ℝ, E Γ— ℝ)) (𝓑 n) ∞ f U) (z0 : E Γ— ℝ) (hz0 : z0.2 ∈ Set.Ioo 0 Ο„max) (hsegment : βˆ€ r ∈ Set.Icc (0 : ℝ) 1, (z0.1, Real.sqrt z0.2 * r) ∈ U) : ContDiffAt ℝ ∞ (fun z : E Γ— ℝ ↦ backwardLLength F T 0 z.2 (fun Ο„ ↦ f (z.1, Real.sqrt Ο„))) z0 := by let W := U ∩ (Set.univ Γ—Λ’ Set.Ioo (-Real.sqrt Ο„max) (Real.sqrt Ο„max)) let H := squareFamilyActionDensity F T f have hW : IsOpen W := hU.inter (isOpen_univ.prod isOpen_Ioo) have hH : ContDiffOn ℝ ∞ H W := squareFamilyActionDensity_contDiffOn F hM04 T Ο„max hΟ„max hwindow f W hW (hf.mono Set.inter_subset_left) (fun z hz ↦ hz.2.2) have hseg : βˆ€ r ∈ Set.Icc (0 : ℝ) 1, (z0.1, Real.sqrt z0.2 * r) ∈ W := by intro r hr have h0 : 0 ≀ Real.sqrt z0.2 * r := mul_nonneg (Real.sqrt_nonneg _) hr.1 have hlt : Real.sqrt z0.2 * r < Real.sqrt Ο„max := (mul_le_of_le_one_right (Real.sqrt_nonneg _) hr.2).trans_lt (Real.sqrt_lt_sqrt hz0.1.le hz0.2) exact ⟨hsegment r hr, Set.mem_univ _, (neg_lt_zero.mpr (Real.sqrt_pos.mpr hΟ„max)).trans_le h0, hlt⟩ have hnear : βˆ€αΆ  z : E Γ— ℝ in 𝓝 z0, βˆ€ r ∈ Set.Icc (0 : ℝ) 1, (z.1, Real.sqrt z.2 * r) ∈ W := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro r hr have hc : Continuous (fun w : (E Γ— ℝ) Γ— ℝ ↦ (w.1.1, Real.sqrt w.1.2 * w.2)) := continuous_fst.fst.prodMk ((Real.continuous_sqrt.comp continuous_fst.snd).mul continuous_snd) exact hc.continuousAt.preimage_mem_nhds (hW.mem_nhds (hseg r hr)) have heq : (fun z : E Γ— ℝ ↦ backwardLLength F T 0 z.2 (fun Ο„ ↦ f (z.1, Real.sqrt Ο„))) =αΆ [𝓝 z0] (fun z : E Γ— ℝ ↦ ∫ s in 0..Real.sqrt z.2, H (z.1, s)) := by filter_upwards [hnear, (isOpen_univ.prod isOpen_Ioo).mem_nhds (show z0 ∈ Set.univ Γ—Λ’ Set.Ioo 0 Ο„max from ⟨Set.mem_univ _, hz0⟩)] with z hsegz hz apply backwardLLength_comp_sqrt_eq F T z.2 hz.2.1 (fun s ↦ f (z.1, s)) intro s hs have hpos : 0 < Real.sqrt z.2 := Real.sqrt_pos.mpr hz.2.1 have hr : s / Real.sqrt z.2 ∈ Set.Icc (0 : ℝ) 1 := ⟨div_nonneg hs.1.le hpos.le, (div_le_one hpos).mpr hs.2.le⟩ have hmem : (z.1, s) ∈ U := by have hm := (hsegz (s / Real.sqrt z.2) hr).1 simpa only [mul_div_cancelβ‚€ s hpos.ne'] using hm have hi : ContMDiff (π“˜(ℝ, ℝ)) (π“˜(ℝ, E Γ— ℝ)) ∞ (fun r : ℝ ↦ (z.1, r)) := (contDiff_const.prodMk contDiff_id).contMDiff exact ((hf.contMDiffAt (hU.mem_nhds hmem)).comp s hi.contMDiffAt).mdifferentiableAt (by simp) have hp : ContDiffAt ℝ ∞ (fun z : E Γ— ℝ ↦ ∫ s in 0..z.2, H (z.1, s)) (z0.1, Real.sqrt z0.2) := contDiffAt_parameter_primitive H W hW hH (z0.1, Real.sqrt z0.2) hseg have hsqrt : ContDiffAt ℝ ∞ (fun z : E Γ— ℝ ↦ (z.1, Real.sqrt z.2)) z0 := contDiffAt_fst.prodMk (contDiffAt_snd.sqrt hz0.1.ne') have hsmooth : ContDiffAt ℝ ∞ (fun z : E Γ— ℝ ↦ ∫ s in 0..Real.sqrt z.2, H (z.1, s)) z0 := ContDiffAt.comp (g := fun z : E Γ— ℝ ↦ ∫ s in 0..z.2, H (z.1, s)) z0 hp hsqrt exact hsmooth.congr_of_eventuallyEq heq end PoincareMT.ReducedLength