File size: 4,381 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 | import Mathlib.Data.Nat.Log
import Mathlib.Basic.Real.Basic
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
namespace OAI
section
/-!
The finite iteration and size arithmetic for an amplification transformation.
The transformation itself must be supplied by the actual graph construction;
these theorems do not assert that such a transformation exists. In particular,
the polynomial size estimate below is not a machine runtime certificate.
-/
namespace UniqueGamesTheorem.Foundations.PCP.AmplificationIteration
def run {X : Type*} (step : X β X) : Nat β X β X
| 0, x => x
| n + 1, x => step (run step n x)
private theorem min_double_min (u cap : β) (hc : 0 β€ cap) :
min (2 * min u cap) cap = min (2 * u) cap := by
by_cases hu : u β€ cap
Β· rw [min_eq_left hu]
Β· have hcu : cap β€ u := le_of_not_ge hu
rw [min_eq_right hcu, min_eq_right (by linarith : cap β€ 2 * cap),
min_eq_right (by linarith : cap β€ 2 * u)]
theorem run_gap {X : Type*} (step : X β X) (gap : X β β)
(cap : β) (hc : 0 β€ cap)
(amplifies : β x, min (2 * gap x) cap β€ gap (step x))
(n : Nat) (x : X) :
min (2 ^ n * gap x) cap β€ gap (run step n x) := by
induction n with
| zero => simp [run]
| succ n ih =>
have hm : min (2 * min (2 ^ n * gap x) cap) cap β€
min (2 * gap (run step n x)) cap :=
min_le_min (mul_le_mul_of_nonneg_left ih (by norm_num)) le_rfl
rw [min_double_min _ _ hc] at hm
have h := hm.trans (amplifies (run step n x))
simpa [run, pow_succ, mul_assoc, mul_left_comm, mul_comm] using h
theorem run_preserves {X : Type*} (step : X β X) (P : X β Prop)
(preserves : β x, P x β P (step x)) (n : Nat) (x : X) (hx : P x) :
P (run step n x) := by
induction n with
| zero => exact hx
| succ n ih => exact preserves _ ih
theorem run_size {X : Type*} (step : X β X) (size : X β Nat) (C : Nat)
(blowup : β x, size (step x) β€ C * size x) (n : Nat) (x : X) :
size (run step n x) β€ C ^ n * size x := by
induction n with
| zero => simp [run]
| succ n ih =>
have h := (blowup (run step n x)).trans (Nat.mul_le_mul_left C ih)
simpa [run, pow_succ, Nat.mul_assoc, Nat.mul_left_comm, Nat.mul_comm] using h
/-- A concrete logarithmic iteration count, including the zero input. -/
def rounds (n : Nat) : Nat := Nat.log2 n + 1
theorem rounds_large (n : Nat) : n < 2 ^ rounds n := by
simpa [rounds, Nat.log2_eq_log_two] using
(Nat.lt_pow_succ_log_self (by decide : 1 < 2) n)
theorem rounds_power_le {n : Nat} (hn : 0 < n) : 2 ^ rounds n β€ 2 * n := by
have h := Nat.pow_log_le_self 2 (Nat.ne_of_gt hn)
simpa [rounds, Nat.log2_eq_log_two, pow_succ, Nat.mul_comm] using
(Nat.mul_le_mul_right 2 h)
/-- The constant blowup raised to the actual iteration count is polynomial in `n`. -/
theorem blowup_rounds_le {C degree n : Nat} (hn : 0 < n) (hC : C β€ 2 ^ degree) :
C ^ rounds n β€ (2 * n) ^ degree := by
calc
C ^ rounds n β€ (2 ^ degree) ^ rounds n := Nat.pow_le_pow_left hC _
_ = (2 ^ rounds n) ^ degree := by
rw [β pow_mul, β pow_mul, Nat.mul_comm degree (rounds n)]
_ β€ (2 * n) ^ degree := Nat.pow_le_pow_left (rounds_power_le hn) _
theorem run_size_polynomial {X : Type*} (step : X β X) (size : X β Nat)
{C degree n : Nat} (hn : 0 < n) (hC : C β€ 2 ^ degree)
(blowup : β x, size (step x) β€ C * size x) (x : X) :
size (run step (rounds n) x) β€ (2 * n) ^ degree * size x :=
(run_size step size C blowup (rounds n) x).trans
(Nat.mul_le_mul_right _ (blowup_rounds_le hn hC))
/-- An inverse-size initial gap reaches the fixed threshold after the concrete loop. -/
theorem run_reaches_cap {X : Type*} (step : X β X) (gap : X β β)
(cap : β) (hc : 0 β€ cap) (hc1 : cap β€ 1)
(amplifies : β x, min (2 * gap x) cap β€ gap (step x))
(n : Nat) (x : X) (hg : 0 β€ gap x) (hstart : 1 β€ (n : β) * gap x) :
cap β€ gap (run step (rounds n) x) := by
have hp : (n : β) β€ (2 : β) ^ rounds n := by
exact_mod_cast (Nat.le_of_lt (rounds_large n))
have hcap : cap β€ (2 : β) ^ rounds n * gap x :=
hc1.trans (hstart.trans (mul_le_mul_of_nonneg_right hp hg))
have h := run_gap step gap cap hc amplifies (rounds n) x
rwa [min_eq_right hcap] at h
end UniqueGamesTheorem.Foundations.PCP.AmplificationIteration
end
end OAI
|