Documentation

CslibFrontier.Computability.PCP.Encoded.Witness

Polynomial-time witness and labelling compilers for encoded PCP graphs #

Every transformation in the executable Dinur–Gap-Amplification pipeline preserves satisfying graph labellings constructively and in polynomial time:

Main definitions #

Main results #

References #

Shared list-indexing lemma #

Encodings for the normalized alphabet and amplification state #

@[reducible, inline]

Default symbol of SelectedAlphabet.

@[reducible, inline]

Standard bit-tuple encoding of SelectedAlphabet.

@[reducible, inline]

Encoding of the joint normalized graph and vertex-label list state in amplification loops.

SAT witness to Graph.ofCompactCNF φ.to3CNF labels #

Explicit list of vertex labels for Graph.ofCompactCNF φ.to3CNF from a formula φ and its SAT certificate w: even indices hold compacted variable assignments, odd indices hold clause literal bits.

@[simp]

The compiled label list matches the declared vertex count of Graph.ofCompactCNF φ.to3CNF.

Any SAT.npRelation witness w for φ produces a vertex-label list satisfying every edge of (Graph.ofCompactCNF φ.to3CNF).toGraph id.

Generic and selected assignment-tester composition labels #

def Cslib.PCP.AssignmentTester.Implementation.composeSlotLabel {α I P R Q Γ : Type} (encode : α → I → Γ) (aux : (α → α → Bool) → (Fin 2 → α) → P → Γ) (query : (α → α → Bool) → R → Q → Fin 2 × I ⊕ P) (γ : Γ) (c : α → α → Bool) (vLabel srcLabel dstLabel : α) :
ComposeSlot I P R → Γ × (Q → Γ)

Compute the composed alphabet label of one slot inside owner block owner.

def Cslib.PCP.AssignmentTester.Implementation.composeLabels {α I P R Q Γ : Type} {width : ℕ} (impl : Implementation α I P R Q Γ) (encode : α → I → Γ) (aux : (α → α → Bool) → (Fin 2 → α) → P → Γ) (number : ComposeSlot I P R ≃ Fin width) (default : α) (γ : Γ) (g : Encoded.Graph (α → α → Bool)) (labels : List α) :
List (Γ × (Q → Γ))

Lift a vertex-label list labels along impl.compose / impl.composeTabulated.

@[simp]
theorem Cslib.PCP.AssignmentTester.Implementation.length_composeLabels {α I P R Q Γ : Type} {width : ℕ} (impl : Implementation α I P R Q Γ) (encode : α → I → Γ) (aux : (α → α → Bool) → (Fin 2 → α) → P → Γ) (number : ComposeSlot I P R ≃ Fin width) (default : α) (γ : Γ) (g : Encoded.Graph (α → α → Bool)) (labels : List α) :
(impl.composeLabels encode aux number default γ g labels).length = (g.vertices + g.edges.length) * width

The compiled composition label list matches the declared vertex count of composeTabulated.

theorem Cslib.PCP.AssignmentTester.Implementation.satisfies_composeLabels {α I P R Q Γ : Type} {width : ℕ} (impl : Implementation α I P R Q Γ) {T : AssignmentTester α I P R Q Γ} (hreal : impl.Realizes T) (hcomplete : T.IsComplete) (encode : α → I → Γ) (hencode : T.encode = encode) (aux : (α → α → Bool) → (Fin 2 → α) → P → Γ) (haux : ∀ (c : α → α → Bool) (τ : Fin 2 → α) (p : P), T.auxiliary (fun (a b : α) => c a b = true) τ p = aux c τ p) [BEq Γ] [LawfulBEq Γ] (number : ComposeSlot I P R ≃ Fin width) (coins : List R) (queries : List Q) (hcoins : coins.Nodup) (hqueries : queries.Nodup) (hmemCoins : ∀ (ω : R), ω ∈ coins) (hmemQueries : ∀ (q : Q), q ∈ queries) (default : α) (γ : Γ) {g : Encoded.Graph (α → α → Bool)} (hg : g.WellFormed) {labels : List α} (hsat : ∀ (e : Fin g.edges.length), (g.toGraph id).Satisfies (fun (v : ℕ) => labels.getD v default) e) (defaultOut : Γ × (Q → Γ)) (e : Fin (impl.composeTabulated number coins queries g).edges.length) :
((impl.composeTabulated number coins queries g).toGraph id).Satisfies (fun (v : ℕ) => (impl.composeLabels encode aux number default γ g labels).getD v defaultOut) e

