Documentation

Atlas.TheoryOfComputation.code.SharpSATCoNPHard

def NPCompleteness.IsCoNPHard {Γ : Type} (B : Set (List Γ)) :

A language B is coNP-hard if every language A ∈ coNP polynomial-time reduces to B. Analogous to the NP-hardness definition ∀ A ∈ NP, A ≤_P B from the textbook, but for the class coNP.

Instances For

    One plus the largest variable index appearing in φ. This gives an upper bound m such that every variable of φ has index < m.

    Instances For
      theorem NPCompleteness.BoolFormula.eval_eq_of_agree_on_vars {σ₁ σ₂ : BoolAssignment} (φ : BoolFormula) (h : iφ.vars, σ₁ i = σ₂ i) :
      eval σ₁ φ = eval σ₂ φ

      The truth value φ.eval σ depends only on the values of σ on the variables that actually occur in φ. If two assignments agree on φ.vars they yield the same evaluation.

      If φ is unsatisfiable then its #SAT count is zero. One direction of the equivalence between satisfiability and positive #SAT count.

      Converse of countSat_eq_zero_of_not_satisfiable: if φ has zero satisfying assignments then φ is unsatisfiable.

      A Boolean formula φ is a tautology iff φ.eval σ = true for every assignment σ.

      Instances For

        The language TAUTOLOGY = {⟨φ⟩ | φ is a tautology}, the canonical coNP-complete language.

        Instances For

          A simple encoding of #SAT instances ⟨φ, k⟩ as lists of Boolean formulas, specifically tailored for the coNP-hardness reduction. Only one round-trip law is required: decode (encode p) = some p.

          Instances For

            The #SAT language as a set of encoded instances over the alphabet BoolFormula: w is accepted iff it decodes to a pair ⟨φ, k⟩ with k = countSat φ.

            Instances For

              If Aᶜ ≤_P B then A ≤_P Bᶜ (the same reduction function works in both directions, since w ∈ Aᶜ ↔ f(w) ∈ B is equivalent to w ∈ A ↔ f(w) ∈ Bᶜ).

              The reduction UNSAT ≤_P #SAT: given an input encoding a single Boolean formula φ (the natural input format for UNSAT), output the #SAT encoding of ⟨φ, 0⟩. Malformed inputs are mapped to the encoding of ⟨false, 0⟩ (which is trivially a true #SAT instance, but the original input is also not in UNSAT under this convention).

              Instances For

                The constant false formula is unsatisfiable.

                The constant false formula has zero satisfying assignments.

                Correctness of the unsatToSharpSAT reduction: w ∈ SATᶜ iff unsatToSharpSAT w ∈ #SAT. Concretely, for a single-formula input [φ], this says φ is unsatisfiable iff countSat φ = 0.

                The reduction function unsatToSharpSAT is computable in polynomial time: encoding ⟨φ, 0⟩ from φ takes polynomial work in |φ|.

                UNSAT ≤_P #SAT: the language SATᶜ (the complement of SAT) polynomial-time reduces to #SAT via unsatToSharpSAT.

                #SAT is coNP-hard. For every A ∈ coNP, A ≤_P #SAT. The proof chains together: A ∈ coNP ⇒ Aᶜ ∈ NP ⇒ Aᶜ ≤_P SAT (Cook–Levin) ⇒ A ≤_P SATᶜ (PolyReducible.compl_left) ⇒ A ≤_P #SAT (via the UNSAT ≤_P #SAT reduction).