import OAI.Geometry.IsometricImmersion.Metric import OAI.Geometry.IsometricImmersion.Energy.HeightEnergy import Mathlib.Topology.Algebra.Support import Mathlib.Analysis.Matrix.Normed namespace OAI noncomputable section open scoped ContDiff Topology BigOperators Matrix open scoped Matrix.Norms.Elementwise open Filter namespace SmoothLocal.Geometry theorem coordPartial_eq_of_eventuallyEq {V : Type*} [NormedAddCommGroup V] [NormedSpace โ„ V] {f h : Coord โ†’ V} {p : Coord} (heq : f =แถ [๐“ p] h) (i : Fin 2) : coordPartial i f p = coordPartial i h p := by unfold coordPartial rw [heq.fderiv_eq] theorem coordPartial_eventuallyEq {V : Type*} [NormedAddCommGroup V] [NormedSpace โ„ V] {f h : Coord โ†’ V} {p : Coord} (heq : f =แถ [๐“ p] h) (i : Fin 2) : coordPartial i f =แถ [๐“ p] coordPartial i h := by filter_upwards [heq.eventuallyEq_nhds] with q hq exact coordPartial_eq_of_eventuallyEq hq i def iteratedCoordPartial {V : Type*} [NormedAddCommGroup V] [NormedSpace โ„ V] : List (Fin 2) โ†’ (Coord โ†’ V) โ†’ Coord โ†’ V | [], f => f | i :: is, f => coordPartial i (iteratedCoordPartial is f) theorem iteratedCoordPartial_eventuallyEq {V : Type*} [NormedAddCommGroup V] [NormedSpace โ„ V] {f h : Coord โ†’ V} {p : Coord} (heq : f =แถ [๐“ p] h) (dirs : List (Fin 2)) : iteratedCoordPartial dirs f =แถ [๐“ p] iteratedCoordPartial dirs h := by induction dirs with | nil => exact heq | cons i is ih => exact coordPartial_eventuallyEq ih i theorem iteratedCoordPartial_zero {V : Type*} [NormedAddCommGroup V] [NormedSpace โ„ V] (dirs : List (Fin 2)) : iteratedCoordPartial dirs (0 : Coord โ†’ V) = 0 := by induction dirs with | nil => rfl | cons i is ih => change coordPartial i (iteratedCoordPartial is (0 : Coord โ†’ V)) = 0 rw [ih] funext p change fderiv โ„ (fun _ : Coord => (0 : V)) p (Pi.single i 1) = 0 simp theorem eventuallyEq_zero_of_not_mem_tsupport {V : Type*} [Zero V] (f : Coord โ†’ V) {p : Coord} (hp : p โˆ‰ tsupport f) : f =แถ [๐“ p] 0 := by filter_upwards [(isClosed_tsupport f).isOpen_compl.mem_nhds hp] with q hq change f q = 0 by_contra hne exact hq (subset_tsupport f hne) theorem iteratedCoordPartial_zero_of_not_mem_tsupport {V : Type*} [NormedAddCommGroup V] [NormedSpace โ„ V] (f : Coord โ†’ V) {p : Coord} (hp : p โˆ‰ tsupport f) (dirs : List (Fin 2)) : iteratedCoordPartial dirs f p = 0 := by have heq := iteratedCoordPartial_eventuallyEq (eventuallyEq_zero_of_not_mem_tsupport f hp) dirs rw [heq.self_of_nhds, iteratedCoordPartial_zero] rfl theorem metric_coeff_eventuallyEq {g h : MetricField} {p : Coord} (heq : g =แถ [๐“ p] h) (i j : Fin 2) : (fun q => g q i j) =แถ [๐“ p] (fun q => h q i j) := heq.mono fun _ hq => congrFun (congrFun hq i) j theorem christoffel_eq_of_eventuallyEq {g h : MetricField} {p : Coord} (heq : g =แถ [๐“ p] h) (k i j : Fin 2) : christoffel g k i j p = christoffel h k i j p := by have hval := heq.self_of_nhds have hd (a b c : Fin 2) : coordPartial a (fun q => g q b c) p = coordPartial a (fun q => h q b c) p := coordPartial_eq_of_eventuallyEq (metric_coeff_eventuallyEq heq b c) a simp only [christoffel, inverseMetric, hval, hd] theorem christoffel_eventuallyEq {g h : MetricField} {p : Coord} (heq : g =แถ [๐“ p] h) (k i j : Fin 2) : christoffel g k i j =แถ [๐“ p] christoffel h k i j := heq.eventuallyEq_nhds.mono fun _ hq => christoffel_eq_of_eventuallyEq hq k i j theorem riemann_eq_of_eventuallyEq {g h : MetricField} {p : Coord} (heq : g =แถ [๐“ p] h) (l k i j : Fin 2) : riemann g l k i j p = riemann h l k i j p := by have hฮ“ := christoffel_eq_of_eventuallyEq heq have hd (a b c d : Fin 2) : coordPartial a (christoffel g b c d) p = coordPartial a (christoffel h b c d) p := coordPartial_eq_of_eventuallyEq (christoffel_eventuallyEq heq b c d) a simp only [riemann, hฮ“, hd] theorem gaussianCurvature_eq_of_eventuallyEq {g h : MetricField} {p : Coord} (heq : g =แถ [๐“ p] h) : gaussianCurvature g p = gaussianCurvature h p := by simp only [gaussianCurvature, heq.self_of_nhds, riemann_eq_of_eventuallyEq heq] theorem covHessian_eq_of_metric_eventuallyEq {g h : MetricField} {p : Coord} (heq : g =แถ [๐“ p] h) (z : Coord โ†’ โ„) : covHessian g z p = covHessian h z p := by ext i j simp only [covHessian, christoffel_eq_of_eventuallyEq heq] theorem heightEnergy_eq_of_metric_eventuallyEq {g h : MetricField} {p : Coord} (heq : g =แถ [๐“ p] h) (z : Coord โ†’ โ„) : heightEnergy g z p = heightEnergy h z p := by simp only [heightEnergy, covectorNormSq, inverseMetric, heq.self_of_nhds] theorem metric_add_eventuallyEq_of_not_mem_tsupport (g ฮท : MetricField) {p : Coord} (hp : p โˆ‰ tsupport ฮท) : g + ฮท =แถ [๐“ p] g := by filter_upwards [eventuallyEq_zero_of_not_mem_tsupport ฮท hp] with q hq change g q + ฮท q = g q simp only [hq, Pi.zero_apply, add_zero] theorem metric_add_all_coordinate_jets (g ฮท : MetricField) {p : Coord} (hp : p โˆ‰ tsupport ฮท) (dirs : List (Fin 2)) : iteratedCoordPartial dirs (g + ฮท) p = iteratedCoordPartial dirs g p := (iteratedCoordPartial_eventuallyEq (metric_add_eventuallyEq_of_not_mem_tsupport g ฮท hp) dirs).self_of_nhds theorem gaussianCurvature_add_eq_off_tsupport (g ฮท : MetricField) {p : Coord} (hp : p โˆ‰ tsupport ฮท) : gaussianCurvature (g + ฮท) p = gaussianCurvature g p := gaussianCurvature_eq_of_eventuallyEq (metric_add_eventuallyEq_of_not_mem_tsupport g ฮท hp) end SmoothLocal.Geometry end end OAI