Documentation

CslibFrontier.Logics.Propositional.ParitySystem.Tseitin

Tseitin parity systems #

The Tseitin parity system ParitySystem.tseitin ends χ of a multigraph ends : E → Sym2 V with charges χ has a variable for each edge and, for each vertex v, the equation saying that the parity of the edges at v other than self-loops is χ v. It is satisfied by the same assignments as the Tseitin formula CNF.tseitinFormula ends χ (ParitySystem.holds_tseitin_iff_eval_tseitinFormula), so it is unsatisfiable when the total charge is odd (ParitySystem.not_holds_tseitin), and on a connected multigraph satisfiable exactly when the total charge is even (ParitySystem.exists_holds_tseitin_iff).

Main definitions #

Main results #

References #

noncomputable def Cslib.Logic.PL.ParitySystem.tseitin {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] (ends : E → Sym2 V) (χ : V → Bool) :

The Tseitin parity system of the multigraph ends with charges χ: a variable for each edge, and for each vertex v the equation saying that the parity of the edges at v other than self-loops is χ v.

theorem Cslib.Logic.PL.ParitySystem.mem_tseitin {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] {ends : E → Sym2 V} {χ : V → Bool} {e : ParityEquation E} :
e ∈ tseitin ends χ ↔ ∃ (v : V), { vars := Multigraph.incidence ends v, rhs := χ v } = e

The equations of the Tseitin parity system are those of the vertices.

@[simp]
theorem Cslib.Logic.PL.ParitySystem.length_tseitin {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] {ends : E → Sym2 V} {χ : V → Bool} :

The Tseitin parity system has an equation for each vertex.

theorem Cslib.Logic.PL.ParitySystem.incidence_mem_tseitin {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] {ends : E → Sym2 V} {χ : V → Bool} (v : V) :
{ vars := Multigraph.incidence ends v, rhs := χ v } ∈ tseitin ends χ

The equation of the vertex v belongs to the Tseitin parity system.

theorem Cslib.Logic.PL.ParitySystem.holds_tseitin_iff {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] {ends : E → Sym2 V} {χ : V → Bool} (a : E → Bool) :
(tseitin ends χ).Holds a ↔ ∀ (v : V), parityOn (Multigraph.incidence ends v) a = χ v

An assignment satisfies the Tseitin parity system when its parity at every vertex is the charge.

theorem Cslib.Logic.PL.ParitySystem.holds_tseitin_iff_eval_tseitinFormula {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] {ends : E → Sym2 V} {χ : V → Bool} [DecidableEq E] (a : E → Bool) :

The Tseitin parity system and the Tseitin formula have the same satisfying assignments.

theorem Cslib.Logic.PL.ParitySystem.not_holds_tseitin {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] {ends : E → Sym2 V} {χ : V → Bool} (h : parityOn Finset.univ χ = true) (a : E → Bool) :
¬(tseitin ends χ).Holds a

Tseitin parity systems with odd total charge are unsatisfiable.

theorem Cslib.Logic.PL.ParitySystem.exists_holds_tseitin_iff {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] {ends : E → Sym2 V} {χ : V → Bool} (hG : (Multigraph.toSimpleGraph ends).Connected) :
(∃ (a : E → Bool), (tseitin ends χ).Holds a) ↔ parityOn Finset.univ χ = false

On a connected multigraph, the Tseitin parity system is satisfiable exactly when the total charge is even.