import PoincareLib.Geometry.RicciFlow.Area.FixedMap.GramRank import PoincareLib.Geometry.Riemannian.MinimalSurface.Sphere.Analysis.Gram.DeterminantDerivative /-! # Pointwise fixed-map area variation Morgan-Tian Claim 18.13, printed p. 427, with the corrected factor in reviews/errata/2026-09-14-sphere-area.md. At an independent differential, the Ricci-flow equation differentiates the square-root Gram determinant. At a dependent differential the density is identically zero for all time. Both cases give minus the actual Ricci-trace density as within-time derivative. -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open scoped Manifold ContDiff Bundle BigOperators universe u namespace PoincareMT variable {n : โ„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace โ„ (Fin n)) M] [IsManifold (๐“ก n) โˆž M] /-- The exact variation of each sphere area density, including the rank-deficient locus and endpoints. Source: corrected MT Claim 18.13, p. 427. -/ theorem m60SphereDensity_variation {J : Set โ„} (F : RicciFlow n M J) (f : UnitTwoSphere โ†’ M) (z : LoopPlane) {t : โ„} (ht : t โˆˆ J) : HasDerivWithinAt (fun s => m60SphereAreaDensity (F.metric s) f z) (-m60SphereRicciTraceDensity (F.connection t) f z) J t := by by_cases hdeg : Matrix.det (m60AreaGram (F.metric t) (f โˆ˜ m60SphereParameter) z) = 0 ยท exact m60SphereDensity_variation_of_degenerate F f z t hdeg let G := fun s => m60AreaGram (F.metric s) (f โˆ˜ m60SphereParameter) z let e := fun i : Fin 2 => mfderiv (๐“ก 2) (๐“ก n) (f โˆ˜ m60SphereParameter) z (EuclideanSpace.basisFun (Fin 2) โ„ i) let R : Matrix (Fin 2) (Fin 2) โ„ := fun i j => (F.connection t).ricci ((f โˆ˜ m60SphereParameter) z) (e i) (e j) have hG : โˆ€ i j, HasDerivWithinAt (fun s => G s i j) (-2 * R i j) J t := fun i j => F.equation t ht ((f โˆ˜ m60SphereParameter) z) (e i) (e j) have hnonneg (s : โ„) : 0 โ‰ค Matrix.det (G s) := m60AreaGram_det_nonneg (F.metric s) (f โˆ˜ m60SphereParameter) z have hpos : 0 < Matrix.det (G t) := lt_of_le_of_ne (hnonneg t) (Ne.symm hdeg) have hd := M60.hasDerivWithinAt_sqrt_det_fin_two hG hpos have harea : (fun s => Real.sqrt (Matrix.det (G s))) = fun s => m60SphereAreaDensity (F.metric s) f z := by funext s exact congrArg Real.sqrt (max_eq_right (hnonneg s)).symm rw [harea] at hd convert hd using 1 unfold m60SphereRicciTraceDensity rw [if_neg hdeg] unfold m60AreaDensity rw [max_eq_right (hnonneg t)] simp only [Fin.sum_univ_two] dsimp only [G, R, e] ring end PoincareMT