File size: 7,919 Bytes
ea76aac | 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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | import Mathlib
import OAI.Computability.MaxCut.PCP.Occurrences
namespace OAI
namespace MaxCutGames.Foundations.Hastad.SourceBounds
open Target
open MaxCutGames.Reduction
theorem formulaBits_length (F : Formula) :
(Complexity.formulaBits F).length = F.«variables» + F.clauses.length + 2 +
(Complexity.encodeWords (F.clauses.flatMap Complexity.clauseWords)).length := by
simp only [Complexity.formulaBits, Complexity.formulaWords,
Complexity.encodeWords_append, List.length_append, Complexity.encodeWords,
Complexity.encodeWord_length, List.length_nil]
omega
theorem formulaBits_length_ge_variables (F : Formula) :
F.«variables» ≤ (Complexity.formulaBits F).length := by
rw [formulaBits_length]
omega
theorem formulaBits_length_ge_clauses (F : Formula) :
F.clauses.length ≤ (Complexity.formulaBits F).length := by
rw [formulaBits_length]
omega
theorem formulaBits_length_ge_two (F : Formula) :
2 ≤ (Complexity.formulaBits F).length := by
rw [formulaBits_length]
omega
/-- The two padded long-code tables and one global dummy bit. -/
def bitCountFormula (n m u : ℕ) : ℕ :=
n ^ u * 2 ^ (2 ^ u) + m ^ u * 2 ^ (8 ^ u) + 1
/-- Depends on the fixed repetition count alone. -/
def bitCoefficient (u : ℕ) : ℕ := 2 ^ (2 ^ u) + 2 ^ (8 ^ u) + 1
/-- The slot tuples, two queries, and noise tapes per clause tuple.
The empty-context branch uses the global dummy and adds no random tape. -/
def testCoefficient (u D : ℕ) : ℕ :=
3 ^ u * 2 ^ (2 ^ u) * D ^ (8 ^ u) * 2 ^ (8 ^ u)
/-- The total encoding also handles an empty formula with one dummy equation. -/
def occurrenceCoefficient (u D : ℕ) : ℕ := testCoefficient u D + 1
theorem one_le_input_power (F : Formula) (u : ℕ) :
1 ≤ (Complexity.formulaBits F).length ^ u := by
apply Nat.one_le_pow
have h := formulaBits_length_ge_two F
omega
theorem bitCountFormula_le_input (F : Formula) (u : ℕ) :
bitCountFormula F.«variables» F.clauses.length u ≤
bitCoefficient u * (Complexity.formulaBits F).length ^ u := by
have hn := Nat.pow_le_pow_left (formulaBits_length_ge_variables F) u
have hm := Nat.pow_le_pow_left (formulaBits_length_ge_clauses F) u
have hpos := one_le_input_power F u
unfold bitCountFormula bitCoefficient
calc
_ ≤ (Complexity.formulaBits F).length ^ u * 2 ^ (2 ^ u) +
(Complexity.formulaBits F).length ^ u * 2 ^ (8 ^ u) +
(Complexity.formulaBits F).length ^ u :=
Nat.add_le_add
(Nat.add_le_add (Nat.mul_le_mul_right _ hn) (Nat.mul_le_mul_right _ hm)) hpos
_ = _ := by ring
theorem testCountFormula_le_input (F : Formula) (u D : ℕ) :
(F.clauses.length * 3) ^ u * 2 ^ (2 ^ u) * D ^ (8 ^ u) * 2 ^ (8 ^ u) ≤
testCoefficient u D * (Complexity.formulaBits F).length ^ u := by
have hm := Nat.pow_le_pow_left (formulaBits_length_ge_clauses F) u
calc
_ = testCoefficient u D * F.clauses.length ^ u := by
simp only [testCoefficient, Nat.mul_pow]
ring
_ ≤ _ := Nat.mul_le_mul_left _ hm
theorem testCountFormula_add_one_le_input (F : Formula) (u D : ℕ) :
(F.clauses.length * 3) ^ u * 2 ^ (2 ^ u) * D ^ (8 ^ u) * 2 ^ (8 ^ u) + 1 ≤
occurrenceCoefficient u D * (Complexity.formulaBits F).length ^ u := by
calc
_ ≤ testCoefficient u D * (Complexity.formulaBits F).length ^ u +
(Complexity.formulaBits F).length ^ u :=
Nat.add_le_add (testCountFormula_le_input F u D) (one_le_input_power F u)
_ = _ := by simp only [occurrenceCoefficient, Nat.add_mul, Nat.one_mul]
def sourceSizeBound (V E u L : ℕ) : ℕ :=
V * L ^ u + E * L ^ u + 2 + E * L ^ u * (3 * (V * L ^ u) + 2)
theorem sourceBits_length_le (input : SourceEncoding.Input) (V E u L : ℕ)
(hv : input.«variables» ≤ V * L ^ u)
(he : input.equations.length ≤ E * L ^ u) :
(SourceEncoding.inputBits input).length ≤ sourceSizeBound V E u L := by
apply (SourceEncoding.inputBits_length_le input).trans
unfold sourceSizeBound
exact Nat.add_le_add
(Nat.add_le_add_right (Nat.add_le_add hv he) 2)
(Nat.mul_le_mul he (Nat.add_le_add_right (Nat.mul_le_mul_left 3 hv) 2))
/-- One explicit output-length polynomial for each fixed `u,D`. -/
noncomputable def sourcePolynomial (u D : ℕ) : Polynomial ℕ :=
let V := Polynomial.C (bitCoefficient u) * Polynomial.X ^ u
let E := Polynomial.C (occurrenceCoefficient u D) * Polynomial.X ^ u
V + E + Polynomial.C 2 + E * (Polynomial.C 3 * V + Polynomial.C 2)
theorem sourcePolynomial_eval (u D L : ℕ) :
(sourcePolynomial u D).eval L =
sourceSizeBound (bitCoefficient u) (occurrenceCoefficient u D) u L := by
simp [sourcePolynomial, sourceSizeBound]
open SourceOccurrences SourceContexts
/-- Exact cardinality of the actual fixed query/noise tape. -/
theorem card_testTape (u D : ℕ) :
Fintype.card (SourceTape.TestTape (I u) (J u) D) =
2 ^ (2 ^ u) * (D ^ (8 ^ u) * 2 ^ (8 ^ u)) := by
rw [SourceTape.card_testTape, card_I, card_J]
/-- The executable radix enumeration has the same fixed size. -/
theorem testTapeEncoding_size (u D : ℕ) :
(SourceOccurrences.testTapeEncoding u D).size =
2 ^ (2 ^ u) * (D ^ (8 ^ u) * 2 ^ (8 ^ u)) := rfl
/-- Cardinality of the actual complete random-tape population. -/
theorem card_sourceIndex (F : Formula) (u D : ℕ) :
Fintype.card (SourceIndex F u D) =
(F.clauses.length ^ u * 3 ^ u) *
(2 ^ (2 ^ u) * (D ^ (8 ^ u) * 2 ^ (8 ^ u))) := by
rw [(sourceIndexEncoding F u D).card_eq_size]
rfl
/-- Bound on the actual variable count, including padded addresses and dummy. -/
theorem nBits_le_input (F : Formula) (u : ℕ) :
nBits F u ≤ bitCoefficient u * (Complexity.formulaBits F).length ^ u := by
have h := bitCountFormula_le_input F u
simpa only [nBits_eq, bitCountFormula, Nat.add_assoc] using h
/-- Exact list size retains every repeated sampled context and equation. -/
theorem rawSourceList_length_eq (F : Formula) (u D : ℕ) :
(rawSourceList F u D).length = testCoefficient u D * F.clauses.length ^ u := by
rw [rawSourceList_length]
unfold testCoefficient
ac_rfl
theorem rawSourceList_length_le_input (F : Formula) (u D : ℕ) :
(rawSourceList F u D).length ≤
testCoefficient u D * (Complexity.formulaBits F).length ^ u := by
rw [rawSourceList_length_eq]
exact Nat.mul_le_mul_left _
(Nat.pow_le_pow_left (formulaBits_length_ge_clauses F) u)
/-- Bound on the total actual list, also covering the empty-formula branch. -/
theorem sourceList_length_le_input (F : Formula) (u D : ℕ) :
(sourceList F u D).length ≤
occurrenceCoefficient u D * (Complexity.formulaBits F).length ^ u := by
calc
_ ≤ (rawSourceList F u D).length + 1 := sourceList_length_le_raw_add_one F u D
_ ≤ testCoefficient u D * (Complexity.formulaBits F).length ^ u +
(Complexity.formulaBits F).length ^ u :=
Nat.add_le_add (rawSourceList_length_le_input F u D) (one_le_input_power F u)
_ = _ := by simp only [occurrenceCoefficient, Nat.add_mul, Nat.one_mul]
theorem sourceInput_bits_polynomial (F : Formula) (u D : ℕ) (hD : 0 < D) :
(SourceEncoding.inputBits (sourceInput F u D hD)).length ≤
(sourcePolynomial u D).eval (Complexity.formulaBits F).length := by
rw [sourcePolynomial_eval]
exact sourceBits_length_le (sourceInput F u D hD)
(bitCoefficient u) (occurrenceCoefficient u D) u (Complexity.formulaBits F).length
(nBits_le_input F u) (sourceList_length_le_input F u D)
/-- Fixed parameters supply one polynomial uniformly for all actual inputs. -/
theorem fixed_parameters_source_size (u D : ℕ) (hD : 0 < D) :
∃ p : Polynomial ℕ, ∀ F : Formula,
(SourceEncoding.inputBits (sourceInput F u D hD)).length ≤
p.eval (Complexity.formulaBits F).length :=
⟨sourcePolynomial u D, fun F => sourceInput_bits_polynomial F u D hD⟩
end MaxCutGames.Foundations.Hastad.SourceBounds
end OAI
|