Skip to content

Commit 1234ec7

Browse files
committed
Update lattice2d.lean
1 parent 51ecdba commit 1234ec7

File tree

1 file changed

+52
-41
lines changed

1 file changed

+52
-41
lines changed

lattice/lattice2d.lean

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,39 +38,13 @@ noncomputable def Z2Basis := Basis.restrictScalars ℤ (OrthonormalBasis.toBasis
3838
noncomputable def Z2 := Submodule.span ℤ (Set.range (R2Basis))
3939
noncomputable def Z2' := Submodule.span ℤ (Set.range (Z2Basis))
4040
noncomputable def Z2'' := AddSubgroup.closure (Set.range (R2Basis))
41-
#check Set.range (Z2Basis)
42-
#check Z2
43-
#check Z2
44-
#check Z2.carrier
45-
#check Z2'.carrier
46-
4741

4842
abbrev R2 : Type := (EuclideanSpace ℝ (Fin 2))
4943
variable (w : R2) (h : w ∈ Z2)
5044

51-
lemma hw : ∀ (i : (Fin 2)), ((OrthonormalBasis.toBasis R2Basis).repr w) i ∈ Set.range ⇑(algebraMap ℤ ℝ) :=
52-
by exact (Basis.mem_span_iff_repr_mem ℤ (OrthonormalBasis.toBasis R2Basis) w).mp h
53-
54-
example (s : ℝ) : s ∈ Set.range ⇑(algebraMap ℤ ℝ) → ∃ (n : ℤ), s = n := by
55-
simp
56-
intro n hn
57-
use n
58-
exact hn.symm
59-
60-
61-
62-
#print R2
63-
64-
variable (v : (EuclideanSpace ℝ (Fin 2)))
65-
variable (v2 : (EuclideanSpace ℝ (Fin 2)))
66-
variable (ι : Fin (FiniteDimensional.finrank ℝ (EuclideanSpace ℝ (Fin 2))))
67-
68-
#check (w : (EuclideanSpace ℝ (Fin 2))) ι
69-
7045
-- -- the ι-th coordinate of the vector v in the basis R2Basis
7146
-- #check R2Basis.repr v ι
7247

73-
#check DiscreteTopology Z2
7448

7549
-- want to prove that the ι-th coordinate of v is an integer.
7650
-- the definition of Z2 says that it is a Z module spanned by
@@ -109,11 +83,12 @@ lemma Eq_Int_dist_lt_one (x y : ℝ) (hx : isInteger x) (hy : isInteger y) : |x
10983
exact congrArg Int.cast this
11084

11185
lemma IsIntegerLimitSeqInteger (x : ℕ → ℝ) (p : ℝ) (hxint : ∀ (n : ℕ), isInteger (x n)) (hxconv : Filter.Tendsto x Filter.atTop (nhds p))
112-
: ∃ (m : ℤ), p = m := by
86+
: isInteger p := by
11387
rw [Metric.tendsto_nhds] at hxconv
11488
simp at hxconv
11589
obtain ⟨N1, hN1⟩ := hxconv (1/2) one_half_pos
11690
obtain ⟨m, hm⟩ := hxint N1
91+
unfold isInteger
11792
use m
11893
apply eq_of_forall_dist_le
11994
intro ε hε
@@ -141,22 +116,48 @@ lemma IsIntegerLimitSeqInteger (x : ℕ → ℝ) (p : ℝ) (hxint : ∀ (n : ℕ
141116
_ ≤ ε := by simp
142117
exact le_of_lt this
143118

119+
lemma IsInteger_iff_setrangeZR (s : ℝ) : s ∈ Set.range ⇑(algebraMap ℤ ℝ) ↔ ∃ (n : ℤ), s = n := by
120+
constructor
121+
· simp
122+
intro n hn
123+
use n
124+
exact hn.symm
125+
· intro hs
126+
obtain ⟨n, hn⟩ := hs
127+
use n
128+
exact hn.symm
144129

145-
#check (R2Basis).repr v2 ι
146-
#check v2 ι
147-
148-
example : v2 ι = (R2Basis).repr v2 ι := by
149-
exact rfl
150130

151131

152-
lemma IsInteger_componentsZ2 (v : (EuclideanSpace ℝ (Fin 2))) : v ∈ Z2 ↔ ∀ (ι : Fin (FiniteDimensional.finrank ℝ (EuclideanSpace ℝ (Fin 2)))),
153-
isInteger (v ι) := by
132+
lemma IsInteger_componentsZ2
133+
(v : R2) : v ∈ Z2.carrier ↔ ∀ (i : Fin 2), isInteger ((OrthonormalBasis.toBasis R2Basis).repr v i) := by
154134
constructor
155-
intro hv ι
156-
rw [Basis.mem_submodule_iff (OrthonormalBasis.toBasis R2Basis)] at hv
157-
obtain ⟨c, hc⟩ := hv
135+
· intro hv i
136+
have : ((OrthonormalBasis.toBasis R2Basis).repr v) i ∈ Set.range ⇑(algebraMap ℤ ℝ) := by
137+
exact (Basis.mem_span_iff_repr_mem ℤ (OrthonormalBasis.toBasis R2Basis) v).mp hv i
138+
simp
139+
unfold isInteger
140+
obtain ⟨n, hn⟩ := this
141+
use n
142+
simp at hn
143+
exact hn.symm
144+
· intro hv
145+
unfold Z2
146+
apply (Basis.mem_span_iff_repr_mem ℤ (OrthonormalBasis.toBasis R2Basis) v).mpr
147+
intro i
148+
rw [IsInteger_iff_setrangeZR _]
149+
exact hv i
150+
151+
-- lemma IsInteger_componentsZ2 (v : (EuclideanSpace ℝ (Fin 2))) : v ∈ Z2 ↔ ∀ (ι : Fin (FiniteDimensional.finrank ℝ (EuclideanSpace ℝ (Fin 2)))),
152+
-- isInteger (v ι) := by
153+
-- constructor
154+
-- intro hv ι
155+
-- rw [Basis.mem_submodule_iff (OrthonormalBasis.toBasis R2Basis)] at hv
156+
-- obtain ⟨c, hc⟩ := hv
157+
158+
-- sorry
159+
158160

159-
sorry
160161
-- intro hv ι
161162
-- have hv2floor: (Zspan.floor (OrthonormalBasis.toBasis R2Basis) v) = v := by
162163
-- apply Zspan.floor_eq_self_of_mem
@@ -190,10 +191,20 @@ lemma IsFiniteBoundedSetZ2 (M : ℝ) (hM : M > 0) : Set.Finite {x ∈ Z2 | ‖x
190191
refine IsSeqClosed.isClosed ?hs
191192
unfold IsSeqClosed
192193
intro x p hx
193-
rw [Metric.tendsto_nhds]
194+
-- rw [Metric.tendsto_nhds]
194195
intro hxtop
195-
simp at hxtop
196-
196+
-- simp at hxtop
197+
have hxint : ∀ (n : ℕ), ∀ (i : Fin 2), isInteger ((x n) i) := by
198+
intro n i
199+
exact (IsInteger_componentsZ2 (x n)).mp (hx n) i
200+
rw [IsInteger_componentsZ2 p]
201+
intro i
202+
have hpint : isInteger (p i) := by
203+
204+
-- we need that if x is convergent to p, then
205+
-- x i is convergent to p i.
206+
-- it is unclear whether this is in mathlib
207+
-- nor whether the norm convergence -> weak convergence is in mathlib
197208

198209
have BallDef : {x : (EuclideanSpace ℝ (Fin 2))| dist x 0 ≤ M} = {x : (EuclideanSpace ℝ (Fin 2))| ‖x‖ ≤ M} := by
199210
simp

0 commit comments

Comments
 (0)