import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationAction import PoincareLib.Geometry.RicciFlow.ReducedGeometry.LGeometry.Variation.VariationMetricPair /-! Adapted from Mapher `PoincareMT/Proofs/M08/FirstVariationIdentity.lean` at `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false noncomputable section open Set Filter Topology open scoped Manifold ContDiff Bundle universe u namespace PoincareMT.LGeometry variable {n : β„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓑 n) ∞ M] theorem curveVelocityWithin_eq_of_open_subset {I C : Set ℝ} (hI : IsOpen I) (hIC : I βŠ† C) (Ξ± : ℝ β†’ M) {s : ℝ} (hs : s ∈ I) : curveVelocityWithin (n := n) Ξ± I s = curveVelocityWithin (n := n) Ξ± C s := by unfold curveVelocityWithin rw [mfderivWithin_of_mem_nhds (hI.mem_nhds hs), mfderivWithin_of_mem_nhds (mem_of_superset (hI.mem_nhds hs) hIC)] def restrictInteriorVelocityExtension {I C : Set ℝ} (hI : IsOpen I) (hIC : I βŠ† C) (Ξ± : ℝ β†’ M) (E : ParametricAlongCurveExtensionOn C Ξ± (curveVelocityWithin (n := n) Ξ± C)) : ParametricAlongCurveExtensionOn I Ξ± (curveVelocityWithin (n := n) Ξ± I) where extension := E.extension domain := E.domain open_domain := E.open_domain graph_mem s hs := E.graph_mem s (hIC hs) smooth := E.smooth agrees s hs := (E.agrees s (hIC hs)).trans (curveVelocityWithin_eq_of_open_subset hI hIC Ξ± hs).symm theorem chartActionPotential_apply {J : Set ℝ} (F : RicciFlow n M J) (T : ℝ) {x y : M} (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) (s : ℝ) : chartActionPotential F T x (s, extChartAt (𝓑 n) x y) = 2 * s ^ 2 * (F.connection (T - s ^ 2)).scalarCurvature y := by have hy' : y ∈ (extChartAt (𝓑 n) x).source := by simpa only [extChartAt_source] using hy simp only [chartActionPotential, (extChartAt (𝓑 n) x).left_inv hy'] theorem regularizedLIntegrand_eq_chart {J : Set ℝ} (F : RicciFlow n M J) (T : ℝ) {Ξ± : ℝ β†’ M} {x : M} {s : ℝ} (hx : Ξ± s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) (hΞ± : MDifferentiableAt (π“˜(ℝ, ℝ)) (𝓑 n) Ξ± s) : regularizedLIntegrand F T Ξ± s = chartActionMetric F T x (s, extChartAt (𝓑 n) x (Ξ± s)) (deriv ((extChartAt (𝓑 n) x) ∘ Ξ±) s) (deriv ((extChartAt (𝓑 n) x) ∘ Ξ±) s) / 2 + chartActionPotential F T x (s, extChartAt (𝓑 n) x (Ξ± s)) := by rw [chartActionMetric_apply F T hx, chartActionPotential_apply F T hx, chartFrame_curveVelocity hx hΞ±] unfold regularizedLIntegrand ring set_option maxHeartbeats 2000000 in theorem firstVariation_density_identity {J : Set ℝ} {F : RicciFlow n M J} {T Ο„max τ₁ Ο„β‚‚ : ℝ} (hM04 : RicciFlowCurvatureTheory.{u}) (hwindow : Icc (T - Ο„max) T βŠ† J) (hΟ„β‚‚ : Ο„β‚‚ ≀ Ο„max) {p : BackwardTimePath F T τ₁ Ο„β‚‚} (V : LVariation F T τ₁ Ο„β‚‚ p) (D : LVariationDerivativeData V) {s : ℝ} (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt Ο„β‚‚)) : variationParameterDeriv (sqrtParameterInterval τ₁ Ο„β‚‚) V.parameterDomain (variationActionDensity V) (s, 0) = derivWithin (variationBoundaryPair V) (sqrtParameterInterval τ₁ Ο„β‚‚) s - regularizedEulerResidual F T V.baseSquareCurve (sqrtParameterInterval τ₁ Ο„β‚‚) D.velocity_extension s (squareVariationField V s) := by let C := sqrtParameterInterval τ₁ Ο„β‚‚ let I := Ioo (Real.sqrt τ₁) (Real.sqrt Ο„β‚‚) let Ξ± := V.baseSquareCurve let H := fun z : ℝ Γ— ℝ ↦ V.squareFamily z.1 z.2 let x := Ξ± s let e := extChartAt (𝓑 n) x let z := fun a : ℝ Γ— ℝ ↦ e (H a) let Ξ© := V.squareDomain ∩ H ⁻¹' (chartAt (EuclideanSpace ℝ (Fin n)) x).source let q := fun r ↦ deriv (fun t ↦ z (t, 0)) r let w := fun r ↦ deriv (fun u ↦ z (r, u)) 0 let qv := fun u ↦ deriv (fun r ↦ z (r, u)) s have hzero : (0 : ℝ) ∈ V.parameterDomain := ⟨neg_neg_of_pos V.radius_pos, V.radius_pos⟩ have hsC : s ∈ C := Ioo_subset_Icc_self hs have hΞ© : IsOpen Ξ© := V.square_smooth.continuousOn.isOpen_inter_preimage V.square_open (chartAt (EuclideanSpace ℝ (Fin n)) x).open_source have hsΞ© : (s, (0 : ℝ)) ∈ Ξ© := ⟨V.square_contains ⟨hsC, hzero⟩, mem_chart_source _ _⟩ have hH (a : ℝ Γ— ℝ) (ha : a ∈ Ξ©) : MDifferentiableAt ((π“˜(ℝ, ℝ)).prod (π“˜(ℝ, ℝ))) (𝓑 n) H a := ((V.square_smooth a ha.1).contMDiffAt (V.square_open.mem_nhds ha.1)).mdifferentiableAt (by simp) have hz : ContDiffOn ℝ ∞ z Ξ© := by have h := (contMDiffOn_extChartAt (I := 𝓑 n) (x := x)).comp (V.square_smooth.mono inter_subset_left) (fun a ha ↦ by simpa only [extChartAt_source] using ha.2) apply ContMDiffOn.contDiffOn rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] exact h obtain ⟨k, hqv, hw⟩ := coordinate_mixed_hasDerivAt hΞ© z hz hsΞ© have hzd : DifferentiableAt ℝ z (s, 0) := ((hz (s, 0) hsΞ©).contDiffAt (hΞ©.mem_nhds hsΞ©)).differentiableAt (by simp) have hzv : HasDerivAt (fun u ↦ z (s, u)) (w s) 0 := ((coordinateSlice_snd_hasDerivAt z hzd).differentiableAt).hasDerivAt have hΞ± : MDifferentiableAt (π“˜(ℝ, ℝ)) (𝓑 n) Ξ± s := (hH (s, 0) hsΞ©).comp s (mdifferentiableAt_id.prodMk mdifferentiableAt_const) have hx : Ξ± s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source := mem_chart_source _ _ have ht := backwardSquareTime_mem_interior hwindow p.nonnegative p.ordered hΟ„β‚‚ hs have hdom : (s, e (Ξ± s)) ∈ chartActionDomain F T x := by refine ⟨ht, e.map_source ?_⟩ simpa only [e, extChartAt_source] using hx have hG := hasFDerivAt_spatial (chartActionDomain_open F T x) _ (chartActionMetric_contDiffOn F T x) hdom have hV := hasFDerivAt_spatial (chartActionDomain_open F T x) _ (chartActionPotential_contDiffOn F hM04 T x) hdom have hsym (v v' : EuclideanSpace ℝ (Fin n)) : chartActionMetric F T x (s, z (s, 0)) v v' = chartActionMetric F T x (s, z (s, 0)) v' v := by change chartActionMetric F T x (s, extChartAt (𝓑 n) x (Ξ± s)) v v' = chartActionMetric F T x (s, extChartAt (𝓑 n) x (Ξ± s)) v' v rw [chartActionMetric_apply F T hx, chartActionMetric_apply F T hx] exact (F.metric (T - s ^ 2)).symm _ _ _ have hraw := chart_density_hasDerivAt (fun y ↦ chartActionMetric F T x (s, y)) (fun y ↦ chartActionPotential F T x (s, y)) _ _ hG hV hzv hqv hsym have hnearU : βˆ€αΆ  u in 𝓝 (0 : ℝ), (s, u) ∈ Ξ© := (continuous_const.prodMk continuous_id).continuousAt.preimage_mem_nhds (hΞ©.mem_nhds hsΞ©) have hraw' := hraw.congr_of_eventuallyEq (show (fun u ↦ variationActionDensity V (s, u)) =αΆ [𝓝 (0 : ℝ)] _ from by filter_upwards [hnearU] with u hu exact regularizedLIntegrand_eq_chart F T hu.2 ((hH (s, u) hu).comp s (mdifferentiableAt_id.prodMk mdifferentiableAt_const))) have hrawActual := hasDerivAt_variationParameter isOpen_Ioo (variationActionDensity V) (variationActionDensity_contDiffOn hM04 V) hsC hzero have hrawEq := hrawActual.unique hraw' change variationParameterDeriv C V.parameterDomain (variationActionDensity V) (s, 0) = _ at hrawEq let E := restrictInteriorVelocityExtension isOpen_Ioo Ioo_subset_Icc_self Ξ± D.velocity_extension have hB := parametricExtension_metric_pair_moving_graph F T isOpen_Ioo E hs hx hΞ± ht hw have hwfield (r : ℝ) (hr : (r, (0 : ℝ)) ∈ Ξ©) : chartFrame x (w r) (Ξ± r) = squareVariationField V r := chartFrame_curveVelocity hr.2 ((hH (r, 0) hr).comp 0 (mdifferentiableAt_const.prodMk mdifferentiableAt_id)) have hnearS : βˆ€αΆ  r in 𝓝 s, (r, (0 : ℝ)) ∈ Ξ© := (continuous_id.prodMk continuous_const).continuousAt.preimage_mem_nhds (hΞ©.mem_nhds hsΞ©) have hB' := hB.congr_of_eventuallyEq (show variationBoundaryPair V =αΆ [𝓝 s] _ from by filter_upwards [hnearS, isOpen_Ioo.mem_nhds hs] with r hr hrI rw [E.agrees r hrI, hwfield r hr, curveVelocityWithin_eq_of_open_subset isOpen_Ioo Ioo_subset_Icc_self Ξ± hrI] rfl) have hBDeriv := hB'.hasDerivWithinAt.derivWithin (uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) s hsC) have hR (W : TangentSpace (𝓑 n) (Ξ± s)) : regularizedEulerResidual F T Ξ± I E s W = regularizedEulerResidual F T Ξ± C D.velocity_extension s W := by unfold regularizedEulerResidual pullbackCovariantDerivative E restrictInteriorVelocityExtension rw [curveVelocityWithin_eq_of_open_subset isOpen_Ioo Ioo_subset_Icc_self Ξ± hs] rfl have hpot := chartActionPotential_spatial_apply F hM04 T hx ht (w s) change variationParameterDeriv C V.parameterDomain (variationActionDensity V) (s, 0) = derivWithin (variationBoundaryPair V) C s - regularizedEulerResidual F T Ξ± C D.velocity_extension s (squareVariationField V s) change derivWithin (variationBoundaryPair V) C s = _ at hBDeriv rw [hrawEq, hBDeriv, ← hR] unfold regularizedEulerResidual scalarCurvatureDifferential rw [← hwfield s hsΞ©, ← hpot] dsimp only [q, w, qv, Ξ±, z, H, e, I, LVariation.baseSquareCurve, Function.comp_def] ring end PoincareMT.LGeometry