Skip to main content

Module bitblast

Module bitblast 

Source
Expand description

Bit-blasting: BoundedExpr datapath (bitvector) operations → boolean ProofExpr.

A bitvector is represented LSB-first as a Vec<Bit>, each Bit either a known constant or a boolean ProofExpr (a signal bit name#i, or a gate). Every combinator constant-folds, so a constant operand collapses gates instead of emitting them — the CNF stays small. Each operation is the textbook circuit: ripple-carry add/sub, array multiplier, barrel shifters, magnitude/signed comparators, slice and concat.

This is the data-path half of the certified-prover seam: combined with the Boolean lowering in super::sva_to_proof, multi-bit hardware obligations reduce to a propositional formula our CDCL→RUP tiers discharge — in the browser, no Z3.

Structs§

BlastSize
The cost of turning one blasted obligation into a ProofExpr.
BlastWork
★ THE BLASTER’S WORK, COUNTED — not timed. What a blast costs is three walks: the datapath expression it is handed (every node blasted once — a node blasted twice doubles the work per level above it), the gates it allocates (no gate is shared by value, so every allocation is a gate), and the memoised walk that prices the result (every gate visited once per edge into it — a walk that forgot its memo walks the tree). Each is a count a lock can bound by the size of what it walks, and none of them moves when the machine is busy.
Pred
A blasted PREDICATE — one bit of the shared gate DAG.
Word
A blasted datapath VALUE — its bits, LSB-first, in the shared gate DAG. Cloning is a refcount bump per bit, never a copy of the circuit.

Enums§

BlastRefusal
Why a bit-blast produced no formula.

Constants§

BLAST_BUDGET_NODES
How many ProofExpr nodes we are willing to materialise for ONE bit-blasted obligation.

Functions§

assert_not
Assert ¬p into cnf — the refutation obligation for a miter, clausified STRAIGHT FROM THE GATE DAG. Emits exactly the clauses Cnf::assert(&Not(pred_to_proof(p))) emits, in the same order, over the same variables; it just never builds the tree to read them off.
blast_pred
Blast a boolean-VALUED BoundedExpr into the shared DAG.
blast_size
What blasting e costs — gates allocated vs. ProofExpr nodes a materialisation would hold — without materialising it. None when e has no circuit. The instrument the budget reads, and the one a lock reads to prove the blast stays linear in the datapath.
blast_word
Blast a bitvector-VALUED BoundedExpr into the shared DAG — the bridge for a caller that still speaks the tree form.
blast_work
Run f and return what it returns with the blaster work it did on this thread.
lower_bool
Lower a boolean-VALUED datapath comparison to a ProofExpr, or None if it has no circuit or its materialisation is over BLAST_BUDGET_NODES. Use lower_bool_bounded when the caller must tell those two apart by name.
lower_bool_bounded
lower_bool with the refusal NAMED. The circuit is built in the shared DAG and PRICED before anything is materialised, so an obligation past the budget costs the DAG — never the tree, and never the allocator.
lower_bool_within
lower_bool_bounded against an EXPLICIT ceiling. The production ceiling is BLAST_BUDGET_NODES; a caller passing its own is how a lock proves the guard is live code — shrink the ceiling and an obligation that certifies must come back Budget, with the same arithmetic, not a special case.
pred_size
What this predicate’s circuit costs — gates allocated vs. the ProofExpr tree a materialisation would hold. The instrument a budget reads.
pred_to_proof
Materialise a predicate’s ProofExpr tree. The escape hatch for a consumer that genuinely needs the tree (an SMT printer, a ProofExpr-shaped prover call) — and the thing every path that only wants a CNF must NOT call, because the tree is exponentially larger than the circuit.
word_binary
One of the width-preserving binary circuits (And..AShr, and unary Not on a). None when the widths disagree or the op is boolean-valued — use word_compare for those.
word_compare
One of the boolean-valued comparisons (Eq, ULt, SLt). None for a value-producing op or a width mismatch.
word_const
A constant word, truncated to width.
word_select
The mux tile: cond ? t : e, bit by bit — the same 1-bit select BitVecIte blasts through, so a predicated select built here and one built from a BoundedExpr are the same circuit.
word_size
What a whole WORD’s circuit costs, counting the DAG the bits SHARE exactly once — an adder’s carry chain feeds every bit above it, so pricing the bits separately would count the same gates over and over. The instrument a datapath budget reads before a miter exists.
word_var
A named input word: the bits name#0 .. name#(width-1), the same signal spelling blast_word gives a BitVecVar — so a circuit built here and one blasted from a BoundedExpr share a variable namespace and can be mitered against each other.
words_equal
The miter: a == b over every bit. None on a width mismatch.