Download data/lean/OAI/Geometry/KahlerSplitting/Grid.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 14.5 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/KahlerSplitting/Grid.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/KahlerSplitting/Grid.lean
-
curl -L -o Grid.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/KahlerSplitting/Grid.lean
14.5 kB
| import OAI.Geometry.KahlerSplitting.Model | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open Set | |
| namespace RectangleGrid | |
| variable {P Q X : Type*} | |
| def band (k i j : β) : Prop := i β€ j+k β§ j β€ i+k | |
| structure Band (T : Set (P Γ Q β X)) (D : β β P Γ Q β X) | |
| (lo hi : β β P) (bot top : β β Q) (k : β) where | |
| tile : β β β β P Γ Q β X | |
| member : β i j, band k i j β tile i j β T | |
| diagonal : β i, tile i i=D i | |
| hseam : β i j, band k i j β band k (i+1) j β | |
| β y, tile i j (hi i,y)=tile (i+1) j (lo (i+1),y) | |
| vseam : β i j, band k i j β band k i (j+1) β | |
| β x, tile i j (x,top j)=tile i (j+1) (x,bot (j+1)) | |
| theorem band_extend (H : Set (P β X)) (V : Set (Q β X)) (T : Set (P Γ Q β X)) | |
| (horizontal : β f β T, β q, (fun p β¦ f (p,q)) β H) | |
| (vertical : β f β T, β p, (fun q β¦ f (p,q)) β V) | |
| (fill : β a β H, β b β V, β p q, a p=b q β | |
| β f β T, (β x, f (x,q)=a x) β§ (β y, f (p,y)=b y)) | |
| (D : β β P Γ Q β X) (lo hi : β β P) (bot top : β β Q) | |
| (join : β i, D i (hi i,top i)=D (i+1) (lo (i+1),bot (i+1))) | |
| (k : β) (G : Band T D lo hi bot top k) : | |
| β F : Band T D lo hi bot top (k+1), β i j, band k i j β F.tile i j=G.tile i j := by | |
| classical | |
| have up (i j : β) (h : band (k+1) i j) (hn : Β¬band k i j) (hij : i < j) : | |
| β f β T, (β x, f (x,bot j)=G.tile i (j-1) (x,top (j-1))) β§ | |
| (β y, f (hi i,y)=G.tile (i+1) j (lo (i+1),y)) := by | |
| have bβ : band k i (j-1) := by unfold band at *; omega | |
| have bβ : band k (i+1) j := by unfold band at *; omega | |
| apply fill _ (horizontal _ (G.member _ _ bβ) _) _ (vertical _ (G.member _ _ bβ) _) | |
| by_cases he : j=i+1 | |
| Β· subst j | |
| simpa only [Nat.add_sub_cancel,G.diagonal] using join i | |
| Β· have bβ : band k (i+1) (j-1) := by unfold band at *; omega | |
| have eβ := G.hseam i (j-1) bβ bβ (top (j-1)) | |
| have eβ := G.vseam (i+1) (j-1) bβ (by simpa only [Nat.sub_add_cancel (by omega : 1β€ j)] using bβ) (lo (i+1)) | |
| exact eβ.trans (by simpa only [Nat.sub_add_cancel (by omega : 1β€ j)] using eβ) | |
| have down (i j : β) (h : band (k+1) i j) (hn : Β¬band k i j) (hij : j < i) : | |
| β f β T, (β x, f (x,top j)=G.tile i (j+1) (x,bot (j+1))) β§ | |
| (β y, f (lo i,y)=G.tile (i-1) j (hi (i-1),y)) := by | |
| have bβ : band k i (j+1) := by unfold band at *; omega | |
| have bβ : band k (i-1) j := by unfold band at *; omega | |
| apply fill _ (horizontal _ (G.member _ _ bβ) _) _ (vertical _ (G.member _ _ bβ) _) | |
| by_cases he : i=j+1 | |
| Β· subst i | |
| simpa only [Nat.add_sub_cancel,G.diagonal] using (join j).symm | |
| Β· have bβ : band k (i-1) (j+1) := by unfold band at *; omega | |
| have eβ := G.hseam (i-1) (j+1) bβ (by simpa only [Nat.sub_add_cancel (by omega : 1β€ i)] using bβ) (bot (j+1)) | |
| have eβ := G.vseam (i-1) j bβ bβ (hi (i-1)) | |
| simp only [Nat.sub_add_cancel (by omega : 1β€ i)] at eβ | |
| exact eβ.symm.trans eβ.symm | |
| let f (i j : β) : P Γ Q β X := | |
| if h : band k i j then G.tile i j else | |
| if hb : band (k+1) i j then | |
| if hij : i < j then (up i j hb h hij).choose | |
| else (down i j hb h (by unfold band at *; omega)).choose | |
| else D 0 | |
| have old (i j : β) (h : band k i j) : f i j=G.tile i j := by simp only [f,dite_eq_left h] | |
| have upper (i j : β) (h : band (k+1) i j) (hn : Β¬band k i j) (hij : i < j) : | |
| f i j β T β§ (β x, f i j (x,bot j)=G.tile i (j-1) (x,top (j-1))) β§ | |
| (β y, f i j (hi i,y)=G.tile (i+1) j (lo (i+1),y)) := by | |
| simpa only [f,dite_eq_right hn,dite_eq_left h,dite_eq_left hij] using (up i j h hn hij).choose_spec | |
| have lower (i j : β) (h : band (k+1) i j) (hn : Β¬band k i j) (hij : j < i) : | |
| f i j β T β§ (β x, f i j (x,top j)=G.tile i (j+1) (x,bot (j+1))) β§ | |
| (β y, f i j (lo i,y)=G.tile (i-1) j (hi (i-1),y)) := by | |
| simpa only [f,dite_eq_right hn,dite_eq_left h,dite_eq_right (not_lt.mpr (Nat.le_of_lt hij))] using | |
| (down i j h hn hij).choose_spec | |
| refine β¨β¨f,?_,?_,?_,?_β©,oldβ© | |
| Β· intro i j h | |
| by_cases ho : band k i j | |
| Β· rw [old i j ho]; exact G.member i j ho | |
| Β· by_cases hij : i < j | |
| Β· exact (upper i j h ho hij).1 | |
| Β· exact (lower i j h ho (by unfold band at *; omega)).1 | |
| Β· intro i | |
| rw [old i i (by unfold band; omega),G.diagonal] | |
| Β· intro i j ha hb y | |
| by_cases hA : band k i j | |
| Β· rw [old i j hA] | |
| by_cases hB : band k (i+1) j | |
| Β· rw [old (i+1) j hB]; exact G.hseam i j hA hB y | |
| Β· have e := (lower (i+1) j hb hB (by unfold band at *; omega)).2.2 y | |
| simpa only [Nat.add_sub_cancel] using e.symm | |
| Β· have hB : band k (i+1) j := by unfold band at *; omega | |
| rw [old (i+1) j hB] | |
| exact (upper i j ha hA (by unfold band at *; omega)).2.2 y | |
| Β· intro i j ha hb x | |
| by_cases hA : band k i j | |
| Β· rw [old i j hA] | |
| by_cases hB : band k i (j+1) | |
| Β· rw [old i (j+1) hB]; exact G.vseam i j hA hB x | |
| Β· have e := (upper i (j+1) hb hB (by unfold band at *; omega)).2.1 x | |
| simpa only [Nat.add_sub_cancel] using e.symm | |
| Β· have hB : band k i (j+1) := by unfold band at *; omega | |
| rw [old i (j+1) hB] | |
| exact (lower i j ha hA (by unfold band at *; omega)).2.1 x | |
| theorem diagonal_grid (H : Set (P β X)) (V : Set (Q β X)) (T : Set (P Γ Q β X)) | |
| (horizontal : β f β T, β q, (fun p β¦ f (p,q)) β H) | |
| (vertical : β f β T, β p, (fun q β¦ f (p,q)) β V) | |
| (fill : β a β H, β b β V, β p q, a p=b q β | |
| β f β T, (β x, f (x,q)=a x) β§ (β y, f (p,y)=b y)) | |
| (D : β β P Γ Q β X) (hD : β i, D i β T) | |
| (lo hi : β β P) (bot top : β β Q) | |
| (join : β i, D i (hi i,top i)=D (i+1) (lo (i+1),bot (i+1))) : | |
| β f : β β β β P Γ Q β X, (β i j, f i j β T) β§ | |
| (β i, f i i=D i) β§ | |
| (β i j y, f i j (hi i,y)=f (i+1) j (lo (i+1),y)) β§ | |
| (β i j x, f i j (x,top j)=f i (j+1) (x,bot (j+1))) := by | |
| classical | |
| let seed : Band T D lo hi bot top 0 := | |
| β¨fun i _ β¦ D i,fun i _ _ β¦ hD i,fun _ β¦ rfl, | |
| fun i j ha hb β¦ by unfold band at ha hb; omega, | |
| fun i j ha hb β¦ by unfold band at ha hb; omegaβ© | |
| have ext := band_extend H V T horizontal vertical fill D lo hi bot top join | |
| let seq : (k : β) β Band T D lo hi bot top k := | |
| Nat.rec seed (fun k G β¦ (ext k G).choose) | |
| have stable (k i j : β) (h : band k i j) : | |
| (seq (k+1)).tile i j=(seq k).tile i j := (ext k (seq k)).choose_spec i j h | |
| have stable' (k l : β) (hkl : kβ€ l) (i j : β) (h : band k i j) : | |
| (seq l).tile i j=(seq k).tile i j := by | |
| induction l, hkl using Nat.le_induction with | |
| | base => rfl | |
| | succ l hkl ih => | |
| exact (stable l i j (by unfold band at *; omega)).trans ih | |
| let f (i j : β) := (seq (i+j)).tile i j | |
| have atBand (k i j : β) (h : i+jβ€ k) : f i j=(seq k).tile i j := | |
| (stable' (i+j) k h i j (by unfold band; omega)).symm | |
| refine β¨f,fun i j β¦ (seq (i+j)).member i j (by unfold band; omega), | |
| fun i β¦ (seq (i+i)).diagonal i,?_,?_β© | |
| Β· intro i j y | |
| rw [atBand (i+j+1) i j (by omega),atBand (i+j+1) (i+1) j (by omega)] | |
| exact (seq (i+j+1)).hseam i j (by unfold band; omega) (by unfold band; omega) y | |
| Β· intro i j x | |
| rw [atBand (i+j+1) i j (by omega),atBand (i+j+1) i (j+1) (by omega)] | |
| exact (seq (i+j+1)).vseam i j (by unfold band; omega) (by unfold band; omega) x | |
| end RectangleGrid | |
| end | |
| end | |
| section | |
| noncomputable section | |
| open Set Filter Topology | |
| open scoped unitInterval | |
| namespace IntervalChain | |
| variable {X : Type*} | |
| def cell (t : β β I) (i : β) := Icc (t i) (t (i+1)) | |
| lemma overlap (t : β β I) (ht : Monotone t) | |
| (f : β i, cell t i β X) | |
| (seam : β i, f i β¨t (i+1),ht (Nat.le_succ i),le_rflβ© = | |
| f (i+1) β¨t (i+1),le_rfl,ht (Nat.le_succ (i+1))β©) | |
| (i j : β) (x : I) (hi : x β cell t i) (hj : x β cell t j) : | |
| f i β¨x,hiβ©=f j β¨x,hjβ© := by | |
| have half : β j i, i β€ j β β (x : I) (hi : x β cell t i) (hj : x β cell t j), | |
| f i β¨x,hiβ©=f j β¨x,hjβ© := by | |
| intro j | |
| induction j with | |
| | zero => intro i hij x hi hj; have he : i=0 := Nat.eq_zero_of_le_zero hij; subst i; rfl | |
| | succ j ih => | |
| intro i hij x hi hj | |
| by_cases he : i=j+1 | |
| Β· subst i; rfl | |
| have hij' : i β€ j := by omega | |
| have hx : x=t (j+1) := le_antisymm (hi.2.trans (ht (by omega))) hj.1 | |
| subst x | |
| exact (ih i hij' _ hi β¨ht (Nat.le_succ j),le_rflβ©).trans (seam j) | |
| rcases le_total i j with h|h | |
| Β· exact half j i h x hi hj | |
| Β· exact (half i j h x hj hi).symm | |
| lemma covers (t : β β I) (ht0 : t 0=0) (ht : Monotone t) | |
| (N : β) (hN : t N=1) (x : I) : β i β€ N, x β cell t i := by | |
| by_cases hx : x=1 | |
| Β· subst x | |
| refine β¨N,le_rfl,?_,?_β© | |
| Β· simp only [hN,le_refl] | |
| Β· exact (hN βΈ ht (Nat.le_succ N)) | |
| have hx1 : x < 1 := lt_of_le_of_ne le_top hx | |
| have hm : β i, x < t (i+1) := β¨N,lt_of_lt_of_le hx1 (hN βΈ ht (Nat.le_succ N))β© | |
| let i := Nat.find hm | |
| have hiN : i β€ N := Nat.find_min' hm (lt_of_lt_of_le hx1 (hN βΈ ht (Nat.le_succ N))) | |
| refine β¨i,hiN,?_,(Nat.find_spec hm).leβ© | |
| cases hi : i with | |
| | zero => simp [ht0] | |
| | succ j => | |
| have hn := Nat.find_min hm (show j < i from by omega) | |
| exact le_of_not_gt (by simpa only [hi] using hn) | |
| end IntervalChain | |
| end | |
| end | |
| section | |
| noncomputable section | |
| open Set Filter Topology | |
| open scoped unitInterval | |
| namespace PathSubdivision | |
| variable {P X : Type*} [TopologicalSpace P] | |
| theorem parameterize (Ξ± : I β X) (Q : (P β X) β Prop) | |
| (local_param : β x : I, β U : Set I, IsOpen U β§ x β U β§ | |
| β f : P β X, Q f β§ β a : U β P, Continuous a β§ β y, f (a y)=Ξ± y) : | |
| β t : β β I, t 0=0 β§ Monotone t β§ (β N, β m β₯ N, t m=1) β§ | |
| β f : β β P β X, (β i, Q (f i)) β§ | |
| β a : β i, IntervalChain.cell t i β P, (β i, Continuous (a i)) β§ | |
| β i y, f i (a i y)=Ξ± y := by | |
| classical | |
| choose U hU hx f hf a ha he using local_param | |
| have cover : univ β β x, U x := fun x _ β¦ mem_iUnion.mpr β¨x,hx xβ© | |
| obtain β¨t,ht0,ht,hN,hsubβ© := exists_monotone_Icc_subset_open_cover_unitInterval hU cover | |
| choose k hk using hsub | |
| refine β¨t,ht0,ht,hN,fun i β¦ f (k i),fun i β¦ hf (k i), | |
| fun i y β¦ a (k i) β¨y,hk i y.propertyβ©,?_,?_β© | |
| Β· intro i | |
| exact (ha (k i)).comp (continuous_subtype_val.subtype_mk _) | |
| Β· intro i y | |
| exact he (k i) _ | |
| end PathSubdivision | |
| end | |
| end | |
| section | |
| noncomputable section | |
| open Set | |
| namespace RectangleGrid | |
| variable {P Q X : Type*} | |
| theorem row (H : Set (P β X)) (V : Set (Q β X)) (T : Set (P Γ Q β X)) | |
| (vertical : β f β T, β p, (fun q β¦ f (p,q)) β V) | |
| (fill : β a β H, β b β V, β p q, a p=b q β | |
| β f β T, (β x, f (x,q)=a x) β§ (β y, f (p,y)=b y)) | |
| (a : β β P β X) (ha : β i, a i β H) (lo hi : β β P) | |
| (join : β i, a i (hi i)=a (i+1) (lo (i+1))) | |
| (b : Q β X) (hb : b β V) (q : Q) (corner : a 0 (lo 0)=b q) : | |
| β f : β β P Γ Q β X, (β i, f i β T) β§ | |
| (β i x, f i (x,q)=a i x) β§ (β y, f 0 (lo 0,y)=b y) β§ | |
| (β i y, f i (hi i,y)=f (i+1) (lo (i+1),y)) := by | |
| classical | |
| let State (i : β) := {c : Q β X // c β V β§ a i (lo i)=c q} | |
| have exist (i : β) (c : State i) := fill (a i) (ha i) c.val c.property.1 (lo i) q c.property.2 | |
| let tile (i : β) (c : State i) : P Γ Q β X := (exist i c).choose | |
| have tileT (i : β) (c : State i) : tile i c β T := (exist i c).choose_spec.1 | |
| have bottom (i : β) (c : State i) (x : P) : tile i c (x,q)=a i x := | |
| (exist i c).choose_spec.2.1 x | |
| have left (i : β) (c : State i) (y : Q) : tile i c (lo i,y)=c.val y := | |
| (exist i c).choose_spec.2.2 y | |
| let next (i : β) (c : State i) : State (i+1) := | |
| β¨fun y β¦ tile i c (hi i,y),vertical _ (tileT i c) _,((bottom i c (hi i)).trans (join i)).symmβ© | |
| let seq : (i : β) β State i := Nat.rec β¨b,hb,cornerβ© next | |
| refine β¨fun i β¦ tile i (seq i),fun i β¦ tileT i _,fun i x β¦ bottom i _ x,left 0 _,?_β© | |
| intro i y | |
| exact (left (i+1) (seq (i+1)) y).symm | |
| theorem grid (H : Set (P β X)) (V : Set (Q β X)) (T : Set (P Γ Q β X)) | |
| (horizontal : β f β T, β q, (fun p β¦ f (p,q)) β H) | |
| (vertical : β f β T, β p, (fun q β¦ f (p,q)) β V) | |
| (fill : β a β H, β b β V, β p q, a p=b q β | |
| β f β T, (β x, f (x,q)=a x) β§ (β y, f (p,y)=b y)) | |
| (a : β β P β X) (ha : β i, a i β H) (lo hi : β β P) | |
| (joinA : β i, a i (hi i)=a (i+1) (lo (i+1))) | |
| (b : β β Q β X) (hb : β j, b j β V) (bot top : β β Q) | |
| (joinB : β j, b j (top j)=b (j+1) (bot (j+1))) | |
| (corner : a 0 (lo 0)=b 0 (bot 0)) : | |
| β f : β β β β P Γ Q β X, (β i j, f i j β T) β§ | |
| (β i x, f i 0 (x,bot 0)=a i x) β§ | |
| (β j y, f 0 j (lo 0,y)=b j y) β§ | |
| (β i j y, f i j (hi i,y)=f (i+1) j (lo (i+1),y)) β§ | |
| (β i j x, f i j (x,top j)=f i (j+1) (x,bot (j+1))) := by | |
| classical | |
| let State (j : β) := {c : β β P β X // | |
| (β i, c i β H) β§ (β i, c i (hi i)=c (i+1) (lo (i+1))) β§ c 0 (lo 0)=b j (bot j)} | |
| have exist (j : β) (c : State j) := | |
| row H V T vertical fill c.val c.property.1 lo hi c.property.2.1 | |
| (b j) (hb j) (bot j) c.property.2.2 | |
| let tiles (j : β) (c : State j) := (exist j c).choose | |
| have ht (j : β) (c : State j) (i : β) : tiles j c i β T := (exist j c).choose_spec.1 i | |
| have bottom (j : β) (c : State j) (i : β) (x : P) : | |
| tiles j c i (x,bot j)=c.val i x := (exist j c).choose_spec.2.1 i x | |
| have left (j : β) (c : State j) (y : Q) : | |
| tiles j c 0 (lo 0,y)=b j y := (exist j c).choose_spec.2.2.1 y | |
| have seam (j : β) (c : State j) (i : β) (y : Q) : | |
| tiles j c i (hi i,y)=tiles j c (i+1) (lo (i+1),y) := | |
| (exist j c).choose_spec.2.2.2 i y | |
| let next (j : β) (c : State j) : State (j+1) := | |
| β¨fun i x β¦ tiles j c i (x,top j),fun i β¦ horizontal _ (ht j c i) _, | |
| fun i β¦ seam j c i _,(left j c (top j)).trans (joinB j)β© | |
| let seq : (j : β) β State j := Nat.rec β¨a,ha,joinA,cornerβ© next | |
| refine β¨fun i j β¦ tiles j (seq j) i,fun i j β¦ ht j _ i, | |
| bottom 0 _,fun j y β¦ left j _ y,fun i j y β¦ seam j _ i y,?_β© | |
| intro i j x | |
| exact (bottom (j+1) (seq (j+1)) i x).symm | |
| end RectangleGrid | |
| end | |
| end | |
| end OAI | |