Documentation

CslibFrontier.Logics.Propositional.Algebraic.CNF.Parity

Clause polynomials of parity constraints #

The clause Cslib.Logic.PL.Clause.exclude B y, which excludes the values of y on B, has clause polynomial ∏_{i ∈ B} [x_i = y_i], where [x_i = 1] is X i and [x_i = 0] is 1 - X i (Cslib.Logic.PL.Clause.toBoolPoly_exclude). Over a domain its total degree is exactly #B (Cslib.Logic.PL.Clause.totalDegree_toBoolPoly_exclude).

Over a ring of characteristic 2, the clause polynomials of the parity constraint Cslib.Logic.PL.CNF.parityOnEq B c add up to [c = 1] + ∑_{i ∈ B} X i (Cslib.Logic.PL.CNF.sum_toBoolPolys_parityOnEq): both sides are the indicator of parityOn B x ≠ c on the Boolean cube. This is the identity behind the degree-Δ Nullstellensatz refutations of Tseitin formulas in characteristic 2.

Main results #

theorem Cslib.Logic.PL.Clause.toBoolPoly_exclude {ι : Type u_1} {R : Type u_2} [CommRing R] (B : Finset ι) (y : ι → Bool) :

The clause excluding the values of y on B has polynomial ∏_{i ∈ B} [x_i = y_i], where [x_i = 1] is X i and [x_i = 0] is 1 - X i.

theorem Cslib.Logic.PL.Clause.totalDegree_toBoolPoly_exclude {ι : Type u_1} {R : Type u_2} [CommRing R] [IsDomain R] (B : Finset ι) (y : ι → Bool) :

Over a domain, the clause excluding the values of y on B has polynomial of total degree exactly #B.

theorem Cslib.Logic.PL.CNF.sum_toBoolPoly_exclude_parityOn_ne {ι : Type u_1} {R : Type u_2} [DecidableEq ι] [CommRing R] [CharP R 2] (B : Finset ι) (c : Bool) :
∑ A ∈ B.powerset with (parityOn B fun (i : ι) => decide (i ∈ A)) ≠ c, Clause.toBoolPoly R (Clause.exclude B fun (i : ι) => decide (i ∈ A)) = (if c = true then 1 else 0) + ∑ i ∈ B, MvPolynomial.X i

In characteristic 2, the polynomials of the clauses excluding the assignments to B of parity other than c add up to [c = 1] + ∑_{i ∈ B} X i: both sides are the indicator of parityOn B x ≠ c on the Boolean cube. This is Cslib.Logic.PL.CNF.sum_toBoolPolys_parityOnEq written as a sum over the excluded assignments.

theorem Cslib.Logic.PL.CNF.sum_toBoolPolys_parityOnEq {ι : Type u_1} {R : Type u_2} [DecidableEq ι] [CommRing R] [CharP R 2] (B : Finset ι) (c : Bool) :
(toBoolPolys R (parityOnEq B c)).sum = (if c = true then 1 else 0) + ∑ i ∈ B, MvPolynomial.X i

In characteristic 2, the clause polynomials of the parity constraint Cslib.Logic.PL.CNF.parityOnEq B c add up to [c = 1] + ∑_{i ∈ B} X i: both sides are the indicator of parityOn B x ≠ c on the Boolean cube.