Documentation

CslibFrontier.Computability.Complexity.Classes.PCP.Robustness

Robustness of the PCP class definition (Arora–Barak Chapter 18, Problems §1–§2) #

Cslib.Complexity.PCPWith c s r q enc generalizes Cslib.Complexity.PCP r q enc to arbitrary real completeness threshold c ("accept with probability ≥ c") and soundness threshold s ("accept with probability ≤ s"), leaving PCP definitionally unchanged and satisfying PCPWith 1 (1 / 2) r q enc = PCP r q enc (Cslib.Complexity.PCPWith_one_half).

  1. Arbitrary soundness constant (Cslib.Complexity.PCPWith_one, Arora–Barak Ch. 18 Problem 1): for all r q : ℕ → ℕ and every constant 0 < s < 1, PCPWith 1 s r q enc = PCP r q enc. Independent k-fold repetition (Cslib.Complexity.PCPVerifier.repeatAll) multiplies the number of random bits and queries by k and raises the acceptance probability to the k-th power (Cslib.Complexity.PCPVerifier.acceptProb_repeatAll). Because a verifier's binary coin count V.coins a may exceed the length of a malformed random string ρ when r is superpolynomial, PCPVerifier.repeatRowWidth caps the per-round row width by ρ.length; on every valid random string of length k * V.coins a (k ≥ 1) this cap equals V.coins a.
  2. Imperfect completeness at logarithmic randomness and constant query complexity (Cslib.Complexity.PCPWith_log_const, Arora–Barak Ch. 18 Problem 2, corrected): as printed in Arora and Barak ("completeness c > 1 / 2 does not change PCP(r, q)" for all r, q), the claim would imply BPP = coRP at q ≡ 0 and polynomial r. Under logarithmic randomness r(n) = ⌊log₂ n⌋ + 1, every completeness threshold c > 1 / 2 and arbitrary query bound q lies in NP (Cslib.Complexity.PCPWith_log_subset_NP) by counting accepted random words on a first-occurrence query table (PCPVerifier.tableAcceptCount, PCPVerifier.majorityTableVerifier). Combining with the PCP theorem (Cslib.Complexity.NP_eq_PCP_log) gives PCPWith c (1 / 2) (fun n => Nat.log 2 n + 1) (fun _ => q) enc = PCP (fun n => Nat.log 2 n + 1) (fun _ => q) enc for every constant q ≥ 1 and 1 / 2 < c ≤ 1.

Main definitions #

Main results #

References #

theorem Cslib.Complexity.PCPVerifier.getD_answers_idxOf (π : List Bool) {addresses : List ℕ} {addr : ℕ} (haddr : addr ∈ addresses) :
(answers π addresses).getD (List.idxOf addr addresses) false = π.getD addr false

Looking up the first occurrence of a queried address in answers π addresses recovers the bit of π at that address.

The number of random strings of length V.coins a on which V accepts (a, π).

noncomputable def Cslib.Complexity.PCPVerifier.acceptProb {α : Type} (V : PCPVerifier α) (a : α) (π : List Bool) :

The acceptance probability of V on instance a and proof π over a uniform random string of length V.coins a.

V.acceptProb a π is the real probability that V.accepts a π returns true under BitString.uniformList (V.coins a).

theorem Cslib.Complexity.PCPVerifier.acceptCount_eq_two_pow_iff {α : Type} (V : PCPVerifier α) (a : α) (π : List Bool) :
V.acceptCount a π = 2 ^ V.coins a ↔ ∀ (ρ : List Bool), ρ.length = V.coins a → V.accepts a π ρ = true

Every random string of length V.coins a is accepted if and only if V.acceptCount a π equals 2 ^ V.coins a.

theorem Cslib.Complexity.PCPVerifier.one_le_acceptProb_iff {α : Type} (V : PCPVerifier α) (a : α) (π : List Bool) :
1 ≤ V.acceptProb a π ↔ ∀ (ρ : List Bool), ρ.length = V.coins a → V.accepts a π ρ = true

Acceptance probability at least 1 is equivalent to accepting every random string of length V.coins a.

theorem Cslib.Complexity.PCPVerifier.acceptProb_le_half_iff {α : Type} (V : PCPVerifier α) (a : α) (π : List Bool) :
V.acceptProb a π ≤ 1 / 2 ↔ 2 * V.acceptCount a π ≤ 2 ^ V.coins a

Acceptance probability at most 1 / 2 is equivalent to 2 * V.acceptCount a π ≤ 2 ^ V.coins a.

structure Cslib.Complexity.IsPCPVerifierWith {α : Type} (enc : α ↪ List Bool) (c s : ℝ) (r q : ℕ → ℕ) (V : PCPVerifier α) (A : Set α) :