Any label list satisfying (g.toGraph id) lifts to a label list satisfying every edge of (impl.composeTabulated number coins queries g).toGraph id.

theorem Cslib.PCP.AssignmentTester.Implementation.isPolyTime_composeLabels {α I P R Q Γ : Type} {width : ℕ} [Finite α] [Fintype Q] (impl : Implementation α I P R Q Γ) (encode : α → I → Γ) (aux : (α → α → Bool) → (Fin 2 → α) → P → Γ) (number : ComposeSlot I P R ≃ Fin width) (default : α) (γ : Γ) {Input : Type} {input : Input ↪ List Bool} {constraintEncoding : (α → α → Bool) ↪ List Bool} {alphabet : α ↪ List Bool} {gammaEncoding : Γ ↪ List Bool} {graph : Input → Encoded.Graph (α → α → Bool)} {labels : Input → List α} (hgraph : Turing.MultiTapeTM.ComputableInPolyTime graph input (Encoded.Graph.encoding constraintEncoding)) (hlabels : Turing.MultiTapeTM.ComputableInPolyTime labels input (Turing.MultiTapeTM.encList alphabet)) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : Input) => impl.composeLabels encode aux number default γ (graph x) (labels x)) input (Turing.MultiTapeTM.encList (Turing.MultiTapeTM.encPair gammaEncoding (Turing.MultiTapeTM.encPi gammaEncoding)))

Generic composition label compilation is polynomial-time for fixed finite alphabets and slots.

def Cslib.PCP.Encoded.composeSelectedLabels {α : Type} [FinEnum α] (default : α) (g : Graph (α → α → Bool)) (labels : List α) :

Lift a vertex-label list through composeSelectedEnumerated.

@[simp]
theorem Cslib.PCP.Encoded.length_composeSelectedLabels {α : Type} [FinEnum α] (default : α) (g : Graph (α → α → Bool)) (labels : List α) :

The length of composeSelectedLabels equals g.composeSelectedEnumerated.vertices.

theorem Cslib.PCP.Encoded.satisfies_composeSelectedLabels {α : Type} [FinEnum α] (default : α) {g : Graph (α → α → Bool)} (hg : g.WellFormed) {labels : List α} (hsat : ∀ (e : Fin g.edges.length), (g.toGraph id).Satisfies (fun (v : ℕ) => labels.getD v default) e) (e : Fin g.composeSelectedEnumerated.edges.length) :

Satisfying vertex labels lift to satisfying labels of g.composeSelectedEnumerated.

theorem Cslib.PCP.Encoded.isPolyTime_composeSelectedLabels {α Input : Type} [FinEnum α] {input : Input ↪ List Bool} {constraintEncoding : (α → α → Bool) ↪ List Bool} {alphabet : α ↪ List Bool} (default : α) {graph : Input → Graph (α → α → Bool)} {labels : Input → List α} (hgraph : Turing.MultiTapeTM.ComputableInPolyTime graph input (Graph.encoding constraintEncoding)) (hlabels : Turing.MultiTapeTM.ComputableInPolyTime labels input (Turing.MultiTapeTM.encList alphabet)) :

Selected composition label compilation runs in polynomial time.

Powering and preprocessing labels, and iterated amplification #

