Download data/lean/OAI/Probability/CriticalPercolation/Gluing/RelayGeometry.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.16 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Gluing/RelayGeometry.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Gluing/RelayGeometry.lean
-
curl -L -o RelayGeometry.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Gluing/RelayGeometry.lean
7.16 kB
| import Mathlib | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| open Set | |
| open scoped Classical | |
| namespace CriticalPercolation.Relay | |
| def width (i : β) : β := max 2 (210-(i : β)/2) | |
| def selectedSign (u : β) : β := if 0 β€ u then -1 else 1 | |
| def domain (J T Ο : β) : Set (βΓβ) := | |
| {x | |x.1| β€ J β§ |x.2| β€ J/4+630} βͺ | |
| {x | |x.1-T| β€ J β§ |x.2-Ο*T/4| β€ J/4+630} βͺ | |
| {x | 0 β€ x.1 β§ x.1 β€ T β§ |x.2-Ο*x.1/4| β€ 630} | |
| lemma width_lower (i : β) : 2 β€ width i := le_max_left _ _ | |
| lemma width_upper (i : β) : width i β€ 210 := by | |
| apply max_le (by norm_num) | |
| linarith [Nat.cast_nonneg (Ξ± := β) i] | |
| lemma width_next (i : β) : width i β€ width (i+1)+1/2 := by | |
| have h1 := width_lower (i+1) | |
| have h2 : 210-((i+1 : β) : β)/2 β€ width (i+1) := le_max_right _ _ | |
| unfold width at h1 h2 β’ | |
| push_cast at h1 h2 β’ | |
| exact max_le (by linarith) (by linarith) | |
| lemma width_last (L : β) (hL : 416 β€ L) : width L=2 := by | |
| apply max_eq_left | |
| have : (416 : β) β€ L := by exact_mod_cast hL | |
| linarith | |
| lemma selectedSign_cases (u : β) : selectedSign u=-1 β¨ selectedSign u=1 := by | |
| unfold selectedSign | |
| split <;> simp | |
| lemma selectedSign_abs (u : β) : |selectedSign u|=1 := by | |
| rcases selectedSign_cases u with h|h <;> rw [h] <;> norm_num | |
| lemma move_towards_axis (u b : β) (hu : |u| β€ b) : | |
| |u+selectedSign u| β€ max 1 (b-1) := by | |
| rw [abs_le] at hu β’ | |
| have h1 : 1 β€ max 1 (b-1) := le_max_left _ _ | |
| have h2 : b-1 β€ max 1 (b-1) := le_max_right _ _ | |
| unfold selectedSign | |
| split <;> constructor <;> linarith | |
| lemma full_step_height (i : β) (u Ο d e Ξ΅ : β) (hΟ : |Ο|=1) | |
| (hu : |u| β€ width i+d) (hdβ : 0 β€ d) (hd : d+e/4 β€ 1/4) | |
| (hΞ΅ : |Ξ΅| β€ e/4) : | |
| |u+selectedSign u-Ο/4+Ξ΅| β€ width (i+1) := by | |
| have h1 := width_lower (i+1) | |
| have h2 := width_next i | |
| have hs : |Ο/4|=1/4 := by rw [abs_div,hΟ]; norm_num | |
| calc | |
| _ β€ |u+selectedSign u|+|Ο/4|+|Ξ΅| := | |
| by linarith [abs_add_le (u+selectedSign u-Ο/4) Ξ΅, abs_sub (u+selectedSign u) (Ο/4)] | |
| _ β€ max 1 (width i+d-1)+1/4+e/4 := by | |
| rw [hs] | |
| linarith [move_towards_axis u (width i+d) hu] | |
| _ β€ width (i+1) := by | |
| rcases le_total 1 (width i+d-1) with hh|hh | |
| Β· rw [max_eq_right hh]; linarith | |
| Β· rw [max_eq_left hh]; linarith | |
| lemma full_step_time (i : β) (y z d e : β) | |
| (hy : |y-(i : β)| β€ (i+1)*e+d) (hz : |z-(y+1)| β€ e/4) | |
| (hde : d+e/4 β€ e) : |z-((i+1 : β) : β)| β€ (i+2)*e := by | |
| rw [abs_le] at hy hz β’ | |
| push_cast | |
| constructor <;> nlinarith | |
| lemma path_axis_bound (L i : β) (hi : i β€ L) (y x : βΓβ) (d e Ο : β) | |
| (hΟ : |Ο|=1) (he : 0 β€ e) | |
| (hyt : |y.1-(i : β)| β€ (i+1)*e+d) | |
| (hyz : |y.2-Ο*(i : β)/4| β€ width i+d) | |
| (hxt : |x.1-y.1| β€ 100) (hxz : |x.2-y.2| β€ 100) : | |
| |x.2-Ο*x.1/4| β€ 210+d+100+((L+1)*e+d+100)/4 := by | |
| have ht : |x.1-(i : β)| β€ (L+1)*e+d+100 := by | |
| have hc : (i : β) β€ L := by exact_mod_cast hi | |
| calc | |
| _ β€ |x.1-y.1|+|y.1-(i : β)| := abs_sub_le _ _ _ | |
| _ β€ 100+((i+1)*e+d) := add_le_add hxt hyt | |
| _ β€ _ := by nlinarith | |
| have hsame : Ο*(i : β)/4-Ο*x.1/4=Ο*((i : β)-x.1)/4 := by ring | |
| calc | |
| _ β€ |x.2-y.2|+|y.2-Ο*(i : β)/4|+|Ο*(i : β)/4-Ο*x.1/4| := by | |
| linarith [abs_sub_le x.2 (Ο*(i : β)/4) (Ο*x.1/4), | |
| abs_sub_le x.2 y.2 (Ο*(i : β)/4)] | |
| _ β€ 100+(width i+d)+((L+1)*e+d+100)/4 := by | |
| rw [hsame,abs_div,abs_mul,hΟ,one_mul,abs_of_pos (by norm_num : (0:β) < 4),abs_sub_comm (i : β)] | |
| exact add_le_add (add_le_add hxz hyz) (div_le_div_of_nonneg_right ht (by norm_num)) | |
| _ β€ _ := by linarith [width_upper i] | |
| lemma band_mem_domain (J T Ο : β) (hΟ : |Ο|=1) | |
| (x : βΓβ) (ht : -J β€ x.1 β§ x.1 β€ T+J) | |
| (hz : |x.2-Ο*x.1/4| β€ 630) : xβdomain J T Ο := by | |
| have ha : |Ο|=1 := hΟ | |
| by_cases h0 : x.1 < 0 | |
| Β· apply Or.inl; apply Or.inl | |
| have hx : |x.1| β€ J := by rw [abs_of_neg h0]; linarith [ht.1] | |
| refine β¨hx,?_β© | |
| calc | |
| |x.2| β€ |x.2-Ο*x.1/4|+|Ο*x.1/4| := by simpa using abs_sub_le x.2 (Ο*x.1/4) 0 | |
| _ β€ 630+J/4 := by | |
| rw [abs_div,abs_mul,ha,one_mul,abs_of_pos (by norm_num : (0:β) < 4)] | |
| exact add_le_add hz (div_le_div_of_nonneg_right hx (by norm_num)) | |
| _ = _ := add_comm _ _ | |
| Β· by_cases h1 : T < x.1 | |
| Β· apply Or.inl; apply Or.inr | |
| have hx : |x.1-T| β€ J := by rw [abs_of_pos (by linarith)]; linarith [ht.2] | |
| refine β¨hx,?_β© | |
| calc | |
| _ β€ |x.2-Ο*x.1/4|+|Ο*x.1/4-Ο*T/4| := abs_sub_le _ _ _ | |
| _ = |x.2-Ο*x.1/4|+|x.1-T|/4 := by | |
| rw [show Ο*x.1/4-Ο*T/4=Ο*(x.1-T)/4 by ring,abs_div,abs_mul,ha,one_mul] | |
| norm_num | |
| _ β€ 630+J/4 := add_le_add hz (div_le_div_of_nonneg_right hx (by norm_num)) | |
| _ = _ := add_comm _ _ | |
| Β· exact Or.inr β¨by linarith,by linarith,hzβ© | |
| lemma move_path_contained (J : β) (L i : β) (hi : i β€ L) (hJ : 26200 < J) | |
| (y x : βΓβ) (d e Ο : β) (hΟ : |Ο|=1) (he : 0 β€ e) | |
| (hsmall : (L+1)*e+d < 1) | |
| (hyt : |y.1-(i : β)| β€ (i+1)*e+d) | |
| (hyz : |y.2-Ο*(i : β)/4| β€ width i+d) | |
| (hxt : |x.1-y.1| β€ 100) (hxz : |x.2-y.2| β€ 100) : | |
| xβdomain J (L+1/2) Ο := by | |
| have hi' : (i : β) β€ L := by exact_mod_cast hi | |
| have hiβ : (0 : β) β€ i := Nat.cast_nonneg _ | |
| have heL : 0 β€ (L+1)*e := mul_nonneg (by positivity) he | |
| apply band_mem_domain J (L+1/2) Ο hΟ x | |
| Β· rw [abs_le] at hyt hxt | |
| constructor <;> nlinarith | |
| Β· exact (path_axis_bound L i hi y x d e Ο hΟ he hyt hyz hxt hxz).trans (by linarith) | |
| lemma last_crossing_height (L : β) (y x : βΓβ) (d Ο : β) (hΟ : |Ο|=1) | |
| (hy : |y.2-Ο*(L : β)/4| β€ 2+d) (hx : |x.2-y.2| β€ 100) (hd : d < 1) : | |
| |x.2-Ο*(L+1/2)/4| < 210 := by | |
| have he : Ο*(L : β)/4-Ο*(L+1/2)/4=-Ο/8 := by ring | |
| calc | |
| _ β€ |x.2-y.2|+|y.2-Ο*(L : β)/4|+|Ο*(L : β)/4-Ο*(L+1/2)/4| := | |
| by linarith [abs_sub_le x.2 (Ο*(L : β)/4) (Ο*(L+1/2)/4), | |
| abs_sub_le x.2 y.2 (Ο*(L : β)/4)] | |
| _ β€ 100+(2+d)+1/8 := by | |
| rw [he,abs_div,abs_neg,hΟ] | |
| norm_num | |
| linarith | |
| _ < _ := by linarith | |
| end CriticalPercolation.Relay | |
| namespace SimpleGraph.Walk | |
| open scoped _root_.SimpleGraph _root_.SimpleGraph.Walk | |
| variable {V : Type*} {H : SimpleGraph V} | |
| lemma exists_first_crossing (f : V β β) (Ο T : β) | |
| (hf : β β¦x yβ¦, H.Adj x y β |f x-f y| β€ Ο) | |
| {a b : V} (w : H.Walk a b) (ha : f a < T) (hb : T β€ f b) : | |
| β xβw.support, T β€ f x β§ f x β€ T+Ο := by | |
| induction w with | |
| | nil => exact (not_le_of_gt ha hb).elim | |
| | @cons a c b hac w ih => | |
| by_cases hc : T β€ f c | |
| Β· refine β¨c,?_,hc,?_β© | |
| Β· simp only [_root_.SimpleGraph.Walk.support_cons,List.mem_cons] | |
| exact Or.inr w.start_mem_support | |
| Β· have hh := hf hac | |
| rw [abs_le] at hh | |
| linarith | |
| Β· obtain β¨x,hx,h1,h2β© := ih (lt_of_not_ge hc) hb | |
| exact β¨x,by simp only [_root_.SimpleGraph.Walk.support_cons,List.mem_cons]; exact Or.inr hx,h1,h2β© | |
| end SimpleGraph.Walk | |
| end | |
| end | |
| end | |
| end OAI | |