Documentation

CslibFrontier.Logics.Propositional.Algebraic.SumOfSquares.CNF

Positivstellensatz refutations of CNF formulas #

A CNF formula φ becomes polynomial constraints through its cutting-planes inequalities: the clause C gives ∑_{v ∈ C} xᵥ + ∑_{¬v ∈ C} (1 - xᵥ) - 1 ≥ 0 (Clause.toIneq, through Ineq.toPoly, which sends ∑ᵥ aᵥ xᵥ ≥ b to ∑ᵥ aᵥ xᵥ - b), and every variable gives the box constraints xᵥ ≥ 0 and 1 - xᵥ ≥ 0 (SOS.Psatz.cnfIneqs). The Boolean axioms xᵥ ² - xᵥ = 0 are the equations (SOS.Psatz.booleanAxioms). This is the translation of Grigoriev, Hirsch and Pasechnik, Section 2.3, inequalities (2.4)–(2.6) with the Boolean axioms as equations.

Over a strictly ordered ring the common solutions of these constraints are exactly the satisfying assignments (SOS.Psatz.exists_feasible_iff), so a Positivstellensatz refutation shows that φ is unsatisfiable (SOS.Psatz.not_satisfiable_of_refutableInDegree). In degree at most 1 the Boolean axioms impose nothing, since every nonzero multiple of xᵥ ² - xᵥ has degree at least 2 (SOS.Psatz.eq_zero_of_totalDegree_mul_le_one). A point of the box that satisfies the clause inequalities, fractional or not, is then a pseudo-expectation of degree 1 (SOS.Psatz.degreeOnePseudoExpectation), which rules out refutations of degree 1 (SOS.Psatz.not_refutableInDegree_one_of_eval_nonneg).

Main definitions #

Main results #

References #

noncomputable def Cslib.Logic.PL.Ineq.toPoly {V : Type u_1} {R : Type u_2} [CommRing R] (I : Ineq V) :

The polynomial ∑ᵥ aᵥ Xᵥ - b of the inequality ∑ᵥ aᵥ xᵥ ≥ b.

theorem Cslib.Logic.PL.Ineq.toPoly_add {V : Type u_1} {R : Type u_2} [CommRing R] (I J : Ineq V) :
(I + J).toPoly = I.toPoly + J.toPoly
noncomputable def Cslib.Logic.PL.Ineq.toPolyHom {V : Type u_1} {R : Type u_2} [CommRing R] :

Ineq.toPoly as an additive homomorphism.

theorem Cslib.Logic.PL.Ineq.toPoly_sum {V : Type u_1} {R : Type u_2} [CommRing R] {ι : Type u_3} (s : Finset ι) (f : ι → Ineq V) :
(∑ i ∈ s, f i).toPoly = ∑ i ∈ s, (f i).toPoly
@[simp]
theorem Cslib.Logic.PL.Ineq.toPoly_contra {V : Type u_1} {R : Type u_2} [CommRing R] :
@[simp]
theorem Cslib.Logic.PL.Ineq.toPoly_nonneg {V : Type u_1} {R : Type u_2} [CommRing R] (v : V) :
@[simp]
theorem Cslib.Logic.PL.Ineq.toPoly_leOne {V : Type u_1} {R : Type u_2} [CommRing R] (v : V) :

The polynomial of an inequality is affine.

theorem Cslib.Logic.PL.Ineq.eval_toPoly_toInt {V : Type u_1} {R : Type u_2} [CommRing R] (σ : V → Bool) (I : Ineq V) :
(MvPolynomial.eval fun (v : V) => ↑(σ v).toInt) I.toPoly = ↑(lhs σ I - I.bound)

At a 0/1 point, the polynomial of an inequality is its slack lhs - bound.

theorem Cslib.Logic.PL.Ineq.holds_iff_eval_toPoly_nonneg {V : Type u_1} {R : Type u_2} [CommRing R] [LinearOrder R] [IsStrictOrderedRing R] (σ : V → Bool) (I : Ineq V) :
Holds σ I ↔ 0 ≤ (MvPolynomial.eval fun (v : V) => ↑(σ v).toInt) I.toPoly

Over a strictly ordered ring, an inequality holds at a 0/1 point exactly when its polynomial is nonnegative there.