def Cslib.PCP.Encoded.Graph.powerPreprocessLabels {C α D : Type} (fallback : C) (default : α) (rotate : ℕ × ℕ × D → ℕ × D) (T : ℕ) (g : Graph C) (labels : List α) :

Lift a vertex-label list labels of g to truthful walk-opinion labels on g.powerPreprocess eval fallback rotate T q walks.

@[simp]
theorem Cslib.PCP.Encoded.Graph.length_powerPreprocessLabels {C α D : Type} (fallback : C) (default : α) (rotate : ℕ × ℕ × D → ℕ × D) (T : ℕ) (g : Graph C) (labels : List α) :
(powerPreprocessLabels fallback default rotate T g labels).length = 2 * g.edges.length

The powered label list has one entry per half-edge of g.

theorem Cslib.PCP.Encoded.Graph.satisfies_powerPreprocessLabels {C α D : Type} [DecidableEq α] (g : Graph C) (eval : C → α → α → Bool) (fallback : C) (family : (n : ℕ) → RotationMap (Fin n) D) (rotate : ℕ × ℕ × D → ℕ × D) (hrotate : ∀ (n : ℕ) (v : Fin n) (d : D), rotate (n, ↑v, d) = (↑((family n).rot (v, d)).1, ((family n).rot (v, d)).2)) (T q : ℕ) [NeZero q] (walks : List (PowerLabel D T q)) (hwalks : walks.Nodup) (hmem : ∀ (d : PowerLabel D T q), d ∈ walks) (default : α) {labels : List α} (hsat : ∀ (e : Fin g.edges.length), (g.toGraph eval).Satisfies (fun (v : ℕ) => labels.getD v default) e) (defaultPow : PowerAlphabet D α T) (e : Fin (powerPreprocess eval fallback rotate T q walks g).edges.length) :
((powerPreprocess eval fallback rotate T q walks g).toGraph id).Satisfies (fun (u : ℕ) => (powerPreprocessLabels fallback default rotate T g labels).getD u defaultPow) e

Satisfying vertex labels lift to satisfying walk-opinion labels on g.powerPreprocess eval fallback rotate T q walks.

theorem Cslib.PCP.Encoded.Graph.isPolyTime_powerPreprocessLabels {C α D : Type} [Fintype D] [Finite α] {Input : Type} {input : Input ↪ List Bool} {enc : C ↪ List Bool} {alphabet : α ↪ List Bool} {labelEncoding : D ↪ List Bool} {graph : Input → Graph C} {labels : Input → List α} {rotate : ℕ × ℕ × D → ℕ × D} (hgraph : Turing.MultiTapeTM.ComputableInPolyTime graph input (encoding enc)) (hlabels : Turing.MultiTapeTM.ComputableInPolyTime labels input (Turing.MultiTapeTM.encList alphabet)) (hrotate : Turing.MultiTapeTM.ComputableInPolyTime rotate (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary labelEncoding)) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary labelEncoding)) (fallback : C) (default : α) (T : ℕ) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : Input) => powerPreprocessLabels fallback default rotate T (graph x) (labels x)) input (Turing.MultiTapeTM.encList (Turing.MultiTapeTM.encPi alphabet))

Powered-preprocessing label compilation runs in polynomial time.

Lift a vertex-label list through one normalized amplification round g.amplify.