V is a verifier for A with completeness c ∈ ℝ and soundness s ∈ ℝ, using at most r n random bits and at most q n queries on instances whose encoding has length n: every member of A has a proof accepted with probability at least c, and for every non-member, every proof is accepted with probability at most s over a uniform random string of length V.coins a.

  • coins_le (a : α) : V.coins a ≤ r (enc a).length

    At most r n random bits on an instance whose encoding has length n.

  • length_queries_le (a : α) (ρ : List Bool) : ρ.length = V.coins a → (V.queries (a, ρ)).length ≤ q (enc a).length

    At most q n queries on an instance whose encoding has length n.

  • complete (a : α) : a ∈ A → ∃ (π : List Bool), c ≤ V.acceptProb a π

    Completeness: every member of A has a proof accepted with probability at least c.

  • sound (a : α) : a ∉ A → ∀ (π : List Bool), V.acceptProb a π ≤ s

    Soundness: on a non-member, every proof is accepted with probability at most s.

def Cslib.Complexity.PCPWith {α : Type} (c s : ℝ) (r q : ℕ → ℕ) (enc : α ↪ List Bool) :
Set (Set α)

The class PCP_{c, s}(r, q) with respect to the encoding enc of instances: the problems with a polynomial-time verifier with completeness c and soundness s using O(r n) random bits and O(q n) queries on instances whose encoding has length n Arora and Barak, Chapter 18, Problems §1–§2.

theorem Cslib.Complexity.mem_PCPWith {α : Type} {enc : α ↪ List Bool} {c s : ℝ} {r q : ℕ → ℕ} {A : Set α} :
A ∈ PCPWith c s r q enc ↔ ∃ (V : PCPVerifier α) (c_r : ℕ) (c_q : ℕ), PCPVerifier.PolyTime enc V ∧ IsPCPVerifierWith enc c s (fun (n : ℕ) => c_r * r n) (fun (n : ℕ) => c_q * q n) V A
theorem Cslib.Complexity.isPCPVerifierWith_one_half_iff {α : Type} {enc : α ↪ List Bool} {r q : ℕ → ℕ} {V : PCPVerifier α} {A : Set α} :
IsPCPVerifierWith enc 1 (1 / 2) r q V A ↔ IsPCPVerifier enc r q V A

At completeness 1 and soundness 1 / 2, IsPCPVerifierWith is equivalent to IsPCPVerifier.

theorem Cslib.Complexity.PCPWith_one_half {α : Type} {enc : α ↪ List Bool} (r q : ℕ → ℕ) :
PCPWith 1 (1 / 2) r q enc = PCP r q enc

PCPWith 1 (1 / 2) r q enc coincides with PCP r q enc.

theorem Cslib.Complexity.IsPCPVerifierWith.mono_randomness {α : Type} {enc : α ↪ List Bool} {c s : ℝ} {r r' q : ℕ → ℕ} {V : PCPVerifier α} {A : Set α} (hr : ∀ (n : ℕ), r n ≤ r' n) (h : IsPCPVerifierWith enc c s r q V A) :
IsPCPVerifierWith enc c s r' q V A
theorem Cslib.Complexity.IsPCPVerifierWith.mono_queries {α : Type} {enc : α ↪ List Bool} {c s : ℝ} {r q q' : ℕ → ℕ} {V : PCPVerifier α} {A : Set α} (hq : ∀ (n : ℕ), q n ≤ q' n) (h : IsPCPVerifierWith enc c s r q V A) :
IsPCPVerifierWith enc c s r q' V A
theorem Cslib.Complexity.IsPCPVerifierWith.mono_thresholds {α : Type} {enc : α ↪ List Bool} {c c' s s' : ℝ} {r q : ℕ → ℕ} {V : PCPVerifier α} {A : Set α} (hc : c' ≤ c) (hs : s ≤ s') (h : IsPCPVerifierWith enc c s r q V A) :
IsPCPVerifierWith enc c' s' r q V A
theorem Cslib.Complexity.PCPWith_mono_thresholds {α : Type} {enc : α ↪ List Bool} {c c' s s' : ℝ} {r q : ℕ → ℕ} (hc : c' ≤ c) (hs : s ≤ s') :
PCPWith c s r q enc ⊆ PCPWith c' s' r q enc

Lowering completeness or raising soundness gives a larger class.

theorem Cslib.Complexity.PCPWith_mono_randomness {α : Type} {enc : α ↪ List Bool} {c s : ℝ} {r r' q : ℕ → ℕ} (hr : ∀ (n : ℕ), r n ≤ r' n) :
PCPWith c s r q enc ⊆ PCPWith c s r' q enc

More randomness gives a larger PCPWith class.

