import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationDerivativeData import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationIntegral import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationPaths import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Path.RegularizedAction import PoincareLib.Geometry.RicciFlow.Curvature.Theory /-! Adapted from Mapher `PoincareMT/Proofs/M08/VariationAction.lean` at `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false noncomputable section open Set Filter Topology MeasureTheory open scoped Manifold ContDiff Bundle intervalIntegral universe u v namespace PoincareMT.LGeometry variable {n : β„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓑 n) ∞ M] local instance variationActionDualGroup : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) β†’L[ℝ] ℝ) := ContinuousLinearMap.toNormedAddCommGroup local instance variationActionDualSpace : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) β†’L[ℝ] ℝ) := ContinuousLinearMap.toNormedSpace local instance variationActionBilinGroup : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] ℝ) := ContinuousLinearMap.toNormedAddCommGroup local instance variationActionBilinSpace : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] ℝ) := ContinuousLinearMap.toNormedSpace set_option maxHeartbeats 800000 in theorem movingMetric_pair_contMDiffOn {X : Type v} [NormedAddCommGroup X] [NormedSpace ℝ X] {S : Set X} {J : Set ℝ} (F : RicciFlow n M J) (time : X β†’ ℝ) (Ξ± : X β†’ M) (V W : βˆ€ z, TangentSpace (𝓑 n) (Ξ± z)) (htime : ContMDiffOn (π“˜(ℝ, X)) (π“˜(ℝ, ℝ)) ∞ time S) (hΞ± : ContMDiffOn (π“˜(ℝ, X)) (𝓑 n) ∞ Ξ± S) (hV : ContMDiffOn (π“˜(ℝ, X)) ((𝓑 n).prod (𝓑 n)) ∞ (fun z ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (Ξ± z) (V z)) S) (hW : ContMDiffOn (π“˜(ℝ, X)) ((𝓑 n).prod (𝓑 n)) ∞ (fun z ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (Ξ± z) (W z)) S) (hmem : MapsTo time S J) : ContMDiffOn (π“˜(ℝ, X)) (π“˜(ℝ, ℝ)) ∞ (fun z ↦ (F.metric (time z)).inner (Ξ± z) (V z) (W z)) S := by have hmetric := F.smooth.comp (htime.prodMk hΞ±) (fun z hz ↦ ⟨hmem hz, mem_univ _⟩) have hp := hmetric.clm_bundle_applyβ‚‚ (F₃ := ℝ) (E₃ := Bundle.Trivial M ℝ) hV hW intro z hz simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] using (Bundle.contMDiffWithinAt_totalSpace.mp (hp z hz)).2 def variationSliceSqrtRegular {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) {u : ℝ} (hu : u ∈ V.parameterDomain) : SqrtRegularPath (variationPath V hu) where curve := fun s ↦ V.squareFamily s u domain := (fun s : ℝ ↦ (s, u)) ⁻¹' V.squareDomain open_domain := V.square_open.preimage (continuous_id.prodMk continuous_const) interval_subset := fun s hs ↦ V.square_contains ⟨hs, hu⟩ smooth := V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun s hs ↦ hs) agrees := fun s hs ↦ V.square_agrees s hs u hu def variationActionDensity {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) (z : ℝ Γ— ℝ) : ℝ := regularizedLIntegrand F T (fun s ↦ V.squareFamily s z.2) z.1 theorem variationLLength_eq_squareAction {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) {u : ℝ} (hu : u ∈ V.parameterDomain) : variationLLength V u = ∫ s in Real.sqrt τ₁..Real.sqrt Ο„β‚‚, variationActionDensity V (s, u) := (regularizedLAction_eq_backwardLLength (variationSliceSqrtRegular V hu)).symm set_option maxHeartbeats 1000000 in theorem variationActionDensity_contDiffOn {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) : ContDiffOn ℝ ∞ (variationActionDensity V) (sqrtParameterInterval τ₁ Ο„β‚‚ Γ—Λ’ V.parameterDomain) := by let S := sqrtParameterInterval τ₁ Ο„β‚‚ Γ—Λ’ V.parameterDomain let H := fun z : ℝ Γ— ℝ ↦ V.squareFamily z.1 z.2 have hH : ContMDiffOn (π“˜(ℝ, ℝ Γ— ℝ)) (𝓑 n) ∞ H S := by rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] exact V.square_smooth.mono V.square_contains have hA : ContMDiffOn (π“˜(ℝ, ℝ Γ— ℝ)) ((𝓑 n).prod (𝓑 n)) ∞ (fun z : ℝ Γ— ℝ ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (H z) (curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1)) S := by rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] exact (contMDiffOn_curveVelocity_fst V.square_open H V.square_smooth).mono V.square_contains have ht : ContMDiffOn (π“˜(ℝ, ℝ Γ— ℝ)) (π“˜(ℝ, ℝ)) ∞ (fun z : ℝ Γ— ℝ ↦ T - z.1 ^ 2) S := (contDiff_const.sub (contDiff_fst.pow 2)).contMDiff.contMDiffOn have hmem : MapsTo (fun z : ℝ Γ— ℝ ↦ T - z.1 ^ 2) S J := by intro z hz apply p.time_mem have hz0 : 0 ≀ z.1 := (Real.sqrt_nonneg τ₁).trans hz.1.1 constructor Β· nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hz.1.1] Β· nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg Ο„β‚‚, hz.1.2] have hg := (movingMetric_pair_contMDiffOn F (fun z : ℝ Γ— ℝ ↦ T - z.1 ^ 2) H (fun z ↦ curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1) (fun z ↦ curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1) ht hH hA hA hmem).contDiffOn have hR := ((hM04.scalar_regular n M J F).comp (ht.prodMk hH) (fun z hz ↦ ⟨hmem hz, mem_univ _⟩)).contDiffOn exact ((contDiffOn_const.mul (contDiffOn_fst.pow 2)).mul hR).add (contDiffOn_const.mul hg) theorem hasDerivAt_variationLLength_integral {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) {u : ℝ} (hu : u ∈ V.parameterDomain) : HasDerivAt (variationLLength V) (∫ s in Real.sqrt τ₁..Real.sqrt Ο„β‚‚, variationParameterDeriv (sqrtParameterInterval τ₁ Ο„β‚‚) V.parameterDomain (variationActionDensity V) (s, u)) u := by have h := hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.nonnegative p.ordered) isOpen_Ioo (variationActionDensity V) (variationActionDensity_contDiffOn hM04 V) hu apply h.congr_of_eventuallyEq filter_upwards [isOpen_Ioo.mem_nhds hu] with v hv exact variationLLength_eq_squareAction V hv theorem hasDerivAt_deriv_variationLLength_integral {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) {u : ℝ} (hu : u ∈ V.parameterDomain) : HasDerivAt (fun v ↦ deriv (variationLLength V) v) (∫ s in Real.sqrt τ₁..Real.sqrt Ο„β‚‚, variationParameterDeriv (sqrtParameterInterval τ₁ Ο„β‚‚) V.parameterDomain (variationParameterDeriv (sqrtParameterInterval τ₁ Ο„β‚‚) V.parameterDomain (variationActionDensity V)) (s, u)) u := by have hC : UniqueDiffOn ℝ (sqrtParameterInterval τ₁ Ο„β‚‚) := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) have hd := hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.nonnegative p.ordered) isOpen_Ioo (variationParameterDeriv (sqrtParameterInterval τ₁ Ο„β‚‚) V.parameterDomain (variationActionDensity V)) (variationParameterDeriv_contDiffOn hC isOpen_Ioo _ (variationActionDensity_contDiffOn hM04 V)) hu apply hd.congr_of_eventuallyEq filter_upwards [isOpen_Ioo.mem_nhds hu] with v hv exact (hasDerivAt_variationLLength_integral hM04 V hv).deriv def variationBoundaryPair {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) (s : ℝ) : ℝ := (F.metric (T - s ^ 2)).inner (V.baseSquareCurve s) (curveVelocityWithin (n := n) V.baseSquareCurve (sqrtParameterInterval τ₁ Ο„β‚‚) s) (squareVariationField V s) set_option maxHeartbeats 1000000 in theorem variationBoundaryPair_contDiffOn {J : Set ℝ} {F : RicciFlow n M J} {T τ₁ Ο„β‚‚ : ℝ} {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) : ContDiffOn ℝ ∞ (variationBoundaryPair V) (sqrtParameterInterval τ₁ Ο„β‚‚) := by let C := sqrtParameterInterval τ₁ Ο„β‚‚ let U := (fun s : ℝ ↦ (s, (0 : ℝ))) ⁻¹' V.squareDomain have hU : IsOpen U := V.square_open.preimage (continuous_id.prodMk continuous_const) have hCU : C βŠ† U := fun s hs ↦ V.square_contains ⟨hs, neg_neg_of_pos V.radius_pos, V.radius_pos⟩ have hC : UniqueDiffOn ℝ C := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) have hΞ± : ContMDiffOn (π“˜(ℝ, ℝ)) (𝓑 n) ∞ V.baseSquareCurve U := V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun s hs ↦ hs) have hA : ContMDiffOn (π“˜(ℝ, ℝ)) ((𝓑 n).prod (𝓑 n)) ∞ (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) (curveVelocityWithin (n := n) V.baseSquareCurve C s)) C := by apply ((contMDiffOn_mfderiv_const_apply hU V.baseSquareCurve hΞ± (1 : ℝ)).mono hCU).congr intro s hs apply congrArg (fun w : TangentSpace (𝓑 n) (V.baseSquareCurve s) ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) w) unfold curveVelocityWithin rw [mfderivWithin_eq_mfderiv (hC.uniqueMDiffOn s hs) (((hΞ± s (hCU hs)).contMDiffAt (hU.mem_nhds (hCU hs))).mdifferentiableAt (by simp))] have ht : ContMDiffOn (π“˜(ℝ, ℝ)) (π“˜(ℝ, ℝ)) ∞ (fun s : ℝ ↦ T - s ^ 2) C := (contDiff_const.sub (contDiff_id.pow 2)).contMDiff.contMDiffOn have hmem : MapsTo (fun s : ℝ ↦ T - s ^ 2) C J := by intro s hs apply p.time_mem have hs0 : 0 ≀ s := (Real.sqrt_nonneg τ₁).trans hs.1 constructor Β· nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hs.1] Β· nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg Ο„β‚‚, hs.2] exact (movingMetric_pair_contMDiffOn F (fun s : ℝ ↦ T - s ^ 2) V.baseSquareCurve (curveVelocityWithin (n := n) V.baseSquareCurve C) (squareVariationField V) ht (hΞ±.mono hCU) hA ((squareVariationField_contMDiffOn V).mono hCU) hmem).contDiffOn end PoincareMT.LGeometry