Documentation

DescriptiveComplexity.Problems.Sat.Hardness

The Cook–Levin theorem: hardness of SAT #

The hardness half of the Cook–Levin theorem (Cook 1971; Levin 1973), machine-free and in the style of Dahlhaus (Dahlhaus 1983): every existential-second-order definable problem admits an ordered first-order reduction to SAT (DescriptiveComplexity.sat_hard_of_sigmaSODefinable). Since NP is defined as Σ₁-definability (DescriptiveComplexity.Hierarchy), together with the membership half DescriptiveComplexity.sat_sigmaSODefinable this makes SAT NP-complete (DescriptiveComplexity.SAT_NP_complete) – relying on no axioms beyond Lean's standard three, as #print axioms confirms.

Given the single second-order block B and the first-order kernel φ of a Σ₁ definition of a problem Q, the reduction interprets, inside an ordered input structure A, the CNF instance of the Tseitin encoding (Tseitin 1968) of φ (DescriptiveComplexity.Problems.Sat.Tseitin):

The correctness proof (DescriptiveComplexity.tseitin_satisfiable_iff) composes the characterization lemmas of the interpreted relations with the semantic equivalence DescriptiveComplexity.Tseitin.satCond_iff_gates and the gate-correctness lemmas DescriptiveComplexity.Tseitin.gates_realize / DescriptiveComplexity.Tseitin.gates_canonVal.

The dimension of the Tseitin interpretation: large enough for every context tuple of the kernel and every argument tuple of a block variable.

Equations
Instances For
    Dependency graph
    Dependency graph
    Dependency graph

    The tags of the Tseitin interpretation: clauses of the encoding (per position and kind, plus the top-level unit clause), then propositional variables (per block variable, and per position).

    Equations
    Instances For
      Dependency graph
      Dependency graph
      Dependency graph

      The defining formula of satPosIn (s = true) and satNegIn (s = false), by clause and variable tag: the literals of the node clauses (DescriptiveComplexity.Tseitin.litF), and the root variable, at fully padded tuples, positively in the top clause.

      Equations
      Instances For
        Dependency graph

        The Tseitin interpretation: the CNF instance of the encoding of φ, defined inside the ordered input structure.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Dependency graph

          Characterization of the interpreted relations #

          Dependency graph
          Dependency graph
          Dependency graph
          def DescriptiveComplexity.TseitinLitSem {L : FirstOrder.Language} (B : SOBlock) (φ : (L.sum B.lang).Sentence) {A : Type} [L.Structure A] [LinearOrder A] (s : Bool) (tc tx : TseitinTag B φ) (u x : Fin (tseitinDim B φ)A) :

          The semantic content of the literal formulas, by clause and variable tag.

          Equations
          Instances For
            Dependency graph
            Dependency graph

            Correctness of the reduction #

            Correctness of the Tseitin interpretation: the interpreted CNF instance is satisfiable iff some assignment of the block variables realizes the kernel.

            Dependency graph

            The head of a one-block second-order satisfaction is realization of the kernel in the expansion by an assignment.

            Dependency graph
            noncomputable def DescriptiveComplexity.tseitinReduction {L : FirstOrder.Language} (B : SOBlock) (φ : (L.sum B.lang).Sentence) (Q : DecisionProblem L) ( : ∀ (A : Type) [inst : L.Structure A] [Finite A] [Nonempty A], Q.Holds A SORealize L A [B] φ true) :

            The generic Tseitin reduction: an ordered first-order reduction to SAT from any problem defined, on nonempty finite structures, by an existential second-order sentence with a single block.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Dependency graph

              The Cook–Levin theorem #

              The hardness half of the Cook–Levin theorem: every existential-second-order definable problem admits an ordered first-order reduction to SAT. Machine-free NP-hardness in the style of Dahlhaus, by the generic Tseitin reduction DescriptiveComplexity.tseitinReduction.

              Dependency graph

              The Cook–Levin theorem: SAT is NP-complete. Membership is DescriptiveComplexity.sat_sigmaSODefinable; hardness is DescriptiveComplexity.sat_hard_of_sigmaSODefinable, the generic Tseitin reduction.

              Dependency graph
              Dependency graph
              Dependency graph

              The complement of SAT (essentially, propositional entailment of ) is in coNP.

              Dependency graph