Correctness of Boolean-formula raw compilation #
This module exposes the exact size, topological well-formedness, and iterative
evaluation guarantees for BoolFormula.compileRaw. A fragment starts after an
explicit number of available wires, so its variables may refer directly to
primary inputs or to any gate emitted by an earlier fragment.
Correctness assumes at least one available wire because constant gates use an existing wire together with its negation. This matches positive-arity typed circuits; circuit families handle their zero-input member separately.
Main definitions and results #
BoolFormula.compileRaw: the existing-wire-aware proof-free compiler.BoolFormula.length_compileRaw: exactly one gate is emitted per formula node.BoolFormula.topologicallyWellFormed_compileRaw: all new references point backward.BoolFormula.evalAux?_compileRaw_of_agree: sparse-variable semantic correctness;evalAux?_compileRawis the all-existing-wires corollary.
Formula compilation emits exactly one raw gate per syntax-tree node.
The output wire lies inside the newly compiled fragment.
A compiled formula's output is never before its existing-wire prefix.
The output wire is the final wire emitted by formula compilation.
If every variable names an existing wire, a compiled fragment only references the existing prefix or earlier gates in the same fragment.
Compiled formula evaluation only requires semantic agreement on the wires
actually named by the formula. It appends exactly formula.size entries,
preserves the existing memo array, and places the formula value on the final
new wire.
Compiled formula evaluation appends exactly formula.size wires, preserves
the entire existing memo array, and puts the semantic value on the last new
wire. Every existing memo entry must realize the corresponding value of the
absolute-wire assignment.