Download data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonSliceGeometry.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 24.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonSliceGeometry.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonSliceGeometry.lean
-
curl -L -o CommonSliceGeometry.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonSliceGeometry.lean
24.8 kB
| import Mathlib | |
| import OAI.NumberTheory.Jacobsthal.Estimates.HeightBlockCount | |
| import OAI.NumberTheory.Jacobsthal.Estimates.HypotheticalPairRows | |
| namespace OAI | |
| namespace Erdos970 | |
| open scoped _root_.Erdos970 | |
| namespace ErdosCommonParameterInterval | |
| noncomputable def commonLower (a R T : β) : β := max (a/R) (a/T) | |
| noncomputable def commonUpper (b R T : β) : β := min (b/R) (b/T) | |
| theorem div_between_endpoints (a : β) {R p T : β} (hR : 0 < R) | |
| (hRp : R β€ p) (hpT : p β€ T) : | |
| min (a/R) (a/T) β€ a/p β§ a/p β€ max (a/R) (a/T) := by | |
| have hp : 0 < p := hR.trans_le hRp | |
| have hT : 0 < T := hp.trans_le hpT | |
| by_cases ha : 0 β€ a | |
| Β· exact β¨(min_le_right _ _).trans (div_le_div_of_nonneg_left ha hp hpT), | |
| (div_le_div_of_nonneg_left ha hR hRp).trans (le_max_left _ _)β© | |
| Β· have han : 0 β€ -a := by linarith | |
| have h1 := div_le_div_of_nonneg_left han hp hpT | |
| have h2 := div_le_div_of_nonneg_left han hR hRp | |
| simp only [neg_div] at h1 h2 | |
| exact β¨(min_le_left _ _).trans (by linarith), | |
| (show a/p β€ a/T by linarith).trans (le_max_right _ _)β© | |
| theorem common_interval_subset (a b : β) {R p T : β} (hR : 0 < R) | |
| (hRp : R β€ p) (hpT : p β€ T) : | |
| Set.Ioc (commonLower a R T) (commonUpper b R T) β Set.Ioc (a/p) (b/p) := by | |
| intro m hm | |
| exact β¨(div_between_endpoints a hR hRp hpT).2.trans_lt hm.1, | |
| hm.2.trans (div_between_endpoints b hR hRp hpT).1β© | |
| theorem commonLower_error (a : β) {R T : β} (hR : 0 < R) (hRT : R β€ T) : | |
| commonLower a R T β€ a/T+|a| *(1/R-1/T) := by | |
| have hT : 0 < T := hR.trans_le hRT | |
| have hd : 0 β€ 1/R-1/T := sub_nonneg.mpr (one_div_le_one_div_of_le hR hRT) | |
| have he : a/R=a/T+a*(1/R-1/T) := by ring | |
| apply max_le | |
| Β· rw [he] | |
| exact add_le_add le_rfl (mul_le_mul_of_nonneg_right (le_abs_self a) hd) | |
| Β· exact le_add_of_nonneg_right (mul_nonneg (abs_nonneg a) hd) | |
| theorem commonUpper_error (b : β) {R T : β} (hR : 0 < R) (hRT : R β€ T) : | |
| b/T-|b| *(1/R-1/T) β€ commonUpper b R T := by | |
| have hT : 0 < T := hR.trans_le hRT | |
| have hd : 0 β€ 1/R-1/T := sub_nonneg.mpr (one_div_le_one_div_of_le hR hRT) | |
| have he : b/R=b/T+b*(1/R-1/T) := by ring | |
| apply le_min | |
| Β· rw [he] | |
| have h := mul_le_mul_of_nonneg_right (neg_abs_le b) hd | |
| nlinarith | |
| Β· exact sub_le_self _ (mul_nonneg (abs_nonneg b) hd) | |
| theorem common_length_lower (a b : β) {R T : β} (hR : 0 < R) (hRT : R β€ T) : | |
| (b-a)/T-(|a|+|b|)*(1/R-1/T) β€ commonUpper b R T-commonLower a R T := by | |
| have hl := commonLower_error a hR hRT | |
| have hu := commonUpper_error b hR hRT | |
| have he : (b-a)/T-(|a|+|b|)*(1/R-1/T) = | |
| (b/T-|b| *(1/R-1/T))-(a/T+|a| *(1/R-1/T)) := by ring | |
| rw [he] | |
| exact sub_le_sub hu hl | |
| theorem common_height_bound (a b m : β) {R T : β} (hR : 0 < R) | |
| (hm : m β Set.Ioc (commonLower a R T) (commonUpper b R T)) : | |
| |m| β€ max |a| |b|/R := by | |
| apply abs_le.mpr | |
| constructor | |
| Β· have h1 : -(max |a| |b|) β€ a := | |
| (neg_le_neg (le_max_left _ _)).trans (neg_abs_le a) | |
| have h2 := div_le_div_of_nonneg_right h1 hR.le | |
| have h3 : a/R β€ commonLower a R T := le_max_left _ _ | |
| rw [neg_div] at h2 | |
| exact h2.trans (h3.trans hm.1.le) | |
| Β· have h1 : b β€ max |a| |b| := (le_abs_self b).trans (le_max_right _ _) | |
| have h2 := div_le_div_of_nonneg_right h1 hR.le | |
| exact hm.2.trans ((min_le_left _ _).trans h2) | |
| theorem reciprocal_width_bound {R T epsilon : β} (hR : 0 < R) (hRT : R β€ T) | |
| (hwidth : T β€ (1+epsilon)*R) : 1/R-1/T β€ epsilon/T := by | |
| have hT : 0 < T := hR.trans_le hRT | |
| have hdiv : T/R β€ 1+epsilon := (div_le_iffβ hR).mpr hwidth | |
| have he : (1/R-1/T)*T=T/R-1 := by field_simp | |
| apply (le_div_iffβ hT).mpr | |
| rw [he] | |
| linarith | |
| theorem common_length_lower_relative (a b : β) {R T epsilon : β} | |
| (hR : 0 < R) (hRT : R β€ T) (hwidth : T β€ (1+epsilon)*R) : | |
| ((b-a)-epsilon*(|a|+|b|))/T β€ commonUpper b R T-commonLower a R T := by | |
| have hd := reciprocal_width_bound hR hRT hwidth | |
| have hmul := mul_le_mul_of_nonneg_left hd (add_nonneg (abs_nonneg a) (abs_nonneg b)) | |
| calc | |
| _ = (b-a)/T-(|a|+|b|)*(epsilon/T) := by ring | |
| _ β€ (b-a)/T-(|a|+|b|)*(1/R-1/T) := sub_le_sub_left hmul _ | |
| _ β€ _ := common_length_lower a b hR hRT | |
| theorem affine_common_interval (A D Y q m : β) {R p T : β} | |
| (hq : 0 < q) (hR : 0 < R) (hRp : R β€ p) (hpT : p β€ T) | |
| (hm : m β Set.Ioc (commonLower (-A/q) R T) (commonUpper ((D*Y-A)/q) R T)) : | |
| 0 < A+p*q*m β§ A+p*q*m β€ D*Y := by | |
| have hp : 0 < p := hR.trans_le hRp | |
| have hc := common_interval_subset (-A/q) ((D*Y-A)/q) hR hRp hpT hm | |
| simp only [div_div] at hc | |
| have hl := (div_lt_iffβ (mul_pos hq hp)).mp hc.1 | |
| have hu := (le_div_iffβ (mul_pos hq hp)).mp hc.2 | |
| constructor <;> nlinarith | |
| end ErdosCommonParameterInterval | |
| namespace ErdosCommonMInterval | |
| open ErdosCommonParameterInterval | |
| noncomputable def lower (A q R T : β) : β := commonLower (-A/q) R T + 1 | |
| noncomputable def upper (A D Y q R T : β) : β := commonUpper ((D*Y-A)/q) R T | |
| noncomputable def interval (A D Y q R T : β) : Set β := | |
| Set.Icc (lower A q R T) (upper A D Y q R T) | |
| noncomputable def referenceLength (Y R q : β) : β := Y/(R*q) | |
| noncomputable def lengthExponent (P Y R q : β) : β := Real.log (referenceLength Y R q)/Real.log P | |
| theorem closed_subset (A D Y q R T : β) : | |
| interval A D Y q R T β | |
| Set.Ioc (commonLower (-A/q) R T) (commonUpper ((D*Y-A)/q) R T) := by | |
| intro m hm | |
| exact β¨by have := hm.1; dsimp [interval,lower] at this; linarith, hm.2β© | |
| theorem closed_affine {A D Y q R T m p : β} | |
| (hq : 0 < q) (hR : 0 < R) (hRp : R β€ p) (hpT : p β€ T) | |
| (hm : m β interval A D Y q R T) : | |
| 0 < A+p*q*m β§ A+p*q*m β€ D*Y := | |
| affine_common_interval A D Y q m hq hR hRp hpT (closed_subset A D Y q R T hm) | |
| theorem integer_decode {A m : β€} {D Y q p : β} {R T : β} | |
| (hD : 0 < D) (hq : 0 < q) (hR : 0 < R) | |
| (hRp : R β€ (p : β)) (hpT : (p : β) β€ T) | |
| (hm : (m : β) β interval A D Y q R T) | |
| (hdvd : (D : β€) β£ A+(p : β€)*q*m) : | |
| β n : β, 1 β€ n β§ n β€ Y β§ (D : β€)*n=A+(p : β€)*q*m := by | |
| have hb := closed_affine (by exact_mod_cast hq) hR hRp hpT hm | |
| obtain β¨k,hkβ© := hdvd | |
| have he : (A : β)+(p : β)*q*m=(D : β)*(k : β) := by exact_mod_cast hk | |
| have hDp : (0 : β) < D := by exact_mod_cast hD | |
| have hkpos : (0 : β) < k := by nlinarith [hb.1] | |
| have hkY : (k : β) β€ Y := by nlinarith [hb.2] | |
| have hkint : 0 β€ k := le_of_lt (by exact_mod_cast hkpos : (0 : β€) < k) | |
| refine β¨k.toNat, ?_, ?_, ?_β© | |
| Β· have : (1 : β€) β€ k := by exact_mod_cast (by exact_mod_cast hkpos : (0 : β€) < k) | |
| exact_mod_cast (show (1 : β€) β€ (k.toNat : β€) by simpa [Int.toNat_of_nonneg hkint] using this) | |
| Β· have : k β€ (Y : β€) := by exact_mod_cast hkY | |
| exact_mod_cast (show (k.toNat : β€) β€ (Y : β€) by simpa [Int.toNat_of_nonneg hkint] using this) | |
| Β· simpa [Int.toNat_of_nonneg hkint] using hk.symm | |
| def decode (A m : β€) (D q p : β) : β := | |
| ((A+(p : β€)*q*m)/(D : β€)).toNat | |
| theorem decode_spec {A m : β€} {D Y q p : β} {R T : β} | |
| (hD : 0 < D) (hq : 0 < q) (hR : 0 < R) | |
| (hRp : R β€ (p : β)) (hpT : (p : β) β€ T) | |
| (hm : (m : β) β interval A D Y q R T) | |
| (hdvd : (D : β€) β£ A+(p : β€)*q*m) : | |
| 1 β€ decode A m D q p β§ decode A m D q p β€ Y β§ | |
| (D : β€)*decode A m D q p=A+(p : β€)*q*m := by | |
| obtain β¨n,hn1,hnY,hnβ© := integer_decode hD hq hR hRp hpT hm hdvd | |
| have hDn : (D : β€) β 0 := by exact_mod_cast hD.ne' | |
| have hid : decode A m D q p=n := by | |
| unfold decode | |
| rw [β hn,Int.mul_ediv_cancel_left _ hDn] | |
| simp | |
| simpa only [hid] using And.intro hn1 (And.intro hnY hn) | |
| theorem reference_rpow {P Y R q : β} (hP : 1 < P) | |
| (hY : 0 < Y) (hR : 0 < R) (hq : 0 < q) : | |
| P ^ lengthExponent P Y R q = referenceLength Y R q := by | |
| have hJ : 0 < referenceLength Y R q := div_pos hY (mul_pos hR hq) | |
| rw [lengthExponent,Real.rpow_def_of_pos (by linarith : 0 < P)] | |
| rw [mul_div_cancelβ _ (Real.log_pos hP).ne'] | |
| exact Real.exp_log hJ | |
| end ErdosCommonMInterval | |
| namespace ErdosCommonMInterval | |
| open ErdosCommonParameterInterval | |
| theorem endpoint_magnitude {A D Y q : β} (hD : 0 β€ D) (hY : 0 β€ Y) (hq : 0 < q) : | |
| |-A/q|+|(D*Y-A)/q| β€ (D*Y+2*|A|)/q := by | |
| rw [abs_div,abs_div,abs_of_pos hq,abs_neg,β add_div] | |
| apply div_le_div_of_nonneg_right _ hq.le | |
| have h : |D*Y-A| β€ |D*Y|+|A| := by | |
| simpa only [sub_zero, zero_sub, abs_neg] using abs_sub_le (D*Y) 0 A | |
| rw [abs_of_nonneg (mul_nonneg hD hY)] at h | |
| linarith | |
| theorem closed_length_lower {A D Y q R T H e : β} | |
| (hD : 1 β€ D) (hY : 0 < Y) (hq : 0 < q) (hR : 0 < R) (hRT : R β€ T) | |
| (hH : 0 β€ H) (he : 0 β€ e) (hwidth : T β€ (1+e)*R) (hA : |A| β€ Y*H) : | |
| (1-2*e*(1+H))*D*referenceLength Y R q-1 β€ | |
| upper A D Y q R T-lower A q R T := by | |
| have hT : 0 < T := hR.trans_le hRT | |
| have hD0 : 0 < D := by linarith | |
| have hd0 : 0 β€ 1/R-1/T := sub_nonneg.mpr (one_div_le_one_div_of_le hR hRT) | |
| have hd := (reciprocal_width_bound hR hRT hwidth).trans | |
| (div_le_div_of_nonneg_left he hR hRT) | |
| have hmag := endpoint_magnitude (A := A) hD0.le hY.le hq | |
| have hbase : (D*Y-A)/q-(-A/q) = D*Y/q := by ring | |
| have hnorm : D*Y/q+|-A/q|+|(D*Y-A)/q| β€ 2*D*Y*(1+H)/q := by | |
| have hDH : Y*H β€ D*Y*H := by nlinarith [mul_nonneg hY.le hH] | |
| have : (D*Y+2*|A|)/q β€ (D*Y+2*D*Y*H)/q := | |
| div_le_div_of_nonneg_right (by linarith) hq.le | |
| calc | |
| _ β€ D*Y/q+(D*Y+2*D*Y*H)/q := by linarith | |
| _ = _ := by ring | |
| have hnorm0 : 0 β€ D*Y/q+|-A/q|+|(D*Y-A)/q| := by positivity | |
| have hprod := mul_le_mul hnorm hd hd0 (by positivity : 0 β€ 2*D*Y*(1+H)/q) | |
| have hf := common_length_lower (-A/q) ((D*Y-A)/q) hR hRT | |
| rw [hbase] at hf | |
| have heq : (D*Y/q)/T-(|-A/q|+|(D*Y-A)/q|)*(1/R-1/T) = | |
| D*Y/(R*q)-(D*Y/q+|-A/q|+|(D*Y-A)/q|)*(1/R-1/T) := by ring | |
| rw [heq] at hf | |
| dsimp [upper,lower,referenceLength] | |
| have heq2 : D*Y/(R*q)-(2*D*Y*(1+H)/q)*(e/R) = | |
| (1-2*e*(1+H))*D*(Y/(R*q)) := by ring | |
| linarith | |
| theorem closed_length_upper (A D Y q R T : β) : | |
| upper A D Y q R T-lower A q R T β€ D*referenceLength Y R q-1 := by | |
| have hU : upper A D Y q R T β€ ((D*Y-A)/q)/R := min_le_left _ _ | |
| have hL : (-A/q)/R+1 β€ lower A q R T := by | |
| have h : (-A/q)/R β€ ErdosCommonParameterInterval.commonLower (-A/q) R T := le_max_left _ _ | |
| dsimp [lower];linarith | |
| have heq : ((D*Y-A)/q)/R-((-A/q)/R+1)=D*referenceLength Y R q-1 := by | |
| dsimp [referenceLength];ring | |
| linarith | |
| theorem closed_height {A D Y q R T H m : β} | |
| (hD : 0 β€ D) (hY : 0 < Y) (hq : 0 < q) (hR : 0 < R) | |
| (hA : |A| β€ Y*H) (hm : m β interval A D Y q R T) : | |
| |m| β€ (D+H)*referenceLength Y R q := by | |
| have hb := common_height_bound (-A/q) ((D*Y-A)/q) m hR | |
| (closed_subset A D Y q R T hm) | |
| have ha : |-A/q| β€ (D*Y+Y*H)/q := by | |
| rw [abs_div,abs_neg,abs_of_pos hq] | |
| exact div_le_div_of_nonneg_right (by nlinarith) hq.le | |
| have hc : |(D*Y-A)/q| β€ (D*Y+Y*H)/q := by | |
| rw [abs_div,abs_of_pos hq] | |
| apply div_le_div_of_nonneg_right _ hq.le | |
| have h : |D*Y-A| β€ |D*Y|+|A| := by | |
| simpa only [sub_zero, zero_sub, abs_neg] using abs_sub_le (D*Y) 0 A | |
| rw [abs_of_nonneg (mul_nonneg hD hY.le)] at h | |
| linarith | |
| calc | |
| _ β€ max |-A/q| |(D*Y-A)/q|/R := hb | |
| _ β€ ((D*Y+Y*H)/q)/R := div_le_div_of_nonneg_right (max_le ha hc) hR.le | |
| _ = _ := by dsimp [referenceLength];ring | |
| end ErdosCommonMInterval | |
| section | |
| open _root_.Filter | |
| open scoped Topology | |
| namespace ErdosCommonMInterval | |
| theorem eventual_polynomial_cutoff (B K : β) (hB : 0 β€ B) (hK : 0 < K) : | |
| βαΆ w : β in atTop, 2 β€ w β§ w^B β€ Real.exp (K*(Real.log w)^3) := by | |
| filter_upwards [eventually_ge_atTop (2 : β), | |
| Real.tendsto_log_atTop.eventually_ge_atTop (max 1 (B/K))] with w hw hL | |
| have hw0 : 0 < w := by linarith | |
| have hL1 : 1 β€ Real.log w := (le_max_left _ _).trans hL | |
| have hBL : B β€ K*Real.log w := by | |
| have := (div_le_iffβ hK).mp (show B/K β€ Real.log w from (le_max_right _ _).trans hL) | |
| nlinarith | |
| refine β¨hw, ?_β© | |
| rw [Real.rpow_def_of_pos hw0] | |
| apply Real.exp_le_exp.mpr | |
| have hsq : Real.log w β€ (Real.log w)^2 := by nlinarith | |
| have hpow : (Real.log w)^2 β€ (Real.log w)^3 := by nlinarith | |
| nlinarith [mul_le_mul_of_nonneg_right hBL (by linarith : 0 β€ Real.log w)] | |
| theorem subbin_loss {w C : β} (hw : 1 β€ w) (hC : 0 β€ C) : | |
| 2*w^(-2*C-10)*(1+w^(C+2)) β€ 4*w^(-8 : β) := by | |
| have hw0 : 0 < w := by linarith | |
| have hH : 1 β€ w^(C+2) := Real.one_le_rpow hw (by linarith) | |
| have hmul : w^(-2*C-10)*w^(C+2) = w^(-C-8) := by | |
| rw [β Real.rpow_add hw0];congr 1;ring | |
| have hcmp : w^(-C-8) β€ w^(-8 : β) := Real.rpow_le_rpow_of_exponent_le hw (by linarith) | |
| have hnon : 0 β€ w^(-2*C-10) := Real.rpow_nonneg hw0.le _ | |
| have hle : w^(-2*C-10) β€ w^(-2*C-10)*w^(C+2) := by nlinarith | |
| nlinarith | |
| theorem height_absorption {w P C : β} (hw : 2 β€ w) | |
| (hP : w^(50*(C+3)) β€ P) : 2*w^(C+2) β€ P^((2 : β)/100) := by | |
| have hw0 : 0 < w := by linarith | |
| have h1 : 2*w^(C+2) β€ w^(C+3) := by | |
| have he : w^(C+3)=w*w^(C+2) := by | |
| calc w^(C+3) = w^((1 : β)+(C+2)) := by congr 1;ring | |
| _ = w*w^(C+2) := by rw [Real.rpow_add hw0,Real.rpow_one] | |
| rw [he] | |
| exact mul_le_mul_of_nonneg_right hw (Real.rpow_nonneg hw0.le _) | |
| have h2 := Real.rpow_le_rpow (Real.rpow_nonneg hw0.le (50*(C+3))) hP | |
| (by norm_num : (0 : β) β€ 2/100) | |
| have he : (w^(50*(C+3)))^((2 : β)/100)=w^(C+3) := by | |
| rw [β Real.rpow_mul hw0.le];congr 1;ring | |
| exact h1.trans (by rwa [he] at h2) | |
| noncomputable def relativeError (w : β) : β := 4*w^(-8 : β)+w^(-2 : β) | |
| theorem relativeError_tends_zero : Tendsto relativeError atTop (π 0) := by | |
| have h8 := tendsto_rpow_neg_atTop (by norm_num : (0 : β) < 8) | |
| have h2 := tendsto_rpow_neg_atTop (by norm_num : (0 : β) < 2) | |
| change Tendsto (fun w : β => 4*w^(-8 : β)+w^(-2 : β)) atTop (π 0) | |
| simpa only [mul_zero,add_zero] using (h8.const_mul 4).add h2 | |
| theorem uniform_common_interval (C K delta : β) (hC : 0 β€ C) (hK : 0 < K) | |
| (hd0 : 0 < delta) (hd1 : delta < 1) : | |
| β W : β, β w : β, W β€ w β β P A D Y q R T : β, | |
| Real.exp (K*(Real.log w)^3) β€ P β | |
| 1 β€ D β D β€ w^C β 0 < Y β 0 < q β 0 < R β R β€ T β | |
| T β€ (1+w^(-2*C-10))*R β |A| β€ Y*w^(C+2) β | |
| 2 β€ lengthExponent P Y R q β | |
| (1-delta)*D*referenceLength Y R q β€ upper A D Y q R T-lower A q R T β§ | |
| upper A D Y q R T-lower A q R T β€ D*referenceLength Y R q β§ | |
| (interval A D Y q R T).Nonempty β§ | |
| β m β interval A D Y q R T, |m| β€ P^(lengthExponent P Y R q+(2 : β)/100) := by | |
| have hE := relativeError_tends_zero.eventually (gt_mem_nhds hd0) | |
| have hpoly := eventual_polynomial_cutoff (50*(C+3)) K (by positivity) hK | |
| obtain β¨W,hWβ© := eventually_atTop.mp (hE.and hpoly) | |
| refine β¨W, ?_β© | |
| intro w hw P A D Y q R T hP hD hDu hY hq hR hRT hwidth hA hs | |
| obtain β¨hErr,hw2,hpowβ© := hW w hw | |
| have hw0 : 0 < w := by linarith | |
| have hw1 : 1 β€ w := by linarith | |
| have hwpow : w β€ w^(50*(C+3)) := by | |
| calc w = w^(1 : β) := (Real.rpow_one _).symm | |
| _ β€ _ := Real.rpow_le_rpow_of_exponent_le hw1 (by nlinarith) | |
| have hwP : w β€ P := hwpow.trans (hpow.trans hP) | |
| have hP1 : 1 < P := by linarith | |
| have hD0 : 0 < D := by linarith | |
| have hJ : 0 < referenceLength Y R q := div_pos hY (mul_pos hR hq) | |
| have hJid := reference_rpow hP1 hY hR hq | |
| have hJlow : P^2 β€ referenceLength Y R q := by | |
| rw [β hJid] | |
| simpa only [Real.rpow_ofNat] using Real.rpow_le_rpow_of_exponent_le hP1.le hs | |
| have hJw : w^2 β€ referenceLength Y R q := by nlinarith | |
| have hpay : 1 β€ w^(-2 : β)*D*referenceLength Y R q := by | |
| have hid : w^(-2 : β)*w^2=1 := by | |
| rw [β Real.rpow_ofNat,β Real.rpow_add hw0];norm_num | |
| have hn : 0 β€ w^(-2 : β) := Real.rpow_nonneg hw0.le _ | |
| have hm : w^2 β€ D*referenceLength Y R q := by nlinarith | |
| have := mul_le_mul_of_nonneg_left hm hn | |
| nlinarith | |
| have hraw := closed_length_lower hD hY hq hR hRT | |
| (Real.rpow_nonneg hw0.le (C+2)) (Real.rpow_nonneg hw0.le (-2*C-10)) hwidth hA | |
| have hcost := subbin_loss hw1 hC | |
| have hlen : (1-delta)*D*referenceLength Y R q β€ | |
| upper A D Y q R T-lower A q R T := by | |
| have hmul := mul_le_mul_of_nonneg_right hcost (mul_pos hD0 hJ).le | |
| have herrmul := mul_le_mul_of_nonneg_right hErr.le (mul_pos hD0 hJ).le | |
| dsimp [relativeError] at herrmul | |
| nlinarith | |
| refine β¨hlen, (closed_length_upper A D Y q R T).trans (by linarith), ?_, ?_β© | |
| Β· apply Set.nonempty_Icc.mpr | |
| have := mul_pos (mul_pos (by linarith : 0 < 1-delta) hD0) hJ | |
| linarith | |
| Β· intro m hm | |
| have hheight := closed_height hD0.le hY hq hR hA hm | |
| have hDC : D β€ w^(C+2) := hDu.trans | |
| (Real.rpow_le_rpow_of_exponent_le hw1 (by linarith)) | |
| have habs := height_absorption hw2 (hpow.trans hP) | |
| have hp02 : D+w^(C+2) β€ P^((2 : β)/100) := by linarith | |
| calc | |
| |m| β€ (D+w^(C+2))*referenceLength Y R q := hheight | |
| _ β€ P^((2 : β)/100)*referenceLength Y R q := mul_le_mul_of_nonneg_right hp02 hJ.le | |
| _ = P^(lengthExponent P Y R q+(2 : β)/100) := by | |
| rw [β hJid,β Real.rpow_add (by linarith : 0 < P)];congr 1;ring | |
| theorem uniform_integer_common_interval (C K delta : β) (hC : 0 β€ C) (hK : 0 < K) | |
| (hd0 : 0 < delta) (hd1 : delta < 1) : | |
| β W : β, β w : β, W β€ w β β P R T : β, β A : β€, β D Y q : β, | |
| Real.exp (K*(Real.log w)^3) β€ P β | |
| 0 < D β (D : β) β€ w^C β 0 < Y β 0 < q β 0 < R β R β€ T β | |
| T β€ (1+w^(-2*C-10))*R β |(A : β)| β€ (Y : β)*w^(C+2) β | |
| 2 β€ lengthExponent P Y R q β | |
| (1-delta)*(D : β)*referenceLength Y R q β€ upper A D Y q R T-lower A q R T β§ | |
| upper A D Y q R T-lower A q R T β€ (D : β)*referenceLength Y R q β§ | |
| (interval A D Y q R T).Nonempty β§ | |
| (β m β interval A D Y q R T, |m| β€ P^(lengthExponent P Y R q+(2 : β)/100)) β§ | |
| β p : β, β m : β€, R β€ (p : β) β (p : β) β€ T β | |
| (m : β) β interval A D Y q R T β (D : β€) β£ A+(p : β€)*q*m β | |
| 1 β€ decode A m D q p β§ decode A m D q p β€ Y β§ | |
| (D : β€)*decode A m D q p=A+(p : β€)*q*m := by | |
| obtain β¨W,hWβ© := uniform_common_interval C K delta hC hK hd0 hd1 | |
| refine β¨W, ?_β© | |
| intro w hw P R T A D Y q hP hD hDu hY hq hR hRT hwidth hA hs | |
| have hb := hW w hw P A D Y q R T hP | |
| (by exact_mod_cast (show 1 β€ D from hD)) hDu | |
| (by exact_mod_cast hY) (by exact_mod_cast hq) hR hRT hwidth hA hs | |
| refine β¨hb.1,hb.2.1,hb.2.2.1,hb.2.2.2,?_β© | |
| intro p m hRp hpT hm hdvd | |
| exact decode_spec hD hq hR hRp hpT hm hdvd | |
| end ErdosCommonMInterval | |
| end | |
| namespace ErdosLargeHeightBlocks | |
| noncomputable def blockLeft (C0 : β€) (R xi : β) (H i : β) : β := | |
| ErdosTagSubbins.left R xi (blockCount C0 R xi H) i | |
| noncomputable def blockRight (C0 : β€) (R xi : β) (H i : β) : β := | |
| ErdosTagSubbins.right R xi (blockCount C0 R xi H) i | |
| theorem block_reciprocal_variation (C0 : β€) (R xi : β) (H i : β) | |
| (hR : 0 < R) (hxi : 0 < xi) (hH : 0 < H) : | |
| |(C0 : β)/blockLeft C0 R xi H i-(C0 : β)/blockRight C0 R xi H i| β€ (H : β) := by | |
| let N := blockCount C0 R xi H | |
| let a := blockLeft C0 R xi H i | |
| let b := blockRight C0 R xi H i | |
| have hN : 0 < N := blockCount_pos C0 R xi H | |
| have hNr : (0 : β) < N := by exact_mod_cast hN | |
| have hHr : (0 : β) < H := by exact_mod_cast hH | |
| have hs := ErdosTagSubbins.step_pos hR hxi hN | |
| have ha : R β€ a := ErdosTagSubbins.left_lower hs.le | |
| have hab : a < b := ErdosTagSubbins.left_lt_right hR hxi hN | |
| have hb : R β€ b := ha.trans hab.le | |
| have ha0 : 0 < a := hR.trans_le ha | |
| have hb0 : 0 < b := hR.trans_le hb | |
| have hd : b-a = ErdosTagSubbins.step R xi N := ErdosTagSubbins.right_sub_left R xi N i | |
| have hden : R^2 β€ a*b := by | |
| simpa only [pow_two] using mul_le_mul ha hb hR.le ha0.le | |
| have he : (C0 : β)/a-(C0 : β)/b=(C0 : β)*(b-a)/(a*b) := by | |
| field_simp | |
| have hcount := (div_le_iffβ (mul_pos hR hHr)).mp (blockCount_lower C0 R xi H) | |
| change |(C0 : β)/a-(C0 : β)/b| β€ (H : β) | |
| rw [he,abs_div,abs_mul,abs_of_nonneg (sub_nonneg.mpr hab.le),abs_of_pos (mul_pos ha0 hb0)] | |
| calc | |
| _ β€ |(C0 : β)| * (b-a)/R^2 := | |
| div_le_div_of_nonneg_left (mul_nonneg (abs_nonneg _) (sub_nonneg.mpr hab.le)) (sq_pos_of_pos hR) hden | |
| _ = xi*|(C0 : β)|/(R*(N : β)) := by | |
| rw [hd] | |
| dsimp [ErdosTagSubbins.step] | |
| field_simp | |
| _ β€ _ := by | |
| apply (div_le_iffβ (mul_pos hR hNr)).mpr | |
| change xi*|(C0 : β)| β€ (N : β)*(R*(H : β)) at hcount | |
| nlinarith | |
| noncomputable def coordinateLower (C0 : β€) (R xi : β) (H i : β) : β := | |
| min ((C0 : β)/blockLeft C0 R xi H i) ((C0 : β)/blockRight C0 R xi H i) | |
| noncomputable def coordinateUpper (C0 : β€) (R xi : β) (H i : β) : β := | |
| max ((C0 : β)/blockLeft C0 R xi H i) ((C0 : β)/blockRight C0 R xi H i)+(H : β) | |
| theorem block_coordinate_containment (C0 : β€) (R xi : β) (H i : β) | |
| (hR : 0 < R) (hxi : 0 < xi) (p m : β) | |
| (hpL : blockLeft C0 R xi H i β€ p) (hpU : p β€ blockRight C0 R xi H i) | |
| (hmL : (C0 : β)/p β€ m) (hmU : m < (C0 : β)/p+(H : β)) : | |
| m β Set.Ico (coordinateLower C0 R xi H i) (coordinateUpper C0 R xi H i) := by | |
| have hL : 0 < blockLeft C0 R xi H i := | |
| ErdosTagSubbins.left_pos hR hxi (blockCount_pos C0 R xi H) | |
| have hb := ErdosCommonParameterInterval.div_between_endpoints (C0 : β) hL hpL hpU | |
| refine β¨hb.1.trans hmL,?_β© | |
| dsimp only [coordinateUpper] | |
| linarith [hb.2] | |
| theorem block_coordinate_width (C0 : β€) (R xi : β) (H i : β) | |
| (hR : 0 < R) (hxi : 0 < xi) (hH : 0 < H) : | |
| coordinateUpper C0 R xi H i-coordinateLower C0 R xi H i β€ 2*(H : β) := by | |
| have hv := block_reciprocal_variation C0 R xi H i hR hxi hH | |
| have he (x y : β) : max x y-min x y=|x-y| := by | |
| rw [max_sub_min_eq_abs,abs_sub_comm] | |
| dsimp [coordinateUpper,coordinateLower] | |
| rw [show max ((C0 : β)/blockLeft C0 R xi H i) ((C0 : β)/blockRight C0 R xi H i)+(H : β)- | |
| min ((C0 : β)/blockLeft C0 R xi H i) ((C0 : β)/blockRight C0 R xi H i) = | |
| (max ((C0 : β)/blockLeft C0 R xi H i) ((C0 : β)/blockRight C0 R xi H i)- | |
| min ((C0 : β)/blockLeft C0 R xi H i) ((C0 : β)/blockRight C0 R xi H i))+(H : β) by ring, | |
| he] | |
| linarith | |
| end ErdosLargeHeightBlocks | |
| namespace ErdosStoppedArithmetic | |
| open ErdosCommonMInterval ErdosAlignedProgression | |
| theorem common_slice_mem_parameter (Y q p : β) (r : β) (R T : β) (m : β€) | |
| (hq : 0 < q) (hR : 0 < R) (hRp : R β€ (p : β)) (hpT : (p : β) β€ T) | |
| (hm : (m : β) β interval r.num r.den Y q R T) | |
| (hdiv : (r.den : β€) β£ r.num+((p*q : β) : β€)*m) : | |
| m β parameterInterval Y r (p*q) := by | |
| have hp : 0 < p := by exact_mod_cast hR.trans_le hRp | |
| have hdiv' : (r.den : β€) β£ r.num+(p : β€)*q*m := by | |
| simpa only [Nat.cast_mul] using hdiv | |
| obtain β¨n,hn,hY,heβ© := integer_decode r.den_pos hq hR hRp hpT hm hdiv' | |
| apply (mem_parameterInterval Y r (p*q) (Nat.mul_pos hp hq) m).mpr | |
| have hD : (0 : β€) β€ r.den := Int.natCast_nonneg _ | |
| have hn' : (1 : β€) β€ n := by exact_mod_cast hn | |
| have hY' : (n : β€) β€ Y := by exact_mod_cast hY | |
| have hlo := mul_le_mul_of_nonneg_left hn' hD | |
| have hhi := mul_le_mul_of_nonneg_left hY' hD | |
| simp only [mul_one,he] at hlo hhi | |
| simpa only [Nat.cast_mul] using And.intro hlo hhi | |
| theorem common_slice_endpoint_height (w Cs P R T : β) (A : β€) (D Y q : β) | |
| (hw : 1 β€ w) (hP : 1 < P) (hDw : (D : β) β€ w^Cs) | |
| (hY : 0 < Y) (hq : 0 < q) (hR : 0 < R) | |
| (hA : |(A : β)| β€ (Y : β)*w^(Cs+2)) | |
| (hne : (interval A D Y q R T).Nonempty) : | |
| max |lower A q R T| |upper A D Y q R T| β€ | |
| 2*w^(Cs+2)*P^(lengthExponent P Y R q) := by | |
| have hY' : (0 : β) < Y := by exact_mod_cast hY | |
| have hq' : (0 : β) < q := by exact_mod_cast hq | |
| have hD' : (0 : β) β€ D := Nat.cast_nonneg _ | |
| have hEnds : lower A q R T β€ upper A D Y q R T := Set.nonempty_Icc.mp hne | |
| have hLo := closed_height hD' hY' hq' hR hA | |
| (show lower A q R T β interval A D Y q R T from β¨le_rfl,hEndsβ©) | |
| have hHi := closed_height hD' hY' hq' hR hA | |
| (show upper A D Y q R T β interval A D Y q R T from β¨hEnds,le_rflβ©) | |
| have hDC : (D : β) β€ w^(Cs+2) := hDw.trans | |
| (Real.rpow_le_rpow_of_exponent_le hw (by linarith)) | |
| have hJ : 0 β€ referenceLength Y R q := (div_pos hY' (mul_pos hR hq')).le | |
| have hBound := mul_le_mul_of_nonneg_right | |
| (show (D : β)+w^(Cs+2) β€ 2*w^(Cs+2) by linarith) hJ | |
| rw [reference_rpow hP hY' hR hq'] | |
| exact (max_le hLo hHi).trans (by simpa only [mul_assoc] using hBound) | |
| end ErdosStoppedArithmetic | |
| end Erdos970 | |
| end OAI | |