Documentation

CslibFrontier.Logics.Propositional.ParitySystem

Parity systems and bounded-width derivations #

A parity system P : ParitySystem ฯƒ is a finite list of equations โŠ•_{i โˆˆ S} xแตข = b over ๐”ฝโ‚‚, each given by its set S of variables and its right-hand side b. An assignment a : ฯƒ โ†’ Bool satisfies P (ParitySystem.Holds) when parityOn S a = b for every equation. Variables are sets rather than lists, unlike Cslib.Logic.PL.AffineEquation: the algebraic encodings over ยฑ1 variables (Cslib.Logic.PL.ParitySystem.toPolys) are multilinear in the variables of an equation.

Summing two equations gives the equation of the symmetric difference of their sets and the exclusive or of their right-hand sides. Width-w derivations (ParitySystem.Derives P w) start from 0 = 0 and the equations of P with at most w variables, and close under this rule as long as the result has at most w variables. This is width-w resolution on XOR formulas, Schoenebeck, Definition 10, except that the equations of P used must also have width at most w; restricting the axioms derives fewer equations, so the hypothesis "width-w derivations do not reach 0 = 1" is weaker here than in the source. Every derived equation holds under every satisfying assignment (ParitySystem.Holds.parityOn_eq_of_derives), so a system from which 0 = 1 is derivable is unsatisfiable. Tseitin parity systems are in CslibFrontier.Logics.Propositional.ParitySystem.Tseitin.

Main definitions #

Main results #

References #

structure Cslib.Logic.PL.ParityEquation (ฯƒ : Type u_1) :
Type u_1

A parity equation โŠ•_{i โˆˆ S} xแตข = b over ๐”ฝโ‚‚, given by the set S of its variables and its right-hand side b.

  • vars : Finset ฯƒ

    The variables whose parity is constrained.

  • rhs : Bool

    The right-hand side of the equation.

@[reducible, inline]
abbrev Cslib.Logic.PL.ParitySystem (ฯƒ : Type u_1) :
Type u_1

A parity system: a list of parity equations.

def Cslib.Logic.PL.ParitySystem.Holds {ฯƒ : Type u_1} (P : ParitySystem ฯƒ) (a : ฯƒ โ†’ Bool) :

The assignment a satisfies every equation of P: the parity of a on the variables of an equation is its right-hand side.

inductive Cslib.Logic.PL.ParitySystem.Derives {ฯƒ : Type u_1} [DecidableEq ฯƒ] (P : ParitySystem ฯƒ) (w : โ„•) :
Finset ฯƒ โ†’ Bool โ†’ Prop

Width-w derivations from a parity system P: Derives P w S b says that the equation โŠ•_{i โˆˆ S} xแตข = b is obtained from 0 = 0 and the equations of P with at most w variables by summing two derived equations, every derived equation having at most w variables. Deriving 0 = 1 is Derives P w โˆ… true.

theorem Cslib.Logic.PL.ParitySystem.Derives.card_le {ฯƒ : Type u_1} [DecidableEq ฯƒ] {P : ParitySystem ฯƒ} {w : โ„•} {S : Finset ฯƒ} {b : Bool} (h : P.Derives w S b) :

A derived equation has at most w variables.

theorem Cslib.Logic.PL.ParitySystem.Derives.mono {ฯƒ : Type u_1} [DecidableEq ฯƒ] {P : ParitySystem ฯƒ} {w : โ„•} {S : Finset ฯƒ} {b : Bool} (h : P.Derives w S b) {w' : โ„•} (hw : w โ‰ค w') :
P.Derives w' S b

Width-w derivations are width-w' derivations for w โ‰ค w'.

theorem Cslib.Logic.PL.ParitySystem.Holds.parityOn_eq_of_derives {ฯƒ : Type u_1} [DecidableEq ฯƒ] {P : ParitySystem ฯƒ} {w : โ„•} {a : ฯƒ โ†’ Bool} (ha : P.Holds a) {S : Finset ฯƒ} {b : Bool} (h : P.Derives w S b) :
parityOn S a = b

Soundness of derivations: every derived equation holds under every assignment satisfying the system.

theorem Cslib.Logic.PL.ParitySystem.not_holds_of_derives_empty_true {ฯƒ : Type u_1} [DecidableEq ฯƒ] {P : ParitySystem ฯƒ} {w : โ„•} (h : P.Derives w โˆ… true) (a : ฯƒ โ†’ Bool) :

A system from which 0 = 1 is derivable is unsatisfiable.