Documentation

CslibFrontier.Computability.Complexity.Classes.NP.SelfReduction

Search to decision for SAT #

A procedure that decides satisfiability also finds satisfying assignments Arora and Barak, Section 2.5. The self-reduction (Cslib.Complexity.SAT.selfReduce) fixes the variables of a formula φ one literal occurrence at a time: it asks whether φ, with the values chosen so far as unit clauses and the next variable set to true, is satisfiable, and fixes the variable to the answer. If φ is satisfiable and the answers are correct, the formula stays satisfiable, so at the end the chosen values satisfy φ (Cslib.Complexity.SAT.verifier_search). The answers need only be correct on the formulas the self-reduction asks about, whose encodings are at most queryBound of the length of φ's, so a procedure that is correct up to that length suffices; this is how Karp and Lipton use circuits for SAT. The values are output as a certificate for Cslib.Complexity.SAT.verifier, one bit for each literal occurrence. Correctness only uses that each answer chooses a value that keeps the formula satisfiable (Cslib.Complexity.SAT.verifier_search_of_step); this is how a P-selector for SAT decides it (Cslib.Complexity.SAT.mem_P_of_mem_PSel).

The self-reduction makes one query for each literal occurrence, so it runs in polynomial time when the queries are answered in polynomial time (Cslib.Complexity.SAT.computableInPolyTime_search). In particular, if SAT is in P, satisfying assignments can be found in polynomial time (Cslib.Complexity.SAT.exists_search). The unit clauses and the bounds on their encoded length are in CslibFrontier/Computability/Complexity/Problems/SAT/Units.lean.

Main definitions #

Main results #

References #

One step of the self-reduction of φ with the decision procedure D: fix v to the answer of D on φ with the values fixed so far and v set to true.

The self-reduction of φ with the decision procedure D: for each literal occurrence v of φ in turn, the value fixed for v.

The certificate found by the self-reduction: the value fixed at each literal occurrence.

A bound on the length of the encoded formulas that the self-reduction of a formula of encoded length L asks about.

Correctness #

Each step of the self-reduction fixes the next variable: folding the steps over l appends l to the variables fixed so far.

theorem Cslib.Complexity.SAT.length_query_le {φ : Logic.PL.CNF ℕ} {answers : List (Logic.PL.Literal ℕ)} (hanswers : ∀ l ∈ answers, l.1 ∈ φ.vars) (hlen : answers.length ≤ φ.vars.length) {v : ℕ} (hv : v ∈ φ.vars) :

The formulas that the self-reduction asks about are no longer than queryBound.

When the formula obtained by appending all unit clauses chosen by selfReduce D φ remains satisfiable, the certificate produced by search D φ is accepted by the verifier.

theorem Cslib.Complexity.SAT.verifier_search_of_step {D : Logic.PL.CNF ℕ → Bool} {φ : Logic.PL.CNF ℕ} (hstep : ∀ (answers : List (Logic.PL.Literal ℕ)), (∀ l ∈ answers, l.1 ∈ φ.vars) → answers.length < φ.vars.length → ∀ v ∈ φ.vars, (φ ++ units answers).Satisfiable → (φ ++ units answers ++ [[(v, D (φ ++ units answers ++ [[(v, true)]]))]]).Satisfiable) (hφ : φ ∈ SAT) :

Search to decision, stepwise. If each step of the self-reduction of φ keeps a satisfiable formula satisfiable (the value D chooses for the next variable v leaves φ, with the values fixed so far, satisfiable), and φ is satisfiable, the certificate found by the self-reduction satisfies φ. The answers of D need not be correct: the self-reduction only needs them to choose a satisfiable branch.

The self-reduction never finds a satisfying assignment of an unsatisfiable formula: the certificate it finds is accepted exactly when the formula is satisfiable.

Polynomial time #