Download data/lean/OAI/Geometry/PinnedDistances/GridBounds.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 11.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PinnedDistances/GridBounds.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/PinnedDistances/GridBounds.lean
-
curl -L -o GridBounds.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PinnedDistances/GridBounds.lean
11.2 kB
| import OAI.Geometry.PinnedDistances.ChartLimits | |
| namespace OAI | |
| universe u1 u2 u3 | |
| section | |
| noncomputable section | |
| open scoped BigOperators Topology | |
| open Filter MeasureTheory | |
| namespace WeakPinned.Grid | |
| def level (Ο : FullSample) (r : β) : β€ := β(-r-Ο.1.1)/Real.log 2β | |
| def label (Ο : FullSample) (r : β) (z : β) : β€ Γ β€ := | |
| (bin ((2:β)^level Ο r) (shiftZ (level Ο r) Ο.2.1) (rotatePair Ο.1.1 Ο.1.2 z).1, | |
| bin ((2:β)^level Ο r) (shiftZ (level Ο r) Ο.2.2) (rotatePair Ο.1.1 Ο.1.2 z).2) | |
| lemma regular_pair_ae (z w : β) : | |
| βα΅ Ο β fullLaw, | |
| (β m, shareAt m Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w)) β§ | |
| (β m, shareAt m Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w) β | |
| shareAt (m+1) Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w)) := by | |
| have hm (m : β€) : MeasurableSet {Ο : FullSample | shareAt m Ο.2 | |
| (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w)} := | |
| measurableSet_shareAt_param measurable_snd | |
| ((measurable_rotatePair z).comp measurable_fst) ((measurable_rotatePair w).comp measurable_fst) m | |
| have hs : MeasurableSet {Ο : FullSample | | |
| (β m, shareAt m Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w)) β§ | |
| (β m, shareAt m Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w) β | |
| shareAt (m+1) Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w))} := by | |
| simp only [Set.ofPred_and,Set.ofPred_exists,Set.ofPred_forall] | |
| refine (MeasurableSet.iUnion hm).inter (MeasurableSet.iInter (fun m => ?_)) | |
| convert (hm m).compl.union (hm (m+1)) using 1 | |
| ext Ο | |
| exact imp_iff_not_or | |
| apply (Measure.ae_prod_iff_ae_ae hs).mpr | |
| filter_upwards with p | |
| have hn : βα΅ Ο β squareLaw, β m, shareAt m Ο (rotatePair p.1 p.2 z) (rotatePair p.1 p.2 w) β | |
| shareAt (m+1) Ο (rotatePair p.1 p.2 z) (rotatePair p.1 p.2 w) := by | |
| exact eventually_countable_forall.mpr (fun m => shareAt_nested_ae m _ _) | |
| filter_upwards [share_eventually_exists (rotatePair p.1 p.2 z) (rotatePair p.1 p.2 w),hn] with Ο he hn | |
| obtain β¨n,heβ© := he | |
| exact β¨β¨(n:β€),heβ©,hnβ© | |
| lemma label_eq_iff {Ο : FullSample} {z w : β} (hzw : zβ w) | |
| (he : β m, shareAt m Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w)) | |
| (hn : β m, shareAt m Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w) β | |
| shareAt (m+1) Ο.2 (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w)) (r : β) : | |
| label Ο r z=label Ο r w β rβ€depth Ο z w := by | |
| rw [show label Ο r z=label Ο r w β shareAt (level Ο r) Ο.2 | |
| (rotatePair Ο.1.1 Ο.1.2 z) (rotatePair Ο.1.1 Ο.1.2 w) by simp only [label,Prod.mk.injEq,shareAt]] | |
| rw [shareAt_iff_minScale_le (rotatePair_ne _ _ hzw) he hn] | |
| unfold level depth gridDepth | |
| rw [Int.le_floor,le_div_iffβ (Real.log_pos (by norm_num : (1:β)<2))] | |
| constructor <;> intro h <;> linarith | |
| /-- Side length in the original (unrotated) plane, after scaling by exp m. -/ | |
| def side (Ο : FullSample) (r m : β) : β := Real.exp (m+Ο.1.1)*(2:β)^level Ο r | |
| lemma side_pos (Ο : FullSample) (r m : β) : 0<side Ο r m := by unfold side; positivity | |
| lemma log_side (Ο : FullSample) (r m : β) : | |
| Real.log (side Ο r m)=m+Ο.1.1+(level Ο r:β)*Real.log 2 := by | |
| unfold side | |
| rw [Real.log_mul (Real.exp_ne_zero _) (by positivity),Real.log_exp,Real.log_zpow] | |
| lemma side_bounds (Ο : FullSample) (r m : β) : | |
| Real.exp (m-r)/2 < side Ο r m β§ side Ο r m β€ Real.exp (m-r) := by | |
| have hl := Int.floor_le ((-r-Ο.1.1)/Real.log 2) | |
| have hu := Int.lt_floor_add_one ((-r-Ο.1.1)/Real.log 2) | |
| have hp : 0<Real.log 2 := Real.log_pos (by norm_num) | |
| have hl' := (le_div_iffβ hp).mp hl | |
| have hu' := (div_lt_iffβ hp).mp hu | |
| change (level Ο r:β)*Real.log 2β€ -r-Ο.1.1 at hl' | |
| change -r-Ο.1.1<((level Ο r:β)+1)*Real.log 2 at hu' | |
| constructor | |
| Β· rw [β Real.exp_log (by norm_num : (0:β)<2),β Real.exp_sub] | |
| rw [β Real.exp_log (side_pos Ο r m),Real.exp_lt_exp,log_side] | |
| nlinarith | |
| Β· rw [β Real.exp_log (side_pos Ο r m),Real.exp_le_exp,log_side] | |
| linarith | |
| lemma label_diameter {Ο : FullSample} {r m : β} {z w : β} | |
| (h : label Ο r z=label Ο r w) : | |
| β(Real.exp m:β)*z-(Real.exp m:β)*wβ < 2*side Ο r m := by | |
| have hβ := shares_gap (by positivity : 0<(2:β)^level Ο r) (congrArg Prod.fst h) | |
| have hβ := shares_gap (by positivity : 0<(2:β)^level Ο r) (congrArg Prod.snd h) | |
| have hh := (rotatePair_gaps Ο.1.1 Ο.1.2 z w).1 | |
| have hm := mul_lt_mul_of_pos_left (show Real.exp (-Ο.1.1)*βz-wβ < 2*(2:β)^level Ο r by linarith) | |
| (Real.exp_pos (m+Ο.1.1)) | |
| have he : Real.exp (m+Ο.1.1)*Real.exp (-Ο.1.1)=Real.exp m := by rw [β Real.exp_add]; congr 1; ring | |
| rw [β mul_sub,norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] | |
| unfold side | |
| rw [β mul_assoc,he] at hm | |
| nlinarith | |
| end WeakPinned.Grid | |
| namespace WeakPinned.Global | |
| open NumberField Hierarchy | |
| variable {P : Type u1} {K : Type u2} [Fintype P] [DecidableEq P] [Field K] [NumberField K] | |
| variable (Z : P β K) (hZ : Function.Injective Z) (v : InfinitePlace K) | |
| omit [NumberField K] in | |
| include hZ in | |
| lemma arch_label_ae : βα΅ Ο β Grid.fullLaw, β r x y, | |
| (arch Z v Ο).share r x y β Grid.label Ο r (v.embedding (Z x))=Grid.label Ο r (v.embedding (Z y)) := by | |
| have hr : βα΅ Ο β Grid.fullLaw, β x y, | |
| (β m, Grid.shareAt m Ο.2 (Grid.rotatePair Ο.1.1 Ο.1.2 (v.embedding (Z x))) (Grid.rotatePair Ο.1.1 Ο.1.2 (v.embedding (Z y)))) β§ | |
| (β m, Grid.shareAt m Ο.2 (Grid.rotatePair Ο.1.1 Ο.1.2 (v.embedding (Z x))) (Grid.rotatePair Ο.1.1 Ο.1.2 (v.embedding (Z y))) β | |
| Grid.shareAt (m+1) Ο.2 (Grid.rotatePair Ο.1.1 Ο.1.2 (v.embedding (Z x))) (Grid.rotatePair Ο.1.1 Ο.1.2 (v.embedding (Z y)))) := by | |
| simp only [Filter.eventually_all] | |
| exact fun x y => Grid.regular_pair_ae _ _ | |
| filter_upwards [good_ae Z hZ v,hr] with Ο hg hr | |
| intro r x y | |
| by_cases hxy : x=y | |
| Β· subst y; simp [Depth.share] | |
| Β· rw [Depth.share,or_iff_right hxy] | |
| change (r β€ if good Z v Ο β§ xβ y then Grid.depth Ο (v.embedding (Z x)) (v.embedding (Z y)) else 0) β _ | |
| rw [ite_eq_left β¨hg,hxyβ©] | |
| exact (Grid.label_eq_iff (embedding_ne Z hZ v hxy) (hr x y).1 (hr x y).2 r).symm | |
| end WeakPinned.Global | |
| end | |
| end | |
| section | |
| noncomputable section | |
| open scoped BigOperators Topology | |
| open Filter MeasureTheory | |
| namespace WeakPinned.Grid | |
| lemma bin_gap {l : β} (hl : 0<l) (s x y : β) : | |
| |(bin l s x : β)-(bin l s y : β)| < |x-y|/l+1 := by | |
| have hx := Int.floor_le ((x-s)/l) | |
| have hy := Int.lt_floor_add_one ((y-s)/l) | |
| have hx' := Int.lt_floor_add_one ((x-s)/l) | |
| have hy' := Int.floor_le ((y-s)/l) | |
| have hh : (x-s)/l-(y-s)/l=(x-y)/l := by ring | |
| have hle := div_le_div_of_nonneg_right (le_abs_self (x-y)) hl.le | |
| have hge := div_le_div_of_nonneg_right (neg_abs_le (x-y)) hl.le | |
| rw [neg_div] at hge | |
| unfold bin | |
| apply abs_lt.mpr | |
| constructor <;> linarith | |
| lemma scaled_ratio (Ο : FullSample) (r m : β) (z w : β) : | |
| Real.exp (-Ο.1.1)*βz-wβ/(2:β)^level Ο r = | |
| β(Real.exp m:β)*z-(Real.exp m:β)*wβ/side Ο r m := by | |
| rw [β mul_sub,norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] | |
| unfold side | |
| have he : Real.exp (-Ο.1.1)*Real.exp (m+Ο.1.1)=Real.exp m := by | |
| rw [β Real.exp_add]; congr 1; ring | |
| field_simp | |
| nlinarith [congrArg (fun t : β => βz-wβ*t) he] | |
| lemma label_gap (Ο : FullSample) (r m : β) (z w : β) : | |
| |((label Ο r z).1:β)-((label Ο r w).1:β)| < | |
| β(Real.exp m:β)*z-(Real.exp m:β)*wβ/side Ο r m+1 β§ | |
| |((label Ο r z).2:β)-((label Ο r w).2:β)| < | |
| β(Real.exp m:β)*z-(Real.exp m:β)*wβ/side Ο r m+1 := by | |
| have hβ : |(rotatePair Ο.1.1 Ο.1.2 z).1-(rotatePair Ο.1.1 Ο.1.2 w).1|β€ | |
| Real.exp (-Ο.1.1)*βz-wβ := by | |
| simpa only [β norm_rotateC Ο.1.1 Ο.1.2 (z-w),rotateC_sub,rotatePair,Complex.sub_re] using | |
| Complex.abs_re_le_norm (rotateC Ο.1.1 Ο.1.2 z-rotateC Ο.1.1 Ο.1.2 w) | |
| have hβ : |(rotatePair Ο.1.1 Ο.1.2 z).2-(rotatePair Ο.1.1 Ο.1.2 w).2|β€ | |
| Real.exp (-Ο.1.1)*βz-wβ := by | |
| simpa only [β norm_rotateC Ο.1.1 Ο.1.2 (z-w),rotateC_sub,rotatePair,Complex.sub_im] using | |
| Complex.abs_im_le_norm (rotateC Ο.1.1 Ο.1.2 z-rotateC Ο.1.1 Ο.1.2 w) | |
| have hp : 0<(2:β)^level Ο r := by positivity | |
| constructor | |
| Β· exact (bin_gap hp _ _ _).trans_le (add_le_add | |
| ((div_le_div_of_nonneg_right hβ hp.le).trans_eq (scaled_ratio Ο r m z w)) le_rfl) | |
| Β· exact (bin_gap hp _ _ _).trans_le (add_le_add | |
| ((div_le_div_of_nonneg_right hβ hp.le).trans_eq (scaled_ratio Ο r m z w)) le_rfl) | |
| /-- A uniform bound on the number of occupied squares meeting the disk. | |
| Only the lower bound on the actual side is needed. -/ | |
| lemma card_labels_bound {P : Type u3} [DecidableEq P] (A : Finset P) (u : P β β) | |
| (Ο : FullSample) (r m : β) (b : β) (R L : β) (M : β) | |
| (hR : 0β€R) (hL : 0<L) (hside : L β€ side Ο r m) | |
| (hM : 2*R/L+1β€M) | |
| (hA : β xβA, β(Real.exp m:β)*u x+bββ€R) : | |
| (A.image (fun x => label Ο r (u x))).card β€ (2*M+1)^2 := by | |
| classical | |
| rcases A.eq_empty_or_nonempty with h | β¨xβ,hxββ© | |
| Β· simp [h] | |
| let lβ := label Ο r (u xβ) | |
| have hd (x : P) (hx : xβA) : | |
| β(Real.exp m:β)*u x-(Real.exp m:β)*u xβββ€2*R := by | |
| rw [show (Real.exp m:β)*u x-(Real.exp m:β)*u xβ= | |
| ((Real.exp m:β)*u x+b)-((Real.exp m:β)*u xβ+b) by ring] | |
| exact (norm_sub_le _ _).trans (by linarith [hA x hx,hA xβ hxβ]) | |
| have hg (x : P) (hx : xβA) : | |
| |((label Ο r (u x)).1:β)-(lβ.1:β)|β€M β§ | |
| |((label Ο r (u x)).2:β)-(lβ.2:β)|β€M := by | |
| have hb : β(Real.exp m:β)*u x-(Real.exp m:β)*u xββ/side Ο r m+1β€M := by | |
| apply le_trans _ hM | |
| apply add_le_add _ le_rfl | |
| exact div_le_divβ (by positivity) (hd x hx) hL hside | |
| exact β¨(label_gap Ο r m _ _).1.le.trans hb,(label_gap Ο r m _ _).2.le.trans hbβ© | |
| have hs : A.image (fun x => label Ο r (u x)) β | |
| (Finset.Icc (lβ.1-(M:β€)) (lβ.1+(M:β€))) ΓΛ’ | |
| (Finset.Icc (lβ.2-(M:β€)) (lβ.2+(M:β€))) := by | |
| intro p hp | |
| obtain β¨x,hx,rflβ© := Finset.mem_image.mp hp | |
| have hh := hg x hx | |
| rcases abs_le.mp hh.1 with β¨ha,hbβ© | |
| rcases abs_le.mp hh.2 with β¨hc,hdβ© | |
| simp only [Finset.mem_product,Finset.mem_Icc] | |
| constructor | |
| Β· constructor | |
| Β· exact_mod_cast (show (lβ.1:β)-(M:β)β€((label Ο r (u x)).1:β) by linarith) | |
| Β· exact_mod_cast (show ((label Ο r (u x)).1:β)β€(lβ.1:β)+(M:β) by linarith) | |
| Β· constructor | |
| Β· exact_mod_cast (show (lβ.2:β)-(M:β)β€((label Ο r (u x)).2:β) by linarith) | |
| Β· exact_mod_cast (show ((label Ο r (u x)).2:β)β€(lβ.2:β)+(M:β) by linarith) | |
| calc | |
| _ β€ _ := Finset.card_le_card hs | |
| _ = (2*M+1)^2 := by | |
| rw [Finset.card_product,Int.card_Icc,Int.card_Icc] | |
| have he (z : β€) : (z+(M:β€)+1-(z-(M:β€))).toNat=2*M+1 := by omega | |
| rw [he,he,pow_two] | |
| end WeakPinned.Grid | |
| end | |
| end | |
| end OAI | |