The Tseitin formula of a De Morgan circuit #
Tseitin's encoding turns a circuit into a formula in conjunctive normal form with one variable
per wire Tseitin, Arora and Barak, Section 6.1. A gate
w = op(a, b) contributes the clauses tseitinClause op w a b, which hold together exactly when
w carries the value Op.value op a b of the gate (forall_eval_tseitinClause_iff). The clauses
of the gates of a De Morgan gate list (Cslib.Circuits.Program.code) form tseitinCNF n gates,
with gate g at wire n + g; an assignment satisfies it exactly when it is the evaluation of the
list on its own values at the inputs (eval_tseitinCNF_eq_true_iff_evalCode).
tseitinSatCNF x n gates o adds unit clauses that fix the first inputs to the bits of x and
the wire o to true. It is satisfiable exactly when some input extending x makes wire o
true (satisfiable_tseitinSatCNF_iff); for x = [] and the output of a circuit, this is circuit
satisfiability (satisfiable_tseitinSatCNF_circuit_iff).
The formula is laid out uniformly: every gate has exactly three clauses, and every clause has
exactly three literals (length_of_mem_tseitinSatCNF), shorter clauses being padded by repeating a
literal. Clause j of a gate depends only on its operation, on j and on the variables of the
gate, so a circuit that computes a clause from its number (a succinct description of the formula)
has a fixed output width. The frontier compiler (Cslib.Circuits.Frontier.Compiler.toCNF)
instead numbers only the reachable wires, which preserves the number of models but is not
uniform.
Main definitions #
Cslib.Circuits.Boolean.tseitinClause: the three clauses of a gate.Cslib.Circuits.Boolean.tseitinCNF: the clauses of a gate list.Cslib.Circuits.Boolean.tseitinSatCNF: the clauses of a gate list, with unit clauses fixing an input prefix and an output wire.
Main results #
Cslib.Circuits.Boolean.forall_eval_tseitinClause_iff: the semantics of the clauses of a gate.Cslib.Circuits.Boolean.eval_tseitinCNF_eq_true_iff,Cslib.Circuits.Boolean.eval_tseitinCNF_eq_true_iff_evalCode: the assignments satisfying the Tseitin formula are those consistent with every gate, which are the evaluations of the list.Cslib.Circuits.Boolean.satisfiable_tseitinSatCNF_iff: satisfiability with a fixed input prefix.Cslib.Circuits.Boolean.satisfiable_tseitinSatCNF_circuit_iff: the same for circuits.Cslib.Circuits.Boolean.length_of_mem_tseitinSatCNF,Cslib.Circuits.Boolean.length_tseitinSatCNF: every clause has three literals, and there are1 + x.length + 3 * gates.lengthclauses.
References #
The clauses of a gate #
The Tseitin clauses of a gate w = op(a, b): three clauses of exactly three literals,
which hold together exactly when w carries the value of the gate
(forall_eval_tseitinClause_iff). A constant mentions only w, and a negation only w and
a; shorter clauses are padded by repeating a literal.
Every clause of a gate has three literals.
The clauses of a gate hold exactly when its output carries its value.
Relabelling the clauses of a gate relabels its variables.
The Tseitin formula of a gate list #
The clauses of a gate code gate at the wire w, reading its first two listed arguments.
The Tseitin formula of a De Morgan gate list on n inputs: the clauses of gate g say
that wire n + g carries its value.
The satisfying assignments of the Tseitin formula of a well-formed gate list are its evaluations: every wire carries the value that the list computes from the inputs.
Satisfiability with a fixed input prefix #
The unit clause of a literal, padded to three literals.
The unit clause of a literal holds when the literal does.
An assignment satisfies tseitinSatCNF when it makes wire o true, agrees with x on the
first inputs and satisfies the Tseitin formula.
Satisfiability with a fixed input prefix: for a well-formed gate list on n inputs and a
wire o of it, tseitinSatCNF x n gates o is satisfiable exactly when some input of length n
extending x makes wire o true.
Circuit satisfiability as a formula: the Tseitin formula of a single-output De Morgan
circuit, with the output fixed to true and the inputs fixed to the bits of x, is satisfiable
exactly when some input extending x makes the circuit output true.
Size #
Every clause of tseitinSatCNF has exactly three literals.