File size: 6,355 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | import OAI.Combinatorics.FiniteCircle.Primes
namespace OAI
namespace FiniteCircle
open scoped BigOperators List
theorem halfturn_ne_zero {M : β} [NeZero M] (he : M=2*(M/2)) :
((M/2:β) : ZMod M) β 0 := by
intro hz
have hd := (CharP.cast_eq_zero_iff (ZMod M) M (M/2)).mp hz
have hm := NeZero.pos M
have hh : 0 < M/2 := by omega
have hw := Nat.le_of_dvd hh hd
omega
theorem halfturn_supported {M : β} (he : M=2*(M/2)) :
PhaseSupported {2} ((M/2:β) : ZMod M) := by
simp only [PhaseSupported, Finset.prod_singleton, nsmul_eq_mul]
rw [β Nat.cast_mul, β he]
simp
theorem StandingPrimes.mask_tags_ge {h : β} {p : β β β β β}
(hp : StandingPrimes h p) (hh : 4 β€ h) (l : β) : 4 β€ (maskTags h p l).length := by
rw [length_maskTags]
calc
4 β€ h := hh
_ = β _k : Fin h, 1 := by simp
_ β€ _ := Finset.sum_le_sum (fun k _ => hp.positive l k)
theorem StandingPrimes.half_fresh {h : β} {p : β β β β β}
(hp : StandingPrimes h p) (hh : 2 β€ h) (l : β) (hl : l β€ h) : LowerFresh h p l {2} := by
intro j hj hjl k hk
have ht := (hp.atLevel j hj (hjl.trans hl) k).2.1
have hh3 := Nat.pow_le_pow_left hh 3
simp only [Finset.mem_singleton] at hk
omega
theorem mask_long_deficit {n : β} (hn : 1000000 β€ n) (he : n^4=2*(n^4/2))
{p : β β β β β} (hp : StandingPrimes (n^4) p) {R : β} (hR : 0<R)
(v : MaskState (n^4) p (circleSize (n^4) p) (n^4)) :
(maskLength (n^4) p R (circleSize (n^4) p) (n^4):β)/(n:β)^(3*n^4) β€
(deficit (maskWord (n^4) p R (circleSize (n^4) p) (n^4) v)
(maskWord (n^4) p R (circleSize (n^4) p) (n^4)
(shiftMaskState (n^4) p (circleSize (n^4) p) (n^4) v ((circleSize (n^4) p/2 : β) : ZMod (circleSize (n^4) p)))) : β) := by
let h := n^4
let M := circleSize h p
let : NeZero M := β¨hp.circle_pos.ne'β©
have hh : 1000000 β€ h := hn.trans (le_self_powβ (by omega) (by norm_num))
have ht : 2 β€ n^2 := by nlinarith
have hht : h β€ (n^2)^2 := by dsimp [h]; ring_nf; rfl
have hth : 2*n^2 β€ h := by dsimp [h]; nlinarith
have hK : 2 β€ h/100 := by omega
have hbound := mask_denominator_descent ht hht hth hK hp.divides_circle hp.positive
(fun j hj hjh k => (hp.atLevel j hj hjh k).1)
(fun j hj hjh k => (hp.atLevel j hj hjh k).2.1.le)
(fun j hj hjh k => (hp.atLevel j hj hjh k).2.2) hp.level_distinct
h (le_refl _) {2} ((M/2:β) : ZMod M) (by simp; omega)
(by intro q hq; simp only [Finset.mem_singleton] at hq; subst q
exact β¨Nat.prime_two, (show 2β€h by omega).trans (le_self_powβ (by omega) (by norm_num))β©)
(hp.half_fresh (by omega) h (le_refl _))
(halfturn_ne_zero (StandingPrimes.circle_even (h:=h) (p:=p)))
(halfturn_supported (StandingPrimes.circle_even (h:=h) (p:=p)))
simp only [Finset.card_singleton] at hbound
have hsep := mask_separation (StandingPrimes.circle_even (h:=h) (p:=p)) (by omega : 0<h)
hR hp.divides_circle hp.positive (hp.mask_tags_ge (by omega)) h v ((M/2:β) : ZMod M)
have hnum := mask_descent_numeric hn he
have hL : (0:β) β€ maskLength h p R M h := by positivity
have hc : (0:β) β€ 1/((2:β)^h*4) := by positivity
calc
_ = (maskLength h p R M h:β)*(1/(n:β)^(3*h)) := by dsimp [h,M]; ring
_ β€ (maskLength h p R M h:β)*((1/((2:β)^h*4))*descentBound h (h/100) (n^2) 1 h) :=
mul_le_mul_of_nonneg_left hnum hL
_ β€ (1/((2:β)^h*4))*(maskLength h p R M h)*maskCost h p M hp.divides_circle hp.positive h ((M/2:β) : ZMod M) := by
nlinarith [mul_le_mul_of_nonneg_left hbound (mul_nonneg hL hc)]
_ β€ _ := hsep
theorem excluded_long_deficit {n : β} (hn : 1000000 β€ n) (he : n^4=2*(n^4/2))
{p : β β β β β} (hp : StandingPrimes (n^4) p) {R : β} (hR : 0<R)
(v : ExcludedState (n^4) (circleSize (n^4) p) (n^4)) :
(excludedLength (n^4) p R (circleSize (n^4) p) (n^4):β)/(n:β)^(3*n^4) β€
(deficit (excludedWord (n^4) p R (circleSize (n^4) p) (n^4) v)
(excludedWord (n^4) p R (circleSize (n^4) p) (n^4)
(shiftExcludedState (n^4) (circleSize (n^4) p) (n^4) v ((circleSize (n^4) p/2 : β) : ZMod (circleSize (n^4) p)))) : β) := by
let h := n^4
let M := circleSize h p
let : NeZero M := β¨hp.circle_pos.ne'β©
have hh : 1000000 β€ h := hn.trans (le_self_powβ (by omega) (by norm_num))
have ht : 2 β€ n^3 := by nlinarith [Nat.pow_le_pow_left (show 2β€n by omega) 3]
have htt : h β€ n^3*n := by dsimp [h]; ring_nf; rfl
have hsmall : 2*n^3 β€ h := by
have ht := Nat.mul_le_mul_right (n^3) (show 2β€n by omega)
dsimp [h]; nlinarith [show n*n^3=n^4 by ring]
have hbound := excluded_denominator_descent ht (by omega : 1β€n) (le_refl (n^4)) htt hsmall
(by omega : 3β€h/100) hp.divides_circle hp.positive
(fun j hj hjh k => (hp.atLevel j hj hjh k).1)
(fun j hj hjh k => by
have ht := ((hp.excludedPrimes (by omega)).2.2 β¨j-1,by omegaβ© k).2
simpa only [show j-1+1=j by omega] using ht) hp.level_injective hp.level_distinct
h (le_refl _) {2} ((M/2:β) : ZMod M) (by simp; omega)
(by intro q hq; simp only [Finset.mem_singleton] at hq; subst q
exact β¨Nat.prime_two, (show 2β€h by omega).trans (le_self_powβ (by omega) (by norm_num))β©)
(hp.half_fresh (by omega) h (le_refl _))
(halfturn_ne_zero (StandingPrimes.circle_even (h:=h) (p:=p)))
(halfturn_supported (StandingPrimes.circle_even (h:=h) (p:=p)))
simp only [Finset.card_singleton] at hbound
have hsep := excluded_separation (StandingPrimes.circle_even (h:=h) (p:=p)) (by omega : 0<h)
hR hp.divides_circle hp.positive (fun _ => by simp; omega) h v ((M/2:β) : ZMod M)
have hnum := excluded_descent_numeric hn he
have hL : (0:β) β€ excludedLength h p R M h := by positivity
have hc : (0:β) β€ 1/((2:β)^h*4) := by positivity
calc
_ = (excludedLength h p R M h:β)*(1/(n:β)^(3*h)) := by dsimp [h,M]; ring
_ β€ (excludedLength h p R M h:β)*((1/((2:β)^h*4))*pairDescentBound h (h/100) (n^3) n 1 h) :=
mul_le_mul_of_nonneg_left hnum hL
_ β€ (1/((2:β)^h*4))*(excludedLength h p R M h)*excludedCost h p M hp.divides_circle hp.positive h ((M/2:β) : ZMod M) := by
nlinarith [mul_le_mul_of_nonneg_left hbound (mul_nonneg hL hc)]
_ β€ _ := hsep
end FiniteCircle
end OAI
|