@[simp]
theorem Cslib.PCP.Encoded.Graph.length_amplifyLabels {D : Type} [FinEnum D] (fallback : SelectedAlphabet → SelectedAlphabet → Bool) (rotate : ℕ × ℕ × D → ℕ × D) (T q : ℕ) [NeZero q] (g : Graph (SelectedAlphabet → SelectedAlphabet → Bool)) (labels : List SelectedAlphabet) :
(amplifyLabels fallback rotate T q g labels).length = (amplify id fallback rotate T q g).vertices
theorem Cslib.PCP.Encoded.Graph.satisfies_amplifyLabels {D : Type} [FinEnum D] (fallback : SelectedAlphabet → SelectedAlphabet → Bool) (family : (n : ℕ) → RotationMap (Fin n) D) (rotate : ℕ × ℕ × D → ℕ × D) (hrotate : ∀ (n : ℕ) (v : Fin n) (d : D), rotate (n, ↑v, d) = (↑((family n).rot (v, d)).1, ((family n).rot (v, d)).2)) (T q : ℕ) [NeZero q] {g : Graph (SelectedAlphabet → SelectedAlphabet → Bool)} {labels : List SelectedAlphabet} (hsat : ∀ (e : Fin g.edges.length), (g.toGraph id).Satisfies (fun (v : ℕ) => labels.getD v defaultSelectedAlphabet) e) (e : Fin (amplify id fallback rotate T q g).edges.length) :
((amplify id fallback rotate T q g).toGraph id).Satisfies (fun (v : ℕ) => (amplifyLabels fallback rotate T q g labels).getD v defaultSelectedAlphabet) e

One round of amplify preserves satisfaction of explicit label lists.

Compile a vertex-label list through k rounds of amplifyIter.

@[simp]
theorem Cslib.PCP.Encoded.Graph.length_amplifyIterLabels {D : Type} [FinEnum D] (fallback : SelectedAlphabet → SelectedAlphabet → Bool) (rotate : ℕ × ℕ × D → ℕ × D) (T q : ℕ) [NeZero q] (k : ℕ) {g : Graph (SelectedAlphabet → SelectedAlphabet → Bool)} {labels : List SelectedAlphabet} (hlen : labels.length = g.vertices) :
(amplifyIterLabels fallback rotate T q k g labels).length = (amplifyIter fallback rotate T q k g).vertices
theorem Cslib.PCP.Encoded.Graph.satisfies_amplifyIterLabels {D : Type} [FinEnum D] (fallback : SelectedAlphabet → SelectedAlphabet → Bool) (family : (n : ℕ) → RotationMap (Fin n) D) (rotate : ℕ × ℕ × D → ℕ × D) (hrotate : ∀ (n : ℕ) (v : Fin n) (d : D), rotate (n, ↑v, d) = (↑((family n).rot (v, d)).1, ((family n).rot (v, d)).2)) (T q : ℕ) [NeZero q] (k : ℕ) {g : Graph (SelectedAlphabet → SelectedAlphabet → Bool)} {labels : List SelectedAlphabet} (hsat : ∀ (e : Fin g.edges.length), (g.toGraph id).Satisfies (fun (v : ℕ) => labels.getD v defaultSelectedAlphabet) e) (e : Fin (amplifyIter fallback rotate T q k g).edges.length) :
((amplifyIter fallback rotate T q k g).toGraph id).Satisfies (fun (v : ℕ) => (amplifyIterLabels fallback rotate T q k g labels).getD v defaultSelectedAlphabet) e

Iterated normalized amplification rounds preserve satisfaction of explicit label lists.

theorem Cslib.PCP.Encoded.Graph.isPolyTime_amplifyIterLabels_clog {D : Type} [FinEnum D] {Input : Type} {input : Input ↪ List Bool} {graph : Input → Graph (SelectedAlphabet → SelectedAlphabet → Bool)} {labels : Input → List SelectedAlphabet} {labelEncoding : D ↪ List Bool} (hgraph : Turing.MultiTapeTM.ComputableInPolyTime graph input (encoding encConstraintTable)) (hlabels : Turing.MultiTapeTM.ComputableInPolyTime labels input (Turing.MultiTapeTM.encList encSelectedAlphabet)) (hwellFormed : ∀ (x : Input), (graph x).WellFormed) (hlabelLen : ∀ (x : Input), (labels x).length = (graph x).vertices) (family : (n : ℕ) → RotationMap (Fin n) D) (rotate : ℕ × ℕ × D → ℕ × D) (hrotate : ∀ (n : ℕ) (v : Fin n) (d : D), rotate (n, ↑v, d) = (↑((family n).rot (v, d)).1, ((family n).rot (v, d)).2)) (hcost : Turing.MultiTapeTM.ComputableInPolyTime rotate (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary labelEncoding)) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary labelEncoding)) (fallback : SelectedAlphabet → SelectedAlphabet → Bool) (T q : ℕ) [NeZero q] :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : Input) => amplifyIterLabels fallback rotate T q (Nat.clog 2 (graph x).edges.length) (graph x) (labels x)) input (Turing.MultiTapeTM.encList encSelectedAlphabet)

