Documentation

CslibFrontier.Computability.Complexity.CookLevin.Levin

The Cook–Levin reduction is a Levin reduction #

The Cook–Levin reduction Cslib.Complexity.CookLevin.reduce of an NP relation to SAT carries explicit witness maps, both computable in polynomial time:

Cslib.Complexity.CookLevin.SAT_levinHard says that every NP relation, over any encoded type of instances, Levin-reduces to the NP relation of SAT. Composing with the SAT → 3SAT Levin reduction gives Cslib.Complexity.CookLevin.ThreeSAT_levinHard. These are the witness-preserving forms of Cslib.Complexity.CookLevin.SAT_npHard and Cslib.Complexity.ThreeSAT_npHard; the forward maps are what a prover for SAT or ThreeSAT needs to run on the witnesses of the original relation.

Main definitions #

Main results #

References #

noncomputable def Cslib.Complexity.CookLevin.tableauWitness {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) (u w : List Bool) (L T : ℕ) :

The values, along the occurrences of the tableau of tm on inputs u ++ w' with |w'| = L unrolled for T steps, of the variables listed along the run on u ++ w.

noncomputable def Cslib.Complexity.CookLevin.forwardWitness {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] {α : Type} (tm : Turing.MultiTapeTM k Bool State) (p : Polynomial ℕ) (c d : ℕ) (enc : α ↪ List Bool) (x : α × List Bool) :

The forward witness map of the Cook–Levin reduction: the variables listed along the run of tm on frame (enc a) ++ w, evaluated along the occurrences of the tableau and padded.

noncomputable def Cslib.Complexity.CookLevin.backwardWitness {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] {α : Type} (tm : Turing.MultiTapeTM k Bool State) (p : Polynomial ℕ) (c d : ℕ) (enc : α ↪ List Bool) (x : α × List Bool) :

The backward witness map of the Cook–Levin reduction: the certificate bits of the assignment that a certificate x.2 for reduce tm p c d enc x.1 describes.

def Cslib.Complexity.CookLevin.RunsVerifier {k : ℕ} {State α : Type} {enc : α ↪ List Bool} (R : NPRelation enc) (tm : Turing.MultiTapeTM k Bool State) (c d : ℕ) :

The runs of tm on instance–certificate pairs of the prescribed length halt within c * (n + 1) ^ d steps with the verifier's answer: the hypothesis of Cslib.Complexity.CookLevin.reduce_mem_SAT_iff, for every instance.

theorem Cslib.Complexity.CookLevin.isWitness_forwardWitness {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] {α : Type} {enc : α ↪ List Bool} {R : NPRelation enc} {tm : Turing.MultiTapeTM k Bool State} {c d : ℕ} (hrun : RunsVerifier R tm c d) {a : α} {w : List Bool} (h : R.IsWitness a w) :

Forward witnesses. A witness for a is sent to a witness of SAT for the reduced formula.

theorem Cslib.Complexity.CookLevin.isWitness_backwardWitness {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] {α : Type} {enc : α ↪ List Bool} {R : NPRelation enc} {tm : Turing.MultiTapeTM k Bool State} {c d : ℕ} (hrun : RunsVerifier R tm c d) {a : α} {w : List Bool} (h : SAT.npRelation.IsWitness (reduce tm R.certLength c d enc a) w) :
R.IsWitness a (backwardWitness tm R.certLength c d enc (a, w))

Backward witnesses. A witness of SAT for the reduced formula is sent to a witness for a: the certificate bits of the assignment it describes.

Polynomial time #

The forward witness map is polynomial-time, for a fixed machine and fixed bounds.

The backward witness map is polynomial-time, for a fixed machine and fixed bounds.

The Levin reduction #

noncomputable def Cslib.Complexity.CookLevin.levinReduction {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] {α : Type} {enc : α ↪ List Bool} (R : NPRelation enc) (tm : Turing.MultiTapeTM k Bool State) (c d : ℕ) (hrun : RunsVerifier R tm c d) :

The Cook–Levin reduction is a Levin reduction of an NP relation to the NP relation of SAT, for a machine tm computing its verifier within c * (n + 1) ^ d steps.

Cook–Levin, witness-preserving form. Every NP relation, over any encoded type of instances, Levin-reduces to the NP relation of SAT.

Every NP relation Levin-reduces to 3SAT: the Cook–Levin Levin reduction followed by the SAT → 3SAT Levin reduction.