theorem Cslib.Complexity.PCPWith_mono_queries {α : Type} {enc : α ↪ List Bool} {c s : ℝ} {r q q' : ℕ → ℕ} (hq : ∀ (n : ℕ), q n ≤ q' n) :
PCPWith c s r q enc ⊆ PCPWith c s r q' enc

More queries give a larger PCPWith class.

Independent repetition and Arora–Barak Chapter 18, Problem 1 #

The per-round coin width on (a, ρ), capped by ρ.length so that malformed short random strings never pad beyond the input length. On any valid random string of length k * V.coins a (k ≥ 1), this equals V.coins a.

All proof addresses queried across k independent rounds on (a, ρ).

Independent k-fold repetition of a nonadaptive PCP verifier V: runs k independent trials using disjoint coin blocks of width V.coins a and accepts when all k trials accept. Repeated proof queries across or within trials are resolved consistently via first-occurrence lookup in V.repeatQueries k.

@[simp]
theorem Cslib.Complexity.PCPVerifier.coins_repeatAll {α : Type} (V : PCPVerifier α) (k : ℕ) (a : α) :
(V.repeatAll k).coins a = k * V.coins a
theorem Cslib.Complexity.PCPVerifier.repeatRowWidth_of_le {α : Type} (V : PCPVerifier α) {a : α} {ρ : List Bool} (h : V.coins a ≤ ρ.length) :
theorem Cslib.Complexity.PCPVerifier.mem_repeatQueries {α : Type} (V : PCPVerifier α) {k i : ℕ} {a : α} {ρ : List Bool} {addr : ℕ} (hi : i ∈ List.range k) (haddr : addr ∈ V.queries (a, BitString.listRow (V.repeatRowWidth a ρ) i ρ)) :
addr ∈ V.repeatQueries k (a, ρ)
theorem Cslib.Complexity.PCPVerifier.length_queries_repeatAll_le {α : Type} (V : PCPVerifier α) (k : ℕ) {a : α} {ρ : List Bool} {B : ℕ} (hρ : ρ.length = (V.repeatAll k).coins a) (hq : ∀ (word : List Bool), word.length = V.coins a → (V.queries (a, word)).length ≤ B) :
((V.repeatAll k).queries (a, ρ)).length ≤ k * B

If each valid single-round query list has length at most B, then k repetitions on a random string of length k * V.coins a make at most k * B queries.

theorem Cslib.Complexity.PCPVerifier.accepts_repeatAll_eq {α : Type} (V : PCPVerifier α) (k : ℕ) (a : α) (π ρ : List Bool) :
(V.repeatAll k).accepts a π ρ = (List.range k).all fun (i : ℕ) => V.accepts a π (BitString.listRow (V.repeatRowWidth a ρ) i ρ)

First-occurrence lookup in V.repeatQueries k recovers each trial's individual verdict.

theorem Cslib.Complexity.PCPVerifier.accepts_repeatAll {α : Type} (V : PCPVerifier α) (k : ℕ) (a : α) (π ρ : List Bool) (hρ : ρ.length = (V.repeatAll k).coins a) :
(V.repeatAll k).accepts a π ρ = (List.range k).all fun (i : ℕ) => V.accepts a π (BitString.listRow (V.coins a) i ρ)

On any random string of length k * V.coins a, V.repeatAll k accepts iff every coin block of width V.coins a accepts.

theorem Cslib.Complexity.PCPVerifier.acceptProb_repeatAll {α : Type} (V : PCPVerifier α) (k : ℕ) (a : α) (π : List Bool) :
(V.repeatAll k).acceptProb a π = V.acceptProb a π ^ k

Independent k-fold repetition raises the acceptance probability to the k-th power.

theorem Cslib.Complexity.PCPVerifier.polyTime_repeatAll {α : Type} {enc : α ↪ List Bool} {V : PCPVerifier α} (hV : PolyTime enc V) (k : ℕ) :

V.repeatAll k is polynomial-time whenever V is.

theorem Cslib.Complexity.IsPCPVerifierWith.repeatAll {α : Type} {enc : α ↪ List Bool} {c s : ℝ} {r q : ℕ → ℕ} {V : PCPVerifier α} {A : Set α} (hc : 0 ≤ c) (h : IsPCPVerifierWith enc c s r q V A) (k : ℕ) :
IsPCPVerifierWith enc (c ^ k) (s ^ k) (fun (n : ℕ) => k * r n) (fun (n : ℕ) => k * q n) (V.repeatAll k) A

Independent k-fold repetition transforms a (c, s)-verifier with bounds (r, q) into a (c ^ k, s ^ k)-verifier with bounds (k * r, k * q).

theorem Cslib.Complexity.PCPWith_subset_repeatAll {α : Type} {enc : α ↪ List Bool} {c s : ℝ} {r q : ℕ → ℕ} (hc : 0 ≤ c) (k : ℕ) :
PCPWith c s r q enc ⊆ PCPWith (c ^ k) (s ^ k) r q enc

