Download data/lean/OAI/Analysis/CircleDomains/Transfer/GraphGridCells.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.75 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/CircleDomains/Transfer/GraphGridCells.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/CircleDomains/Transfer/GraphGridCells.lean
-
curl -L -o GraphGridCells.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/CircleDomains/Transfer/GraphGridCells.lean
4.75 kB
| import OAI.Analysis.CircleDomains.Topology.EqualScaleCellSeparation | |
| namespace OAI | |
| /-! Equal-scale three-dimensional cells, colored by sixteen residues | |
| in each coordinate. Enlarged balls in one color are disjoint. -/ | |
| open Set Function Metric | |
| noncomputable section | |
| namespace CircleDomainRigidity | |
| abbrev GraphGridColor := (Fin 16 Γ Fin 16) Γ Fin 16 | |
| abbrev GraphGridIndex := (β€ Γ β€) Γ β€ | |
| abbrev GraphSpace := (β Γ β) Γ β | |
| def graphGridInterval (r : Fin 16) (k : β€) (s : β) : Set β := | |
| Icc ((16*(k:β)+(r:β))*s) ((16*(k:β)+(r:β)+1)*s) | |
| def graphGridCell (r : GraphGridColor) (k : GraphGridIndex) (s : β) : Set GraphSpace := | |
| (graphGridInterval r.1.1 k.1.1 s ΓΛ’ graphGridInterval r.1.2 k.1.2 s) ΓΛ’ | |
| graphGridInterval r.2 k.2 s | |
| lemma graphGridCell_dist_gt {s : β} (hs : 0 < s) (r : GraphGridColor) | |
| {k l : GraphGridIndex} (hkl : k β l) {x y : GraphSpace} | |
| (hx : x β graphGridCell r k s) (hy : y β graphGridCell r l s) : | |
| 8*s < dist x y := by | |
| by_cases hβ : k.1.1 = l.1.1 | |
| Β· by_cases hβ : k.1.2 = l.1.2 | |
| Β· have hβ : k.2 β l.2 := by | |
| intro h | |
| exact hkl (Prod.ext (Prod.ext hβ hβ) h) | |
| have hh := equal_scale_cell_separation hs hβ (r.2:β) hx.2 hy.2 | |
| exact hh.trans_le (by | |
| rw [Prod.dist_eq,Real.dist_eq] | |
| exact le_max_right _ _) | |
| Β· have hh := equal_scale_cell_separation hs hβ (r.1.2:β) hx.1.2 hy.1.2 | |
| exact hh.trans_le (by | |
| rw [Prod.dist_eq,Prod.dist_eq,Real.dist_eq] | |
| exact (le_max_right _ _).trans (le_max_left _ _)) | |
| Β· have hh := equal_scale_cell_separation hs hβ (r.1.1:β) hx.1.1 hy.1.1 | |
| exact hh.trans_le (by | |
| rw [Prod.dist_eq,Prod.dist_eq,Real.dist_eq] | |
| exact (le_max_left _ _).trans (le_max_left _ _)) | |
| lemma graphGridCell_enlarged_disjoint {s : β} (hs : 0 < s) (r : GraphGridColor) | |
| {k l : GraphGridIndex} (hkl : k β l) {x y : GraphSpace} | |
| (hx : x β graphGridCell r k s) (hy : y β graphGridCell r l s) : | |
| Disjoint (closedBall x (4*s)) (closedBall y (4*s)) := by | |
| apply Set.disjoint_left.mpr | |
| intro z hzx hzy | |
| have ht := dist_triangle x z y | |
| rw [dist_comm x z] at ht | |
| have hle : dist x y β€ 8*s := by | |
| linarith [mem_closedBall.mp hzx, mem_closedBall.mp hzy] | |
| exact (not_lt_of_ge hle) (graphGridCell_dist_gt hs r hkl hx hy) | |
| lemma exists_graphGridInterval {s : β} (hs : 0 < s) (x : β) : | |
| β (r : Fin 16) (k : β€), x β graphGridInterval r k s := by | |
| let n : β€ := Int.floor (x/s) | |
| have hn0 : 0 β€ n % 16 := Int.emod_nonneg _ (by norm_num) | |
| have hn16 : n % 16 < 16 := Int.emod_lt_of_pos _ (by norm_num) | |
| let r : Fin 16 := β¨(n%16).toNat,by omegaβ© | |
| refine β¨r,n/16,?_β© | |
| have he : (16:β)*(n/16:β€)+(r:β) = (n:β) := by | |
| have hr : ((r:β):β) = ((n%16:β€):β) := by | |
| dsimp only [r] | |
| exact_mod_cast (Int.natCast_toNat_eq_self.mpr hn0) | |
| rw [hr] | |
| have hh : (16:β€)*(n/16)+n%16 = n := by simpa only [add_comm] using Int.emod_add_mul_ediv n 16 | |
| exact_mod_cast hh | |
| change (16*(n/16:β€)+(r:β))*s β€ x β§ x β€ (16*(n/16:β€)+(r:β)+1)*s | |
| rw [he] | |
| have hlo := (le_div_iffβ hs).mp (Int.floor_le (x/s)) | |
| have hhi := (div_lt_iffβ hs).mp (Int.lt_floor_add_one (x/s)) | |
| exact β¨hlo,hhi.leβ© | |
| lemma exists_graphGridCell {s : β} (hs : 0 < s) (x : GraphSpace) : | |
| β (r : GraphGridColor) (k : GraphGridIndex), x β graphGridCell r k s := by | |
| obtain β¨rβ,kβ,hββ© := exists_graphGridInterval hs x.1.1 | |
| obtain β¨rβ,kβ,hββ© := exists_graphGridInterval hs x.1.2 | |
| obtain β¨rβ,kβ,hββ© := exists_graphGridInterval hs x.2 | |
| exact β¨((rβ,rβ),rβ),((kβ,kβ),kβ),β¨β¨hβ,hββ©,hββ©β© | |
| lemma graphGridCell_dist_le {s : β} (r : GraphGridColor) (k : GraphGridIndex) | |
| {x y : GraphSpace} (hx : x β graphGridCell r k s) (hy : y β graphGridCell r k s) : | |
| dist x y β€ s := by | |
| have hcoord {a x y : β} (hx : x β Icc a (a+s)) (hy : y β Icc a (a+s)) : | |
| |x-y| β€ s := abs_le.mpr β¨by linarith [hx.1,hy.2],by linarith [hx.2,hy.1]β© | |
| have hβ := hcoord (a := (16*(k.1.1:β)+(r.1.1:β))*s) | |
| (by simpa only [graphGridInterval,add_mul,one_mul] using hx.1.1) | |
| (by simpa only [graphGridInterval,add_mul,one_mul] using hy.1.1) | |
| have hβ := hcoord (a := (16*(k.1.2:β)+(r.1.2:β))*s) | |
| (by simpa only [graphGridInterval,add_mul,one_mul] using hx.1.2) | |
| (by simpa only [graphGridInterval,add_mul,one_mul] using hy.1.2) | |
| have hβ := hcoord (a := (16*(k.2:β)+(r.2:β))*s) | |
| (by simpa only [graphGridInterval,add_mul,one_mul] using hx.2) | |
| (by simpa only [graphGridInterval,add_mul,one_mul] using hy.2) | |
| simpa only [Prod.dist_eq,Real.dist_eq,max_le_iff] using And.intro (And.intro hβ hβ) hβ | |
| end CircleDomainRigidity | |
| end | |
| end OAI | |