Documentation

CslibFrontier.Logics.Propositional.Algebraic.CNF.Boolean

Refuting CNF formulas over the Boolean cube #

The pointwise CNF arithmetization of CslibFrontier.Logics.Propositional.Algebraic.CNF (#2887) encodes a clause by a polynomial Cslib.Logic.PL.Clause.toPoly in the twin variables Literal V, one for each polarity of each variable. This module substitutes X v for the positive variable (v, true) and 1 - X v for the negative variable (v, false) (Cslib.Logic.PL.Literal.truthPoly). The result is the standard product encoding of clauses [CEI96] in the original variables, with variables read as 1 = true (Cslib.BitString.bitPoint): a clause becomes ∏_{v ∈ c} (1 - X v) * ∏_{¬v ∈ c} X v (Cslib.Logic.PL.Clause.toBoolPoly). At a point of the cube the clause polynomial is 0 when the clause is satisfied and 1 when it is falsified (Cslib.Logic.PL.Clause.eval_toBoolPoly). This comes from Cslib.Logic.PL.Clause.eval_toPoly through the substitution.

A formula φ becomes the list of its clause polynomials (Cslib.Logic.PL.CNF.toBoolPolys), refuted with the Boolean axioms of the variables. The Boolean solutions are the satisfying assignments (Cslib.Logic.PL.CNF.isBoolSolution_toBoolPolys_iff). Soundness and completeness of CslibFrontier.Logics.Propositional.Algebraic.Boolean then give:

Main definitions #

Main results #

References #

noncomputable def Cslib.Logic.PL.Literal.truthPoly {V : Type u_1} (R : Type u_2) [CommRing R] (l : Literal V) :

The truth value of a literal as a polynomial in the variables: X v for v and 1 - X v for ¬v.

noncomputable def Cslib.Logic.PL.Clause.toBoolPoly {V : Type u_1} (R : Type u_2) [CommRing R] (c : Clause V) :

The polynomial of a clause in the original variables: the twin-variable clause polynomial Cslib.Logic.PL.Clause.toPoly with every literal variable replaced by its truth value.

noncomputable def Cslib.Logic.PL.CNF.toBoolPolys {V : Type u_1} (R : Type u_2) [CommRing R] (φ : CNF V) :

The clause polynomials of a CNF formula in the original variables.

The truth polynomial of the negated literal is 1 minus the truth polynomial.

@[simp]

The empty clause has polynomial 1.

@[simp]
theorem Cslib.Logic.PL.Clause.toBoolPoly_cons {V : Type u_1} {R : Type u_2} [CommRing R] (l : Literal V) (c : Clause V) :

Adding a literal l multiplies the clause polynomial by 1 - truthPoly l.

At a point of the cube, the truth polynomial of a literal is the truth value used by Cslib.Logic.PL.Clause.eval_toPoly.

theorem Cslib.Logic.PL.Clause.eval_toBoolPoly {V : Type u_1} {R : Type u_2} [CommRing R] (x : V → Bool) (c : Clause V) :

At a point of the cube, the clause polynomial is 0 when the clause is satisfied and 1 when it is falsified.

A literal's truth polynomial has total degree at most one.

A clause polynomial has total degree at most the number of literals.

The Boolean solutions of the clause polynomials of a formula are its satisfying assignments.

Soundness for CNF formulas. A Nullstellensatz refutation of the clause polynomials with the Boolean axioms, over a nontrivial commutative ring, certifies that the formula is unsatisfiable.

theorem Cslib.Logic.PL.CNF.not_satisfiable_of_pc {V : Type u_1} {R : Type u_2} [CommRing R] [Fintype V] [Nontrivial R] {φ : CNF V} {ls : List (MvPolynomial V R)} (h : PC.IsProof (toBoolPolys R φ ++ Algebraic.boolAxioms V R) ls) (h1 : 1 ∈ ls) :

Soundness for CNF formulas. A polynomial calculus refutation of the clause polynomials with the Boolean axioms, over a nontrivial commutative ring, certifies that the formula is unsatisfiable.

theorem Cslib.Logic.PL.CNF.ns_refutableInDegree_iff {V : Type u_1} [Fintype V] {K : Type u_3} [Field K] {φ : CNF V} {w : ℕ} (hw : ∀ c ∈ φ, List.length c ≤ w) :

Over a field, a formula in the variables of a finite type V whose clauses have at most w literals has a Nullstellensatz refutation of degree at most card V + w exactly when it is unsatisfiable.

theorem Cslib.Logic.PL.CNF.pc_refutableInDegree_iff {V : Type u_1} [Fintype V] {K : Type u_3} [Field K] {φ : CNF V} {w : ℕ} (hw : ∀ c ∈ φ, List.length c ≤ w) :

Over a field, a formula in the variables of a finite type V whose clauses have at most w literals has a polynomial calculus refutation of degree at most card V + w exactly when it is unsatisfiable.