Independent k-fold repetition maps PCPWith c s r q enc into PCPWith (c ^ k) (s ^ k) r q enc.

theorem Cslib.Complexity.PCPWith_one_subset_of_lt_one {α : Type} {enc : α ↪ List Bool} {s s' : ℝ} {r q : ℕ → ℕ} (hs1 : s < 1) (hs' : 0 < s') :
PCPWith 1 s r q enc ⊆ PCPWith 1 s' r q enc

Any soundness constant s < 1 can be amplified below any positive soundness target 0 < s' by constant-fold repetition.

theorem Cslib.Complexity.PCPWith_one {α : Type} {enc : α ↪ List Bool} {s : ℝ} (hs0 : 0 < s) (hs1 : s < 1) (r q : ℕ → ℕ) :
PCPWith 1 s r q enc = PCP r q enc

Arora and Barak, Chapter 18, Problem 1: for all r q : ℕ → ℕ and every soundness constant 0 < s < 1, PCPWith 1 s r q enc = PCP r q enc.

Threshold table verification and Arora–Barak Chapter 18, Problem 2 (corrected) #

Number of random words of length V.coins input.1 on which V accepts using the bit at each queried address's first occurrence in V.queryTable input.1.

theorem Cslib.Complexity.PCPVerifier.tableAcceptCount_answers_append {α : Type} (V : PCPVerifier α) (a : α) (proof padding : List Bool) :
V.tableAcceptCount (a, answers proof (V.queryTable a) ++ padding) = V.acceptCount a proof

A genuine proof supplies a table whose accepted-word count is V.acceptCount a proof; trailing padding is ignored.

Every bit table has the exact same accepted-word count as its expanded proof V.proofOfTable a table.

Exhaustively check whether strictly more than half of the random words of length V.coins input.1 accept using the bit at each address's first table occurrence.

theorem Cslib.Complexity.PCPVerifier.majorityTableVerifier_complete {α : Type} (V : PCPVerifier α) (a : α) (proof padding : List Bool) (h : 1 / 2 < V.acceptProb a proof) :

A proof with acceptance probability strictly above 1 / 2 makes V.majorityTableVerifier accept its query table with arbitrary trailing padding.

Counting accepted random words on a table is polynomial-time under a logarithmic coin bound.

Majority table verification is polynomial-time under a logarithmic coin bound.

theorem Cslib.Complexity.IsPCPVerifierWith.mem_iff_exists_majorityTableVerifier {α : Type} {enc : α ↪ List Bool} {c : ℝ} {r q : ℕ → ℕ} {V : PCPVerifier α} {A : Set α} (hc : 1 / 2 < c) (h : IsPCPVerifierWith enc c (1 / 2) r q V A) (a : α) :
a ∈ A ↔ ∃ (table : List Bool), V.majorityTableVerifier (a, table) = true

For any (c, 1 / 2)-PCP verifier of A with c > 1 / 2, an instance a is in A if and only if some table makes V.majorityTableVerifier accept.

theorem Cslib.Complexity.PCPWith_log_subset_NP {α : Type} {enc : α ↪ List Bool} {c : ℝ} (hc : 1 / 2 < c) (q : ℕ → ℕ) :
PCPWith c (1 / 2) (fun (n : ℕ) => Nat.log 2 n + 1) q enc ⊆ NP enc

Logarithmically many random bits with completeness c > 1 / 2 and soundness 1 / 2 can be checked exhaustively in NP, regardless of the query bound q.

theorem Cslib.Complexity.PCP_log_const {α : Type} {enc : α ↪ List Bool} {q : ℕ} (hq : 1 ≤ q) :
PCP (fun (n : ℕ) => Nat.log 2 n + 1) (fun (x : ℕ) => q) enc = NP enc

For every positive constant q ≥ 1, PCP(log n, q) = NP.

theorem Cslib.Complexity.PCPWith_log_const {α : Type} {enc : α ↪ List Bool} {c : ℝ} {q : ℕ} (hc : 1 / 2 < c) (hc1 : c ≤ 1) (hq : 1 ≤ q) :
PCPWith c (1 / 2) (fun (n : ℕ) => Nat.log 2 n + 1) (fun (x : ℕ) => q) enc = PCP (fun (n : ℕ) => Nat.log 2 n + 1) (fun (x : ℕ) => q) enc

Arora and Barak, Chapter 18, Problem 2 (corrected): for every constant q ≥ 1 and completeness threshold 1 / 2 < c ≤ 1, PCPWith c (1 / 2) (fun n => Nat.log 2 n + 1) (fun _ => q) enc = PCP (fun n => Nat.log 2 n + 1) (fun _ => q) enc.