theorem Cslib.Logic.PL.Clause.toPoly_toIneq {V : Type u_1} {R : Type u_2} [CommRing R] [DecidableEq V] (c : Clause V) :
c.toIneq.toPoly = (∑ l ∈ List.toFinset c, bif l.2 then MvPolynomial.X l.1 else 1 - MvPolynomial.X l.1) - 1

The polynomial of the inequality of a clause: ∑_{v ∈ C} Xᵥ + ∑_{¬v ∈ C} (1 - Xᵥ) - 1, over the distinct literals of C.

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

The inequality constraints of a CNF formula: the polynomials of its clause inequalities and the box constraints Xᵥ ≥ 0, 1 - Xᵥ ≥ 0.

noncomputable def Cslib.Logic.PL.SOS.Psatz.booleanAxioms (V : Type u_3) (R : Type u_4) [CommRing R] :

The Boolean axioms Xᵥ ² - Xᵥ = 0.

theorem Cslib.Logic.PL.SOS.Psatz.toPoly_mem_cnfIneqs {V : Type u_1} {R : Type u_2} [CommRing R] [DecidableEq V] {φ : CNF V} {c : Clause V} (hc : c ∈ φ) :
theorem Cslib.Logic.PL.SOS.Psatz.X_mem_cnfIneqs {V : Type u_1} {R : Type u_2} [CommRing R] [DecidableEq V] (φ : CNF V) (v : V) :
theorem Cslib.Logic.PL.SOS.Psatz.forall_mem_cnfIneqs_iff {V : Type u_1} {R : Type u_2} [CommRing R] [DecidableEq V] {φ : CNF V} {p : MvPolynomial V R → Prop} :
(∀ f ∈ cnfIneqs φ, p f) ↔ (∀ c ∈ φ, p c.toIneq.toPoly) ∧ (∀ (v : V), p (MvPolynomial.X v)) ∧ ∀ (v : V), p (1 - MvPolynomial.X v)

A property holds on the inequality constraints of φ exactly when it holds on the clause polynomials and the box constraints.

theorem Cslib.Logic.PL.SOS.Psatz.exists_feasible_iff {V : Type u_1} {R : Type u_2} [CommRing R] [DecidableEq V] [LinearOrder R] [IsStrictOrderedRing R] (φ : CNF V) :
(∃ (x : V → R), (∀ f ∈ cnfIneqs φ, 0 ≤ (MvPolynomial.eval x) f) ∧ ∀ g ∈ booleanAxioms V R, (MvPolynomial.eval x) g = 0) ↔ φ.Satisfiable

The encoding is faithful: over a strictly ordered ring, the constraints of φ have a common solution exactly when φ is satisfiable.

Soundness for CNF formulas: a CNF formula whose constraints have a Positivstellensatz refutation is unsatisfiable.

theorem Cslib.Logic.PL.SOS.Psatz.eq_zero_of_totalDegree_mul_le_one {V : Type u_1} {R : Type u_2} [CommRing R] [LinearOrder R] [IsStrictOrderedRing R] {g q : MvPolynomial V R} (hg : g ∈ booleanAxioms V R) (hq : (q * g).totalDegree ≤ 1) :
q * g = 0

In degree at most 1 the Boolean axioms impose nothing: every multiple of Xᵥ ² - Xᵥ of total degree at most 1 is zero.

noncomputable def Cslib.Logic.PL.SOS.Psatz.degreeOnePseudoExpectation {V : Type u_1} {R : Type u_2} [CommRing R] [DecidableEq V] [LinearOrder R] [IsStrictOrderedRing R] {φ : CNF V} (x : V → R) (hx : ∀ f ∈ cnfIneqs φ, 0 ≤ (MvPolynomial.eval x) f) :

The degree-1 pseudo-expectation of a fractional point: evaluation at a point, not necessarily 0/1, that satisfies the inequality constraints of φ is a pseudo-expectation of degree 1, since in degree 1 the Boolean axioms impose nothing.

@[simp]

The pseudo-expectation degreeOnePseudoExpectation x hx is evaluation at x.

Degree-1 lower bounds from fractional points: if a point, not necessarily 0/1, satisfies the inequality constraints of φ, then φ has no Positivstellensatz refutation of degree at most 1.