Documentation

Complexity.Logics.Propositional.Tseitin

Tseitin formulas #

A finite multigraph on the vertices V with edges E, parallel edges and self-loops allowed, is given by the map ends : E → Sym2 V sending each edge to its ends (Cslib.Multigraph). Given a charge χ v for every vertex v, the Tseitin formula CNF.tseitinFormula ends χ Tseitin Urquhart has a variable for each edge and says, for every vertex v, that the parity of the edges at v is the charge of v. A self-loop at v would count twice towards the parity of v, so it does not count at all; the parity of v is that of the edges at v that are not self-loops (Multigraph.incidence), and the constraint is expressed by the formula CNF.parityOnEq with a clause per assignment to those edges of the wrong parity. A vertex with d edges other than self-loops thus contributes at most 2 ^ d clauses of d literals each.

Every edge other than a self-loop is at exactly two vertices, so summing the constraints of all vertices gives 0 = ∑ χ: if the total charge is odd, the Tseitin formula is unsatisfiable (CNF.not_satisfiable_tseitinFormula). On a connected multigraph the converse holds, and more: the constraints of all vertices but one are satisfiable, whatever the charges (Tseitin.exists_forall_mem_parityOn_incidence_eq). Flipping the value of an edge flips the parities of its two ends, so flipping the edges of a path flips the parities of its two ends only; combining such flips moves the parities to any target, up to the vertex left out.

These facts underlie the resolution lower bounds for Tseitin formulas (Cslib.Logic.PL.Tseitin.minBalancedCut_le_of_refutableInWidth, Cslib.Logic.PL.Tseitin.exp_le_of_refutableInSize).

Main definitions #

Main results #

References #

Parities at the vertices #

theorem Cslib.Logic.PL.Tseitin.parityOn_incidence_update_not {V : Type u_1} {E : Type u_2} {ends : E → Sym2 V} [Fintype E] [DecidableEq V] [DecidableEq E] (σ : E → Bool) (e : E) (v : V) :

Flipping the value of an edge flips the parities at its ends, and only there.

theorem Cslib.Logic.PL.Tseitin.parityOn_univ_parityOn_incidence_eq_false {V : Type u_1} {E : Type u_2} {ends : E → Sym2 V} [Fintype E] [DecidableEq V] [Fintype V] (σ : E → Bool) :

The handshake argument: the parities at all vertices of an assignment to the edges add up to 0, since every edge other than a self-loop is at exactly two vertices.

theorem Cslib.Logic.PL.Tseitin.exists_forall_mem_parityOn_incidence_eq {V : Type u_1} {E : Type u_2} {ends : E → Sym2 V} [Fintype E] [DecidableEq V] [Fintype V] (hG : (Multigraph.toSimpleGraph ends).Connected) (χ : V → Bool) {S : Finset V} (hS : S ≠ Finset.univ) :
∃ (σ : E → Bool), ∀ v ∈ S, parityOn (Multigraph.incidence ends v) σ = χ v

Satisfiable subsystems: on a connected multigraph, the constraints of the vertices of any set other than the set of all vertices are satisfiable, whatever the charges.

Tseitin formulas #

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

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

Instances For
    theorem Cslib.Logic.PL.CNF.mem_tseitinFormula {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] {ends : E → Sym2 V} {χ : V → Bool} {c : Clause E} :
    c ∈ tseitinFormula ends χ ↔ ∃ (v : V), c ∈ parityOnEq (Multigraph.incidence ends v) (χ v)
    theorem Cslib.Logic.PL.CNF.eval_tseitinFormula_eq_true_iff {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] {ends : E → Sym2 V} {χ : V → Bool} (σ : E → Bool) :
    eval σ (tseitinFormula ends χ) = true ↔ ∀ (v : V), parityOn (Multigraph.incidence ends v) σ = χ v

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

    theorem Cslib.Logic.PL.CNF.not_satisfiable_tseitinFormula {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] {ends : E → Sym2 V} {χ : V → Bool} (h : parityOn Finset.univ χ = true) :

    Tseitin formulas with odd total charge are unsatisfiable Urquhart.

    On a connected multigraph, the Tseitin formula is satisfiable exactly when the total charge is even Urquhart.

    theorem Cslib.Logic.PL.CNF.length_le_of_mem_tseitinFormula {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] {ends : E → Sym2 V} {χ : V → Bool} {k : ℕ} (hk : ∀ (v : V), (Multigraph.incidence ends v).card ≤ k) {c : Clause E} (hc : c ∈ tseitinFormula ends χ) :

    If every vertex has at most k edges other than self-loops, the clauses of the Tseitin formula have at most k literals.

    theorem Cslib.Logic.PL.CNF.length_tseitinFormula_le {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] {ends : E → Sym2 V} {χ : V → Bool} {k : ℕ} (hk : ∀ (v : V), (Multigraph.incidence ends v).card ≤ k) :

    If every vertex has at most k edges other than self-loops, the Tseitin formula has at most |V| 2 ^ k clauses.

    The variables of a Tseitin formula are edges.