Documentation

CslibFrontier.Computability.Complexity.Problems.ThreeSAT

3SAT #

ThreeSAT is the set of satisfiable formulas in conjunctive normal form whose clauses have at most three literals Arora and Barak, Section 2.3.1. toThreeSAT maps a formula to an equisatisfiable one of width three, by splitting its clauses (Cslib.Logic.PL.CNF.to3CNF) and numbering the variables injectively. Combining CNF.isPolyTime_to3CNF with binary variable relabelling and the Cook–Levin theorem proves that ThreeSAT is NP-complete.

Main definitions #

Main results #

References #

The satisfiable formulas whose clauses have at most three literals [Kar72], Arora and Barak, Section 2.3.1.

Instances For

    An injective numbering of the variables of a split formula: original variables at even numbers, auxiliary variables at odd numbers through Nat.pair.

    Instances For

      The reduction from SAT to ThreeSAT: split the clauses, then number the variables.

      Instances For

        Correctness of the reduction: toThreeSAT φ is in ThreeSAT exactly when φ is in SAT.

        Polynomial-time reduction and NP-completeness #

        Variable numbering after clause splitting is polynomial-time: original binary variables shift by one bit, and unary fresh-variable pairs are paired and converted to odd binary numbers.

        The verifier for ThreeSAT: check that every clause has at most three literals and evaluate the formula under the certificate assignment.

        Instances For

          ThreeSAT.verifier verifies ThreeSAT with certificates as long as the encoded formula: it is SAT.verifier guarded by the clause-width test.