import Mathlib import OAI.Geometry.CubicTorus.Curvature.TorusC2CMCAt namespace OAI section section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma normalGraph_metric {n : Cover} (hn : ‖n‖=1) {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (y v w : Plane) : ⟪fderiv ℝ (normalGraph n g) y v,fderiv ℝ (normalGraph n g) y w⟫= ⟪v,w⟫+⟪gradient g y,v⟫*⟪gradient g y,w⟫ := by rw [normalGraph_fderiv_apply hg,normalGraph_fderiv_apply hg] simp only [inner_add_left,inner_add_right,real_inner_smul_left,real_inner_smul_right, normalPlaneEmbedding_inner hn,real_inner_self_eq_norm_sq,hn,one_pow,mul_zero,add_zero] have ho : ⟪normalPlaneEmbedding n v,n⟫=0 := by rw [real_inner_comm]; exact normalPlaneEmbedding_inner hn v have hi := (normalPlaneLinearIsometry n).inner_map_map v w change ⟪normalPlaneEmbedding n v,normalPlaneEmbedding n w⟫=⟪v,w⟫ at hi simp only [hi,ho,mul_zero,zero_add,mul_one] ring end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma normalGraph_projection_differential {n : Cover} (hn : ‖n‖=1) {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (y : Plane) : (normalPlaneCoordinates n).comp (fderiv ℝ (normalGraph n g) y)= ContinuousLinearMap.id ℝ Plane := by apply ContinuousLinearMap.ext intro v rw [ContinuousLinearMap.comp_apply,normalGraph_fderiv_apply hg,map_add,map_smul, normalPlaneCoordinates_embedding,normalPlaneCoordinates_normal hn,smul_zero,add_zero] rfl lemma graphUnitNormalExtension_fderiv (a : Cover) {n : Cover} (hn : ‖n‖=1) {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (x : Cover) : fderiv ℝ (graphUnitNormalExtension a n g) x= -((fderiv ℝ (normalGraph n g) (normalPlaneCoordinates n (x-a))).comp ((graphShapeOperator g (normalPlaneCoordinates n (x-a))).comp (normalPlaneCoordinates n))) := by have hN : Differentiable ℝ (fun y ↦ graphSlopeNormal n (gradient g y)) := ((graphSlopeNormal_contDiff hn).comp (plane_gradient_contDiff hg)).differentiable (by simp) have hp := (normalPlaneCoordinates n).hasFDerivAt.comp x ((hasFDerivAt_id x).sub_const a) have hd := ((hN _).hasFDerivAt.comp x hp).fderiv change fderiv ℝ (graphUnitNormalExtension a n g) x=_ at hd rw [hd] apply ContinuousLinearMap.ext intro v simp only [ContinuousLinearMap.comp_apply,ContinuousLinearMap.id_apply,neg_apply] exact graph_weingarten hn hg _ _ theorem graphUnitNormalExtension_curvature (a : Cover) {n : Cover} (hn : ‖n‖=1) {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (x : Cover) : coverTrace ((fderiv ℝ (graphUnitNormalExtension a n g) x).comp (fderiv ℝ (graphUnitNormalExtension a n g) x))= graphSquaredSecondFundamentalForm g (normalPlaneCoordinates n (x-a)) := by let y := normalPlaneCoordinates n (x-a) let J := fderiv ℝ (normalGraph n g) y let S := graphShapeOperator g y let P := normalPlaneCoordinates n have hPJ : P.comp J=ContinuousLinearMap.id ℝ Plane := normalGraph_projection_differential hn hg y rw [graphUnitNormalExtension_fderiv a hn hg] change coverTrace ((-(J.comp (S.comp P))).comp (-(J.comp (S.comp P))))=planeTraceSquare S have he : ((-(J.comp (S.comp P))).comp (-(J.comp (S.comp P))))= J.comp ((S.comp S).comp P) := by apply ContinuousLinearMap.ext intro v have h := congrArg (fun L : Plane →L[ℝ] Plane ↦ L (S (P v))) hPJ simp only [ContinuousLinearMap.comp_apply,neg_apply,map_neg,neg_neg, ContinuousLinearMap.id_apply] at h ⊢ rw [h] rw [he,rectangular_trace,ContinuousLinearMap.comp_assoc,hPJ, ContinuousLinearMap.comp_id,planeTrace_square] end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma planeDivergence_eq_trace (F : Plane → Plane) (y : Plane) : planeDivergence F y=planeTrace (fderiv ℝ F y) := by simp only [planeDivergence,planeTrace,Fin.sum_univ_two] lemma cmcFlux_gradient_fderiv {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (y : Plane) : fderiv ℝ (fun z ↦ cmcFlux (gradient g z)) y=graphShapeOperator g y := by exact ((cmcFlux_hasFDerivAt (gradient g y)).comp y (((plane_gradient_contDiff hg).differentiable (by simp) y).hasFDerivAt)).fderiv theorem graphUnitNormalExtension_divergence (a : Cover) {n : Cover} (hn : ‖n‖=1) {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (x : Cover) : divergence (graphUnitNormalExtension a n g) x= -planeDivergence (fun z ↦ cmcFlux (gradient g z)) (normalPlaneCoordinates n (x-a)) := by rw [divergence_eq_coverTrace,graphUnitNormalExtension_fderiv a hn hg] have hneg (L : Cover →L[ℝ] Cover) : coverTrace (-L)= -coverTrace L := by simp [coverTrace,Finset.sum_neg_distrib] rw [hneg,rectangular_trace,ContinuousLinearMap.comp_assoc, normalGraph_projection_differential hn hg,ContinuousLinearMap.comp_id, planeDivergence_eq_trace,cmcFlux_gradient_fderiv hg] end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma planeTrace_comp_comm (A B : Plane →L[ℝ] Plane) : planeTrace (A.comp B)=planeTrace (B.comp A) := by simp only [planeTrace,Fin.sum_univ_two,ContinuousLinearMap.comp_apply] rw [plane_decompose (B (EuclideanSpace.single 0 1)), plane_decompose (B (EuclideanSpace.single 1 1)), plane_decompose (A (EuclideanSpace.single 0 1)), plane_decompose (A (EuclideanSpace.single 1 1))] simp only [map_add,map_smul,PiLp.add_apply,PiLp.smul_apply,smul_eq_mul] ring lemma planeTraceSquare_comp_comm (A B : Plane →L[ℝ] Plane) : planeTraceSquare (A.comp B)=planeTraceSquare (B.comp A) := by rw [← planeTrace_square,← planeTrace_square] calc _ = planeTrace (A.comp ((B.comp A).comp B)) := by congr 1 _ = planeTrace (((B.comp A).comp B).comp A) := planeTrace_comp_comm _ _ _ = _ := by congr 1 lemma planeTraceSquare_symmetric {L : Plane →L[ℝ] Plane} (hL : ∀ v w : Plane,⟪L v,w⟫=⟪v,L w⟫) : 0≤planeTraceSquare L ∧ (planeTrace L)^2≤2*planeTraceSquare L := by have hc : L (EuclideanSpace.single 0 1) 1=L (EuclideanSpace.single 1 1) 0 := by simpa only [EuclideanSpace.inner_single_right,EuclideanSpace.inner_single_left, conj_trivial,one_mul] using hL (EuclideanSpace.single 0 1) (EuclideanSpace.single 1 1) simp only [planeTraceSquare,planeTrace,Fin.sum_univ_two,hc] constructor · nlinarith [sq_nonneg (L (EuclideanSpace.single 0 1) 0), sq_nonneg (L (EuclideanSpace.single 1 1) 0),sq_nonneg (L (EuclideanSpace.single 1 1) 1)] · nlinarith [sq_nonneg (L (EuclideanSpace.single 0 1) 0-L (EuclideanSpace.single 1 1) 1), sq_nonneg (L (EuclideanSpace.single 1 1) 0)] theorem graph_curvature_nonnegative {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (y : Plane) : 0≤graphSquaredSecondFundamentalForm g y ∧ (planeDivergence (fun z ↦ cmcFlux (gradient g z)) y)^2≤ 2*graphSquaredSecondFundamentalForm g y := by let p := gradient g y let L := fderiv ℝ (gradient g) y let C := cmcCompress p let D := (cmcWeight p)⁻¹ • (C.comp L) have hS : graphShapeOperator g y=C.comp D := by apply ContinuousLinearMap.ext intro v change cmcJacobian p (L v)=C (D v) change cmcJacobian p (L v)=C ((cmcWeight p)⁻¹ • C (L v)) rw [map_smul] exact cmcJacobian_compress p (L v) have hB : ∀ v w : Plane,⟪(D.comp C) v,w⟫=⟪v,(D.comp C) w⟫ := by intro v w change ⟪(cmcWeight p)⁻¹ • C (L (C v)),w⟫= ⟪v,(cmcWeight p)⁻¹ • C (L (C w))⟫ rw [real_inner_smul_left,real_inner_smul_right] congr 1 rw [cmcCompress_symm,plane_hessian_symmetric hg, ← cmcCompress_symm] have hh := planeTraceSquare_symmetric hB unfold graphSquaredSecondFundamentalForm rw [hS,planeTraceSquare_comp_comm] refine ⟨hh.1,?_⟩ rw [planeDivergence_eq_trace,cmcFlux_gradient_fderiv hg,hS,planeTrace_comp_comm] exact hh.2 end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma planeTraceSquare_symmetric_eq_zero {L : Plane →L[ℝ] Plane} (hL : ∀ v w : Plane,⟪L v,w⟫=⟪v,L w⟫) (hz : planeTraceSquare L=0) : L=0 := by have hc : L (EuclideanSpace.single 0 1) 1=L (EuclideanSpace.single 1 1) 0 := by simpa only [EuclideanSpace.inner_single_right,EuclideanSpace.inner_single_left, conj_trivial,one_mul] using hL (EuclideanSpace.single 0 1) (EuclideanSpace.single 1 1) simp only [planeTraceSquare,hc] at hz have h00 : L (EuclideanSpace.single 0 1) 0=0 := by nlinarith [sq_nonneg (L (EuclideanSpace.single 1 1) 0),sq_nonneg (L (EuclideanSpace.single 1 1) 1)] have h10 : L (EuclideanSpace.single 1 1) 0=0 := by nlinarith [sq_nonneg (L (EuclideanSpace.single 0 1) 0),sq_nonneg (L (EuclideanSpace.single 1 1) 1)] have h11 : L (EuclideanSpace.single 1 1) 1=0 := by nlinarith [sq_nonneg (L (EuclideanSpace.single 0 1) 0),sq_nonneg (L (EuclideanSpace.single 1 1) 0)] apply ContinuousLinearMap.ext intro v rw [plane_decompose v,map_add,map_smul,map_smul] ext i fin_cases i <;> simp [h00,h10,h11,hc] theorem graph_curvature_zero_fderiv_gradient {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (y : Plane) (hz : graphSquaredSecondFundamentalForm g y=0) : fderiv ℝ (gradient g) y=0 := by let p := gradient g y let L := fderiv ℝ (gradient g) y let C := cmcCompress p let D := (cmcWeight p)⁻¹ • (C.comp L) have hS : graphShapeOperator g y=C.comp D := by apply ContinuousLinearMap.ext intro v change cmcJacobian p (L v)=C ((cmcWeight p)⁻¹ • C (L v)) rw [map_smul] exact cmcJacobian_compress p (L v) have hB : ∀ v w : Plane,⟪(D.comp C) v,w⟫=⟪v,(D.comp C) w⟫ := by intro v w change ⟪(cmcWeight p)⁻¹ • C (L (C v)),w⟫=⟪v,(cmcWeight p)⁻¹ • C (L (C w))⟫ rw [real_inner_smul_left,real_inner_smul_right] congr 1 rw [cmcCompress_symm,plane_hessian_symmetric hg,← cmcCompress_symm] have hzB : D.comp C=0 := by apply planeTraceSquare_symmetric_eq_zero hB change planeTraceSquare (graphShapeOperator g y)=0 at hz rwa [hS,planeTraceSquare_comp_comm] at hz apply ContinuousLinearMap.ext intro v have hv := congrArg (fun A : Plane →L[ℝ] Plane ↦ A (cmcStretch p v)) hzB change (cmcWeight p)⁻¹ • cmcCompress p (L (cmcCompress p (cmcStretch p v)))=0 at hv rw [cmcCompress_stretch] at hv have hv' : cmcCompress p (L v)=0 := (smul_eq_zero.mp hv).resolve_left (inv_ne_zero (cmcWeight_pos p).ne') have hh := congrArg (cmcStretch p) hv' simpa only [cmcStretch_compress,map_zero,zero_apply] using hh theorem graph_curvature_zero_affine {g : Plane → ℝ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) {r : ℝ} (hr : 0 exact contDiff_const | append_singleton l a ih => rw [chainVelocity_append]; exact ih.add (variationField_smooth a) lemma chainVelocity_periodic (l : List Variation) (m : Fin 3 → ℤ) (x : Cover) : chainVelocity l (x+latticeVector m)=chainVelocity l x := by unfold chainVelocity congr 1 apply List.map_congr_left intro a _ rw [a.periodic] def motionJet (l : List Variation) (x : Cover) : Cover×Cover := l.foldl (fun j a ↦ (j.1+variationField a x, j.2+2 • fderiv ℝ (variationField a) x j.1)) (0,0) lemma motionJet_append (l : List Variation) (a : Variation) (x : Cover) : motionJet (l++[a]) x=((motionJet l x).1+variationField a x, (motionJet l x).2+2 • fderiv ℝ (variationField a) x (motionJet l x).1) := by simp only [motionJet,List.foldl_append,List.foldl_cons,List.foldl_nil] lemma motionJet_first (l : List Variation) (x : Cover) : (motionJet l x).1=chainVelocity l x := by induction l using List.reverseRecOn with | nil => rfl | append_singleton l a ih => simp only [motionJet_append,chainVelocity_append,ih] lemma motionJet_smooth (l : List Variation) : ContDiff ℝ (⊤ : ℕ∞) (motionJet l) := by induction l using List.reverseRecOn with | nil => exact contDiff_const | append_singleton l a ih => have hd : ContDiff ℝ (⊤ : ℕ∞) (fderiv ℝ (variationField a)) := (variationField_smooth a).fderiv_right (by simp) simp_rw [show motionJet (l++[a])=(fun x ↦ ((motionJet l x).1+variationField a x, (motionJet l x).2+2 • fderiv ℝ (variationField a) x (motionJet l x).1)) from funext (motionJet_append l a)] exact (ih.fst.add (variationField_smooth a)).prodMk (ih.snd.add ((hd.clm_apply ih.fst).const_smul 2)) lemma motionJet_periodic (l : List Variation) (m : Fin 3 → ℤ) (x : Cover) : motionJet l (x+latticeVector m)=motionJet l x := by induction l using List.reverseRecOn with | nil => rfl | append_singleton l a ih => simp only [motionJet_append,ih,variationField_periodic, fderiv_periodic (variationField_periodic a)] lemma simultaneousMove_second_deriv (l : List Variation) (x : Cover) : deriv (deriv (fun t ↦ chainMove (simultaneousChain l t) x)) 0=(motionJet l x).2 := by induction l using List.reverseRecOn with | nil => simp [simultaneousChain,chainMove,motionJet] | append_singleton l a ih => have hm : ContDiff ℝ (⊤ : ℕ∞) (fun t : ℝ ↦ chainMove (simultaneousChain l t) x) := (simultaneousMove_smooth l).comp (contDiff_id.prodMk contDiff_const) have hf : ContDiff ℝ (⊤ : ℕ∞) (fun t : ℝ ↦ variationField a (chainMove (simultaneousChain l t) x)) := (variationField_smooth a).comp hm have he : (fun t ↦ chainMove (simultaneousChain (l++[a]) t) x)= (fun t ↦ chainMove (simultaneousChain l t) x+t • variationField a (chainMove (simultaneousChain l t) x)) := by funext t simp [simultaneousChain,List.map_append,chainMove_append,chainMove,coordinateMove,variationField,smul_smul] rw [he,second_deriv_add_time_smul hm hf,ih,motionJet_append] dsimp only congr 2 have hd : HasFDerivAt (variationField a) (fderiv ℝ (variationField a) x) (chainMove (simultaneousChain l 0) x) := by simpa only [simultaneousMove_zero] using ((variationField_smooth a).differentiable (by simp) x).hasFDerivAt simpa only [Function.comp_def,simultaneousMove_deriv,motionJet_first] using (hd.comp_hasDerivAt 0 (hm.differentiable (by simp) 0).hasDerivAt).deriv lemma chainNormalVelocity_eq_cofactor (l : List Variation) (x n : Cover) : chainNormalVelocity l x n=cofactorLinear (fderiv ℝ (chainVelocity l) x) n := by induction l using List.reverseRecOn with | nil => change 0=cofactorLinear (fderiv ℝ (fun _ : Cover ↦ (0 : Cover)) x) n simp [cofactorLinear] | append_singleton l a ih => rw [chainVelocity_append,fderiv_fun_add ((chainVelocity_smooth l).differentiable (by simp) x) ((variationField_smooth a).differentiable (by simp) x),cofactorLinear_add,← ih] rw [show cofactorLinear (fderiv ℝ (variationField a) x) n= coordinateNormalVelocity a.coordinate a.function x n from cofactorLinear_coordinate (a.smooth.differentiable (by simp) x) a.coordinate n] simp [chainNormalVelocity,List.map_append] end Periodic end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus def volumeQuadratic (L : Cover →L[ℝ] Cover) : ℝ := (coverTrace L)^2-coverTrace (L.comp L) lemma volumeQuadratic_add (L M : Cover →L[ℝ] Cover) : volumeQuadratic (L+M)=volumeQuadratic L+volumeQuadratic M+ 2*(coverTrace L*coverTrace M-coverTrace (M.comp L)) := by simp only [volumeQuadratic,ContinuousLinearMap.add_comp,ContinuousLinearMap.comp_add, coverTrace_add,coverTrace_comp_comm L M] ring end CubicTorus end end end end OAI