import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Modulus.EnergyDensity import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.Analysis.Coordinates.EnergyVariation /-! # Actual coordinate variation at arbitrary fixed modulus The genuine weighted Gram density differentiates to the correspondingly weighted covariant pairing. The calculation works at rank zero and does not replace the modulus by one. Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. 447-449. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Set Filter open scoped Manifold ContDiff Topology universe u namespace PoincareMT open CoordinateExponential ConnectionVariation ConjugateVariation variable {n : β„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓑 n) ∞ M] /-- The true pointwise derivative of an affine supported target-chart variation, for the actual modulus-weighted energy density. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project derivation `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ theorem m64ModulusEnergyDensity_hasDerivAt_of_affine_chart (g : RiemannianMetric n M) (r : ℝ) (b : M) (f : LoopPlane β†’ M) {U : Set LoopPlane} (hU : IsOpen U) (hf : ContMDiffOn (𝓑 2) (𝓑 n) ∞ f U) (hfU : MapsTo f U (extChartAt (𝓑 n) b).source) (V : LoopPlane β†’ EuclideanSpace ℝ (Fin n)) (hV : ContDiff ℝ ∞ V) {v : ℝ Γ— LoopPlane β†’ M} {epsilon : ℝ} (hepsilon : 0 < epsilon) (hv : ContMDiffOn π“˜(ℝ, ℝ Γ— LoopPlane) (𝓑 n) ∞ v (Ioo (-epsilon) epsilon Γ—Λ’ U)) (hcoord : βˆ€ s ∈ Ioo (-epsilon) epsilon, βˆ€ z ∈ U, v (s, z) ∈ (extChartAt (𝓑 n) b).source ∧ extChartAt (𝓑 n) b (v (s, z)) = extChartAt (𝓑 n) b (f z) + s β€’ V z) (z : LoopPlane) (hz : z ∈ U) : let u := (extChartAt (𝓑 n) b) ∘ f let B := g.pullbackCoefficients (extChartAt (𝓑 n) b).symm let e := EuclideanSpace.basisFun (Fin 2) ℝ HasDerivAt (fun s => m64ModulusEnergyDensity g r (fun p => v (s, p)) z) (r * B (u z) (covDerivAlong (christoffelBilinear B) u V (e 0) z) (fderiv ℝ u z (e 0)) + r⁻¹ * B (u z) (covDerivAlong (christoffelBilinear B) u V (e 1) z) (fderiv ℝ u z (e 1))) 0 := by let c := extChartAt (𝓑 n) b let u := c ∘ f let B := g.pullbackCoefficients c.symm let e := EuclideanSpace.basisFun (Fin 2) ℝ have hu : ContDiffAt ℝ ∞ u z := contMDiffAt_iff_contDiffAt.mp ((contMDiffAt_extChartAt' (n := ∞) (by simpa only [extChartAt_source] using hfU hz)).comp z (hf.contMDiffAt (hU.mem_nhds hz))) have hB : DifferentiableAt ℝ B (u z) := ((g.contDiffOn_chartCoefficients b).contDiffAt ((isOpen_extChartAt_target b).mem_nhds (c.map_source (hfU hz)))).differentiableAt (by simp) have hterm (i : Fin 2) := M60.hasDerivAt_affine_coordinate_energy (u := u) (V := V) z (e i) hB (isMetricCompatibleAt_chartCoefficients g b (c.map_source (hfU hz))) (fun _ _ => g.symm _ _ _) (christoffelBilinear_chart_symm g b (u z)) apply (((hterm 0).const_mul r).add ((hterm 1).const_mul r⁻¹)).congr_of_eventuallyEq filter_upwards [isOpen_Ioo.mem_nhds (show (0 : ℝ) ∈ Ioo (-epsilon) epsilon from ⟨by linarith, hepsilon⟩)] with s hs have hvPlane : ContMDiffAt (𝓑 2) (𝓑 n) ∞ (fun p => v (s, p)) z := (hv.contMDiffAt ((isOpen_Ioo.prod hU).mem_nhds ⟨hs, hz⟩)).comp z (contDiff_const.prodMk contDiff_id).contMDiff.contMDiffAt have heq : (fun p => c (v (s, p))) =αΆ [𝓝 z] (fun p => u p + s β€’ V p) := by filter_upwards [hU.mem_nhds hz] with p hp exact (hcoord s hs p hp).2 have hd : HasFDerivAt (fun p => u p + s β€’ V p) (fderiv ℝ u z + s β€’ fderiv ℝ V z) z := (hu.differentiableAt (by simp)).hasFDerivAt.add ((hV.differentiable (by simp) z).hasFDerivAt.const_smul s) unfold m64ModulusEnergyDensity rw [m64AreaGram_eq_chart g b (hvPlane.mdifferentiableAt (by simp)) (hcoord s hs z hz).1 0 0, m64AreaGram_eq_chart g b (hvPlane.mdifferentiableAt (by simp)) (hcoord s hs z hz).1 1 1] dsimp only [Function.comp_def] rw [heq.fderiv_eq, hd.fderiv, (hcoord s hs z hz).2] simp only [add_apply, smul_apply, u, B, e, c, Pi.add_apply, Function.comp_apply] ring end PoincareMT