Iterating normalized label compilation for logarithmically many rounds runs in polynomial time.

Concrete arithmetic amplification and gapGraph witness compilation #

@[instance_reducible]

Local FinEnum instance for ZMod 257 used during arithmeticAmplify witness compilation.

Lift vertex labels of g through the concrete arithmeticAmplify pipeline.

Concrete arithmetic amplification preserves satisfaction of explicit label lists.

theorem Cslib.PCP.Encoded.Graph.isPolyTime_arithmeticAmplifyLabels {Input : Type} {input : Input ↪ List Bool} {graph : Input → Graph (SelectedAlphabet → SelectedAlphabet → Bool)} {labels : Input → List SelectedAlphabet} (hgraph : Turing.MultiTapeTM.ComputableInPolyTime graph input (encoding encConstraintTable)) (hlabels : Turing.MultiTapeTM.ComputableInPolyTime labels input (Turing.MultiTapeTM.encList encSelectedAlphabet)) (hwellFormed : ∀ (x : Input), (graph x).WellFormed) (hlabelLen : ∀ (x : Input), (labels x).length = (graph x).vertices) :

Concrete arithmetic label compilation runs in polynomial time.

Packing a label list into a binary PCP proof #

def Cslib.PCP.Encoded.Graph.proofOfLabelList {α : Type} {width : ℕ} (encode : α → Fin width → Bool) (labels : List α) :

Pack a vertex-label list into consecutive width-bit proof blocks.

theorem Cslib.PCP.Encoded.Graph.proofOfLabelList_eq_proofOfLabels {α : Type} {width : ℕ} (encode : α → Fin width → Bool) (default : α) (labels : List α) :
proofOfLabelList encode labels = proofOfLabels width labels.length encode fun (v : ℕ) => labels.getD v default

When labels.length = vertices, packing labels equals proofOfLabels.

theorem Cslib.PCP.Encoded.Graph.isPolyTime_proofOfLabelList {α Input : Type} [Finite α] {width : ℕ} {input : Input ↪ List Bool} {alphabet : α ↪ List Bool} (encode : α → Fin width → Bool) {labels : Input → List α} (hlabels : Turing.MultiTapeTM.ComputableInPolyTime labels input (Turing.MultiTapeTM.encList alphabet)) :

Bit-packing a list of labels from a fixed finite alphabet runs in polynomial time.

Compile a SAT.npRelation witness w for CNF formula φ into vertex labels of gapGraph φ.

@[simp]

The compiled gapGraphLabels list matches (gapGraph φ).vertices.

A SAT.npRelation witness compiles to satisfying vertex labels for gapGraph φ.

theorem Cslib.PCP.Encoded.isPolyTime_gapGraphLabels {Input : Type} {input : Input ↪ List Bool} {formula : Input → Logic.PL.CNF ℕ} {witness : Input → List Bool} (hformula : Turing.MultiTapeTM.ComputableInPolyTime formula input Complexity.encCNF) (hwitness : Turing.MultiTapeTM.ComputableInPolyTime witness input Turing.MultiTapeTM.encBits) :

Compiling gapGraphLabels from a polynomial-time CNF formula and SAT witness runs in polynomial time.