import Mathlib import OAI.Geometry.CubicTorus.Estimates.ConeSlopeReciprocalArea namespace OAI section section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus def minimalGraphDensity (g ψ : Plane → ℝ) (y : Plane) : ℝ := fderiv ℝ ψ y (gradient g y)/Real.sqrt (1+‖gradient g y‖^2) lemma graphAreaVector_norm_sqrt {n : Cover} (hn : ‖n‖=1) (g : Plane → ℝ) (y : Plane) : ‖graphAreaVector n g y‖ = Real.sqrt (1+‖gradient g y‖^2) := by rw [plane_gradient_norm,← graphAreaVector_norm_sq hn g y,Real.sqrt_sq (norm_nonneg _)] lemma minimalGraphDensity_tsupport (g ψ : Plane → ℝ) : tsupport (minimalGraphDensity g ψ) ⊆ tsupport ψ := by apply closure_minimal _ isClosed_closure intro y hy by_contra hh exact hy (by simp [minimalGraphDensity,fderiv_of_notMem_tsupport ℝ hh]) lemma minimalGraphDensity_integrable {g ψ : Plane → ℝ} (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) (hsψ : HasCompactSupport ψ) (hg : ∀ y ∈ tsupport ψ, ContinuousAt (fderiv ℝ g) y) : Integrable (minimalGraphDensity g ψ) := by have hc : Continuous (minimalGraphDensity g ψ) := by apply continuous_of_tsupport intro y hy have hd := hg y (minimalGraphDensity_tsupport g ψ hy) have hgrad : ContinuousAt (gradient g) y := (InnerProductSpace.toDual ℝ Plane).symm.continuous.continuousAt.comp hd exact ((hψ.continuous_fderiv (by simp)).continuousAt.clm_apply hgrad).div ((hgrad.norm.pow 2).const_add 1).sqrt (Real.sqrt_pos.2 (by positivity : 0<1+‖gradient g y‖^2)).ne' exact hc.integrable_of_hasCompactSupport (hsψ.of_isClosed_subset isClosed_closure (minimalGraphDensity_tsupport g ψ)) lemma continuous_mul_on_tsupport {f ψ : ℝ → ℝ} (hψ : Continuous ψ) (hf : ∀ s ∈ tsupport ψ, ContinuousAt f s) : Continuous (fun s ↦ f s*ψ s) := by apply continuous_of_tsupport intro s hs exact (hf s (tsupport_mul_subset_right hs)).mul hψ.continuousAt lemma integrable_mul_on_tsupport {f ψ : ℝ → ℝ} (hψ : Continuous ψ) (hsψ : HasCompactSupport ψ) (hf : ∀ s ∈ tsupport ψ, ContinuousAt f s) : Integrable (fun s ↦ f s*ψ s) := (continuous_mul_on_tsupport hψ hf).integrable_of_hasCompactSupport hsψ.mul_left end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma planarWedgeChart_continuous : Continuous planarWedgeChart := planeProductCoordinates.symm.continuous.comp (continuous_fst.prodMk (continuous_fst.mul continuous_snd)) lemma slopeScalarTest_support_coordinates {χ ψ : ℝ → ℝ} (hχ0 : 0 ∉ tsupport χ) {y : Plane} (hy : y ∈ tsupport (slopeScalarTest χ ψ)) : (planeProductCoordinates y).1 ∈ tsupport χ ∧ (planeProductCoordinates y).2/(planeProductCoordinates y).1 ∈ tsupport ψ := by have hr : (planeProductCoordinates y).1 ∈ tsupport χ := by by_contra hh have heχ := notMem_tsupport_iff_eventuallyEq.mp hh have he : slopeScalarTest χ ψ =ᶠ[𝓝 y] (fun _ ↦ (0 : ℝ)) := by filter_upwards [(planeProductCoordinates.continuous.fst.tendsto y).eventually heχ] with z hz simp only [slopeScalarTest,hz,Pi.zero_apply,zero_mul] exact notMem_tsupport_iff_eventuallyEq.mpr he hy refine ⟨hr,?_⟩ have hr0 : (planeProductCoordinates y).1≠0 := fun hh ↦ hχ0 (hh ▸ hr) by_contra hh have heψ := notMem_tsupport_iff_eventuallyEq.mp hh have hc : ContinuousAt (fun z : Plane ↦ (planeProductCoordinates z).2/(planeProductCoordinates z).1) y := planeProductCoordinates.continuous.snd.continuousAt.div planeProductCoordinates.continuous.fst.continuousAt hr0 have he : slopeScalarTest χ ψ =ᶠ[𝓝 y] (fun _ ↦ (0 : ℝ)) := by filter_upwards [hc.eventually heψ] with z hz simp only [slopeScalarTest,hz,Pi.zero_apply,mul_zero] exact notMem_tsupport_iff_eventuallyEq.mpr he hy lemma planarWedgeChart_coordinates_inverse {y : Plane} (hy : (planeProductCoordinates y).1≠0) : planarWedgeChart ((planeProductCoordinates y).1, (planeProductCoordinates y).2/(planeProductCoordinates y).1)=y := by simp only [planarWedgeChart,mul_div_cancel₀ _ hy] exact ContinuousLinearEquiv.symm_apply_apply planeProductCoordinates y lemma slopeScalarTest_compactSupport {χ ψ : ℝ → ℝ} (hχ0 : 0 ∉ tsupport χ) (hχ : HasCompactSupport χ) (hψ : HasCompactSupport ψ) : HasCompactSupport (slopeScalarTest χ ψ) := by apply ((hχ.prod hψ).image planarWedgeChart_continuous).of_isClosed_subset isClosed_closure intro y hy obtain ⟨hr,hs⟩ := slopeScalarTest_support_coordinates hχ0 hy exact ⟨((planeProductCoordinates y).1,(planeProductCoordinates y).2/(planeProductCoordinates y).1), ⟨hr,hs⟩,planarWedgeChart_coordinates_inverse (fun hh ↦ hχ0 (hh ▸ hr))⟩ lemma slopeScalarTest_derivative_zero {χ ψ : ℝ → ℝ} {y : Plane} (hy : (planeProductCoordinates y).1 ∉ tsupport χ ∨ (planeProductCoordinates y).2/(planeProductCoordinates y).1 ∉ tsupport ψ) (hχ0 : 0 ∉ tsupport χ) : fderiv ℝ (slopeScalarTest χ ψ) y=0 := by apply fderiv_of_notMem_tsupport intro hh obtain ⟨hr,hs⟩ := slopeScalarTest_support_coordinates hχ0 hh exact hy.elim (fun h ↦ h hr) (fun h ↦ h hs) end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma plane_norm_sq_coordinates (v : Plane) : ‖v‖^2=(planeProductCoordinates v).1^2+(planeProductCoordinates v).2^2 := by rw [← real_inner_self_eq_norm_sq,plane_inner_coordinates] ring lemma exists_smooth_radial_test {a b : ℝ} (hab : a linarith lemma minimalGraphDensity_slope {g : Plane → ℝ} {χ ψ f q : ℝ → ℝ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) (hχ0 : 0 ∉ tsupport χ) {r s : ℝ} (hr : r≠0) (hg : planeProductCoordinates (gradient g (planarWedgeChart (r,s)))=(f s-s*q s,q s)) : minimalGraphDensity g (slopeScalarTest χ ψ) (planarWedgeChart (r,s)) = deriv χ r*((f s-s*q s)*coneSlopeReciprocalArea f q s*ψ s)+ (χ r/r)*(coneSlopeFlux f q s*deriv ψ s) := by rw [minimalGraphDensity,slopeScalarTest_derivative hχ hψ hχ0 hr, plane_norm_sq_coordinates,hg] dsimp only [Prod.fst,Prod.snd,coneSlopeReciprocalArea,coneSlopeFlux] ring_nf theorem stationary_euler_graph_affine {g : Plane → ℝ} {a b c d : ℝ} (ha : 0 rhs; rw [← normalPlaneCoordinates_reconstruct hn x] have hz : ⟪normalPlaneEmbedding n y,n⟫=0 := (real_inner_comm _ _).trans (normalPlaneEmbedding_inner hn y) rw [inner_add_right,inner_smul_right,hz,mul_zero,add_zero] exact (normalPlaneLinearIsometry n).inner_map_map y (normalPlaneCoordinates n x) lemma normalGraph_coordinates_eq_iff {n : Cover} (hn : ‖n‖=1) (g : Plane → ℝ) (x : Cover) : normalGraph n g (normalPlaneCoordinates n x)=x ↔ g (normalPlaneCoordinates n x)=⟪n,x⟫ := by constructor · intro hh simpa only [normalGraph_inner hn] using congrArg (fun v : Cover ↦ ⟪n,v⟫) hh · intro hh rw [normalGraph,hh,normalPlaneCoordinates_reconstruct hn x] def rebasedGraph (a n : Cover) (g : Plane → ℝ) : Plane → ℝ := graphReparam (LinearIsometryEquiv.refl ℝ Plane) (normalPlaneCoordinates n a) ⟪n,a⟫ g lemma rebasedGraph_apply (a n : Cover) (g : Plane → ℝ) (y : Plane) : rebasedGraph a n g y=g (y-normalPlaneCoordinates n a)+⟪n,a⟫ := rfl lemma rebasedGraph_fderiv (a n : Cover) (g : Plane → ℝ) (y : Plane) : fderiv ℝ (rebasedGraph a n g) y=fderiv ℝ g (y-normalPlaneCoordinates n a) := by rw [rebasedGraph,graphReparam_fderiv] ext z rfl lemma normalGraph_rebased (a : Cover) {n : Cover} (hn : ‖n‖=1) (g : Plane → ℝ) (y : Plane) : normalGraph n (rebasedGraph a n g) y=a+normalGraph n g (y-normalPlaneCoordinates n a) := by have ha := normalPlaneCoordinates_reconstruct hn a simp only [normalGraph,rebasedGraph_apply,add_smul] change normalPlaneLinearIsometry n y+(g (y-normalPlaneCoordinates n a) • n+⟪n,a⟫ • n)= a+(normalPlaneLinearIsometry n (y-normalPlaneCoordinates n a)+g (y-normalPlaneCoordinates n a) • n) rw [map_sub] change normalPlaneLinearIsometry n (normalPlaneCoordinates n a)+⟪n,a⟫ • n=a at ha rw [show normalPlaneLinearIsometry n (normalPlaneCoordinates n a)=a-⟪n,a⟫ • n from eq_sub_iff_add_eq.mpr ha] abel lemma rebasedGraph_graph_eq (a : Cover) {n : Cover} (hn : ‖n‖=1) (g : Plane → ℝ) (x : Cover) : normalGraph n (rebasedGraph a n g) (normalPlaneCoordinates n x)=x ↔ normalGraph n g (normalPlaneCoordinates n (x-a))=x-a := by rw [normalGraph_rebased a hn,map_sub,eq_sub_iff_add_eq] constructor <;> intro hh <;> simpa only [add_comm] using hh lemma rebasedGraph_continuous (a n : Cover) {g : Plane → ℝ} (hg : Continuous g) : Continuous (rebasedGraph a n g) := (hg.comp (continuous_id.sub continuous_const)).add continuous_const lemma rebasedGraph_weak_equation (a : Cover) {n : Cover} (hn : ‖n‖=1) (g : Plane → ℝ) {p : Cover} {ρ : ℝ} (hρ : 0<ρ) (hstat : ∀ F : Cover → Cover, ContDiff ℝ (⊤ : ℕ∞) F → tsupport F ⊆ Metric.closedBall p ρ → (∫ y : Plane, tangentialDivergence F (a+normalGraph n g y) (graphSlopeNormal n (gradient g y))*‖graphAreaVector n g y‖)=0) {Ψ : Plane → ℝ} (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) (hs : ∀ y ∈ tsupport Ψ, normalGraph n (rebasedGraph a n g) y ∈ Metric.ball p (ρ/2)) : (∫ y : Plane, minimalGraphDensity (rebasedGraph a n g) Ψ y)=0 := by let v := normalPlaneCoordinates n a let R := LinearIsometryEquiv.refl ℝ Plane let ψ := graphReparam R (-v) 0 Ψ have hψ := graphReparam_contDiff R (-v) 0 hΨ have hsψ (y : Plane) (hy : y ∈ tsupport ψ) : a+normalGraph n g y ∈ Metric.ball p (ρ/2) := by rw [graphReparam_zero_tsupport] at hy change y-(-v) ∈ tsupport Ψ at hy have hh := hs (y+v) (by simpa only [sub_neg_eq_add] using hy) rw [normalGraph_rebased a hn] at hh simpa only [v,add_sub_cancel_right] using hh have hi := stationary_graph_weak_equation a hn g hρ hstat hψ hsψ simp_rw [graphAreaVector_norm_sqrt hn] at hi have hh : graphReparam R v 0 ψ=Ψ := by ext y simp [graphReparam,ψ,R] rw [← hh] change (∫ y : Plane, minimalGraphDensity (graphReparam R v ⟪n,a⟫ g) (graphReparam R v 0 ψ) y)=0 rw [integral_minimalGraphDensity_reparam] exact hi end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus theorem conical_stationary_patch_plane {A : Set Cover} (hcone : ∀ t : ℝ, 1≤t → ∀ᵐ x ∂(volume : Measure Cover), x ∈ Metric.ball (0 : Cover) 1 → (t⁻¹ • x ∈ A ↔ x ∈ A)) {a n p : Cover} {g : Plane → ℝ} {R ρ : ℝ} (hn : ‖n‖=1) (hg : LipschitzWith (1/4) g) (hρ : 0<ρ) (hC : ∀ y ∈ Metric.closedBall (0 : Plane) R, ContDiffAt ℝ 1 g y) (hRp : p ∈ Metric.ball a R) (hp : p ∈ coverEssentialBoundary A) (hpn : ‖p‖<1) (hp0 : p≠0) (hgraph : ∀ x ∈ Metric.closedBall p (2*ρ), x ∈ coverEssentialBoundary A ↔ normalGraph n g (normalPlaneCoordinates n (x-a))=x-a) (hstat : ∀ F : Cover → Cover, ContDiff ℝ (⊤ : ℕ∞) F → tsupport F ⊆ Metric.closedBall p ρ → (∫ y : Plane, tangentialDivergence F (a+normalGraph n g y) (graphSlopeNormal n (gradient g y))*‖graphAreaVector n g y‖)=0) : ∃ N : Cover, ‖N‖=1 ∧ ∀ᶠ x in 𝓝 p, x ∈ coverEssentialBoundary A ↔ ⟪N,x⟫=0 := by let H := rebasedGraph a n g let v := normalPlaneCoordinates n a let G := normalGraph n H have hHc : Continuous H := rebasedGraph_continuous a n hg.continuous have hGc : Continuous G := (normalPlaneLinearIsometry n).continuous.add (hHc.smul continuous_const) let U : Set Plane := (fun y ↦ y-v) ⁻¹' Metric.ball (0 : Plane) R ∩ G ⁻¹' (Metric.ball p (ρ/2) ∩ Metric.ball (0 : Cover) 1) have hU : IsOpen U := (Metric.isOpen_ball.preimage (continuous_id.sub continuous_const)).inter ((Metric.isOpen_ball.inter Metric.isOpen_ball).preimage hGc) have hHC (y : Plane) (hy : y ∈ U) : ContDiffAt ℝ 1 H y := by apply graphReparam_contDiffAt exact hC _ (Metric.ball_subset_closedBall hy.1) have hbigger (x : Cover) (hx : x ∈ Metric.ball p (ρ/2)) : x ∈ Metric.ball p (2*ρ) := Metric.ball_subset_ball (by linarith) hx have hxp (y : Plane) : normalPlaneCoordinates n (G y)=y := normalPlaneCoordinates_graph hn H y have hEuler (y : Plane) (hy : y ∈ U) : fderiv ℝ H y y=H y := by have hxb := hy.2.1 have hxgraph : normalGraph n g (normalPlaneCoordinates n (G y-a))=G y-a := by apply (rebasedGraph_graph_eq a hn g (G y)).mp rw [hxp] have hxB := (hgraph (G y) (Metric.ball_subset_closedBall (hbigger _ hxb))).mpr hxgraph have hproj : normalPlaneCoordinates n (G y-a)=y-v := by rw [map_sub,hxp] have hgd : DifferentiableAt ℝ g (normalPlaneCoordinates n (G y-a)) := by rw [hproj] exact (hC _ (Metric.ball_subset_closedBall hy.1)).differentiableAt (by norm_num) have hloc : ∀ᶠ x in 𝓝 (G y), x ∈ coverEssentialBoundary A → normalGraph n g (normalPlaneCoordinates n (x-a))=x-a := by filter_upwards [Metric.isOpen_ball.mem_nhds (hbigger _ hxb)] with x hx exact (hgraph x (Metric.ball_subset_closedBall hx)).mp have hr := cone_graph_radial_derivative hcone hn hxB (by simpa only [Metric.mem_ball,dist_zero_right] using hy.2.2) hgd hloc rw [hproj,hxp] at hr rw [rebasedGraph_fderiv] exact hr.trans (normalGraph_inner hn H y) have hweak (Ψ : Plane → ℝ) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) (hs : tsupport Ψ ⊆ U) : (∫ y : Plane, minimalGraphDensity H Ψ y)=0 := rebasedGraph_weak_equation a hn g hρ hstat hΨ (fun y hy ↦ (hs hy).2.1) have hpclosed : p ∈ Metric.closedBall p (2*ρ) := Metric.mem_closedBall_self (by linarith) have hpG : G (normalPlaneCoordinates n p)=p := (rebasedGraph_graph_eq a hn g p).mpr ((hgraph p hpclosed).mp hp) have hpU : normalPlaneCoordinates n p ∈ U := by refine ⟨?_,?_⟩ · simp only [mem_preimage,v,← map_sub,Metric.mem_ball,dist_zero_right] exact (normalPlaneCoordinates_norm_le n (p-a)).trans_lt (by simpa only [Metric.mem_ball,dist_eq_norm] using hRp) · change G (normalPlaneCoordinates n p) ∈ Metric.ball p (ρ/2) ∩ Metric.ball (0 : Cover) 1 rw [hpG] exact ⟨Metric.mem_ball_self (by positivity),by simpa using hpn⟩ have hpz : normalPlaneCoordinates n p≠0 := by apply cone_graph_radial_projection_ne_zero hn hp0 (L := fderiv ℝ H (normalPlaneCoordinates n p)) have he := hEuler _ hpU have hpheight := congrArg (fun x : Cover ↦ ⟪n,x⟫) hpG rw [normalGraph_inner hn] at hpheight exact he.trans hpheight have hline := local_euler_graph_linear_of_ne_zero hU hHC hEuler hweak hpU hpz let M := n-normalPlaneEmbedding n (gradient H (normalPlaneCoordinates n p)) have hM : 0<‖M‖ := lt_of_lt_of_le (by norm_num : (0 : ℝ)<1) (graphSlopeVector_norm_ge hn (gradient H (normalPlaneCoordinates n p))) let N := ‖M‖⁻¹ • M have hN : ‖N‖=1 := by dsimp only [N] rw [norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hM.le),inv_mul_cancel₀ hM.ne'] refine ⟨N,hN,?_⟩ have hprojline := (normalPlaneCoordinates n).continuous.continuousAt.eventually hline filter_upwards [hprojline,Metric.ball_mem_nhds p (by positivity : 0<2*ρ)] with x hx hxball rw [hgraph x (Metric.ball_subset_closedBall hxball),← rebasedGraph_graph_eq a hn g, normalGraph_coordinates_eq_iff hn] change H (normalPlaneCoordinates n x)=⟪n,x⟫ ↔ ⟪N,x⟫=0 rw [hx] have hinner : ⟪N,x⟫=‖M‖⁻¹*(⟪n,x⟫-fderiv ℝ H (normalPlaneCoordinates n p) (normalPlaneCoordinates n x)) := by rw [show N=‖M‖⁻¹ • M from rfl,real_inner_smul_left] congr 1 rw [show M=n-normalPlaneEmbedding n (gradient H (normalPlaneCoordinates n p)) from rfl, inner_sub_left,normalPlaneEmbedding_inner_coordinates hn,inner_gradient_left] rw [hinner,mul_eq_zero,inv_eq_zero,or_iff_right hM.ne',sub_eq_zero] exact eq_comm end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma coverEssentialBoundary_isClosed (A : Set Cover) : IsClosed (coverEssentialBoundary A) := by rw [coverEssentialBoundary_eq_support] exact Measure.isClosed_support.inter Measure.isClosed_support lemma inner_kernel_mono_of_local {n m x : Cover} (hx : ⟪n,x⟫=0) (hlocal : ∀ᶠ y in 𝓝 x, ⟪n,y⟫=0 → ⟪m,y⟫=0) : ∀ v : Cover, ⟪n,v⟫=0 → ⟪m,v⟫=0 := by intro v hv have ht : Tendsto (fun t : ℝ ↦ x+t • v) (𝓝 0) (𝓝 x) := by simpa only [zero_smul,add_zero] using (show Continuous (fun t : ℝ ↦ x+t • v) from continuous_const.add (continuous_id.smul continuous_const)).tendsto (0 : ℝ) have he : (fun t : ℝ ↦ ⟪m,x+t • v⟫) =ᶠ[𝓝 0] (fun _ ↦ (0 : ℝ)) := by filter_upwards [ht.eventually hlocal] with t h exact h (by simp only [inner_add_right,inner_smul_right,hx,hv,mul_zero,add_zero]) have hd : HasDerivAt (fun t : ℝ ↦ ⟪m,x+t • v⟫) ⟪m,v⟫ 0 := by simpa only [inner_add_right,inner_smul_right,id_eq,one_mul] using (((hasDerivAt_id (0 : ℝ)).mul_const ⟪m,v⟫).const_add ⟪m,x⟫) exact hd.unique ((hasDerivAt_const (0 : ℝ) (0 : ℝ)).congr_of_eventuallyEq he) lemma inner_kernel_eq_of_local {n m x : Cover} (hx : ⟪n,x⟫=0) (hlocal : ∀ᶠ y in 𝓝 x, ⟪n,y⟫=0 ↔ ⟪m,y⟫=0) : ∀ v : Cover, ⟪n,v⟫=0 ↔ ⟪m,v⟫=0 := by have hmx := (hlocal.self_of_nhds).mp hx exact fun v ↦ ⟨inner_kernel_mono_of_local hx (hlocal.mono fun _ h ↦ h.mp) v, inner_kernel_mono_of_local hmx (hlocal.mono fun _ h ↦ h.mpr) v⟩ lemma normal_plane_disk_preconnected {n : Cover} (hn : ‖n‖=1) : IsPreconnected {x : Cover | ⟪n,x⟫=0 ∧ ‖x‖<1 ∧ x≠0} := by have he : normalPlaneEmbedding n '' (Metric.ball (0 : Plane) 1 \ {0}) = {x : Cover | ⟪n,x⟫=0 ∧ ‖x‖<1 ∧ x≠0} := by ext x constructor · rintro ⟨z,hz,rfl⟩ refine ⟨normalPlaneEmbedding_inner hn z,?_,?_⟩ · rw [normalPlaneEmbedding_norm] simpa only [Metric.mem_ball,dist_zero_right] using hz.1 · intro hh have hhz := congrArg (normalPlaneCoordinates n) hh exact hz.2 (by simpa only [normalPlaneCoordinates_embedding,map_zero,mem_singleton_iff] using hhz) · rintro ⟨hx,hb,h0⟩ have hh : normalPlaneEmbedding n (normalPlaneCoordinates n x)=x := by simpa only [hx,zero_smul,add_zero] using normalPlaneCoordinates_reconstruct hn x refine ⟨normalPlaneCoordinates n x,⟨?_,?_⟩,hh⟩ · simp only [Metric.mem_ball,dist_zero_right] exact (normalPlaneCoordinates_norm_le n x).trans_lt hb · intro hz have hz' : normalPlaneCoordinates n x=0 := hz rw [hz'] at hh have he0 : normalPlaneEmbedding n (0 : Plane)=0 := (normalPlaneLinearIsometry n).map_zero exact h0 (hh.symm.trans he0) rw [← he] exact (planar_punctured_ball_preconnected (by norm_num : (0 : ℝ)<1)).image _ (normalPlaneLinearIsometry n).continuous.continuousOn theorem local_plane_disk_continuation {B : Set Cover} (hB : IsClosed B) (hloc : ∀ p ∈ B, ‖p‖<1 → p≠0 → ∃ n : Cover, ‖n‖=1 ∧ ∀ᶠ x in 𝓝 p, x∈B ↔ ⟪n,x⟫=0) {n p : Cover} (hn : ‖n‖=1) (hp : p∈B) (hpn : ‖p‖<1) (hp0 : p≠0) (hnloc : ∀ᶠ x in 𝓝 p, x∈B ↔ ⟪n,x⟫=0) : ∀ q : Cover, ⟪n,q⟫=0 → ‖q‖<1 → q≠0 → ∀ᶠ x in 𝓝 q, x∈B ↔ ⟪n,x⟫=0 := by let D : Set Cover := {x | ⟪n,x⟫=0 ∧ ‖x‖<1 ∧ x≠0} let K : Set Cover := {q | ∀ᶠ x in 𝓝 q, x∈B ↔ ⟪n,x⟫=0} have hKo : IsOpen K := isOpen_setOfPred_eventually_nhds have hKc : IsClosed ((Subtype.val : D → Cover) ⁻¹' K) := by rw [← isOpen_compl_iff] apply isOpen_iff_mem_nhds.mpr intro q hq by_cases hqB : (q : Cover)∈B · obtain ⟨m,hm,hmloc⟩ := hloc q hqB q.prop.2.1 q.prop.2.2 let U : Set Cover := {y | ∀ᶠ x in 𝓝 y, x∈B ↔ ⟪m,x⟫=0} have hUo : IsOpen U := isOpen_setOfPred_eventually_nhds have hqU : (q : Cover)∈U := hmloc apply Filter.mem_of_superset ((hUo.preimage continuous_subtype_val).mem_nhds hqU) intro z hz hzK have he : ∀ x : Cover, ⟪n,x⟫=0 ↔ ⟪m,x⟫=0 := inner_kernel_eq_of_local z.prop.1 (hzK.and hz |>.mono fun _ h ↦ h.1.symm.trans h.2) apply hq change ∀ᶠ x in 𝓝 (q : Cover), x∈B ↔ ⟪n,x⟫=0 exact hmloc.mono fun x h ↦ h.trans (he x).symm · apply Filter.mem_of_superset ((hB.isOpen_compl.preimage continuous_subtype_val).mem_nhds hqB) intro z hz hzK exact hz ((hzK.self_of_nhds).mpr z.prop.1) have : PreconnectedSpace D := isPreconnected_iff_preconnectedSpace.mp (normal_plane_disk_preconnected hn) have hpD : p∈D := ⟨(hnloc.self_of_nhds).mp hp,hpn,hp0⟩ have he := (show IsClopen ((Subtype.val : D → Cover) ⁻¹' K) from ⟨hKc,hKo.preimage continuous_subtype_val⟩).eq_univ ⟨⟨p,hpD⟩,hnloc⟩ intro q hqn hqb hq0 have hh : (⟨q,hqn,hqb,hq0⟩ : D)∈(Subtype.val : D → Cover) ⁻¹' K := by rw [he]; trivial exact hh end CubicTorus end end section noncomputable section open MeasureTheory Set Filter open scoped ENNReal NNReal Topology RealInnerProductSpace namespace CubicTorus lemma two_cover_planes_meet {n m : Cover} (hn : ‖n‖=1) : ∃ q : Cover, ⟪n,q⟫=0 ∧ ⟪m,q⟫=0 ∧ ‖q‖<1 ∧ q≠0 := by let v := normalPlaneCoordinates n m have hw : ∃ w : Plane, w≠0 ∧ ⟪w,v⟫=0 := by by_cases hv : v=0 · refine ⟨EuclideanSpace.single 0 1,?_,by simp [hv]⟩ intro h have hh := congrArg (fun z : Plane ↦ z 0) h norm_num at hh · exact exists_planar_perpendicular hv obtain ⟨w,hw,hwi⟩ := hw let x := normalPlaneEmbedding n w have hx : 0<‖x‖ := by rw [normalPlaneEmbedding_norm]; exact norm_pos_iff.mpr hw have hnxi : ⟪n,x⟫=0 := normalPlaneEmbedding_inner hn w have hmxi : ⟪m,x⟫=0 := by rw [real_inner_comm] exact (normalPlaneEmbedding_inner_coordinates hn w m).trans hwi let q := ((1/2 : ℝ)*‖x‖⁻¹) • x have hqn : ‖q‖=(1/2 : ℝ) := by rw [norm_smul,Real.norm_of_nonneg (by positivity : 0≤(1/2 : ℝ)*‖x‖⁻¹), mul_assoc,inv_mul_cancel₀ hx.ne',mul_one] refine ⟨q,?_,?_,by rw [hqn]; norm_num,?_⟩ · simp only [q,inner_smul_right,hnxi,mul_zero] · simp only [q,inner_smul_right,hmxi,mul_zero] · intro hh rw [hh,norm_zero] at hqn norm_num at hqn theorem closed_locally_planar_single_plane {B : Set Cover} (hB : IsClosed B) (hloc : ∀ p ∈ B, ‖p‖<1 → p≠0 → ∃ n : Cover, ‖n‖=1 ∧ ∀ᶠ x in 𝓝 p, x∈B ↔ ⟪n,x⟫=0) {p : Cover} (hp : p∈B) (hpn : ‖p‖<1) (hp0 : p≠0) : ∃ n : Cover, ‖n‖=1 ∧ ∀ x : Cover, ‖x‖<1 → x∈B → ⟪n,x⟫=0 := by obtain ⟨n,hn,hnloc⟩ := hloc p hp hpn hp0 have hnext := local_plane_disk_continuation hB hloc hn hp hpn hp0 hnloc refine ⟨n,hn,?_⟩ intro q hqb hqB by_cases hq0 : q=0 · simp [hq0] obtain ⟨m,hm,hmloc⟩ := hloc q hqB hqb hq0 have hmext := local_plane_disk_continuation hB hloc hm hqB hqb hq0 hmloc obtain ⟨z,hzn,hzm,hzb,hz0⟩ := two_cover_planes_meet (m := m) hn have hnz := hnext z hzn hzb hz0 have hmz := hmext z hzm hzb hz0 have he := inner_kernel_eq_of_local hzn (hnz.and hmz |>.mono fun _ h ↦ h.1.symm.trans h.2) exact (he q).mpr ((hmloc.self_of_nhds).mp hqB) lemma cover_punctured_ball_preconnected {r : ℝ} (hr : 0