Building circuits from available functions #
An existing circuit can be inserted into a synthesis construction by wiring its inputs to available functions. Its outputs then become available at a cost of its number of gates, while all previously computed functions remain available. Repeated inputs share their original wires.
Synthesis.Builder accumulates available wires and gate costs through Builder.start and
Builder.add. Each appended construction is charged once; selecting and reusing wires is free.
Builder.finish selects the outputs and checks the requested bound. These operations compose
ordinary Synthesis certificates; they do not search for a cheaper construction.
Main definitions #
Cslib.Circuits.Synthesis.Builder: available wires and their accumulated synthesis bound.
Main results #
Cslib.Circuits.Synthesis.circuit: applying a circuit costs its number of gates.Cslib.Circuits.Synthesis.Builder.finish: select outputs within a requested gate budget.
References #
- Adapted from MassProduction/Nonuniform/FlagSelection.lean in S. Schlesinger, Boolean circuit mass production formalization.
A circuit whose inputs are fed by available functions computes its outputs with as many additional gates as it has. The functions feeding the inputs may repeat.
A sequence of certified constructions, including every wire available along the way.
Original sources and all outputs built so far.
- cost : ℕ
Sum of the appended constructions' gate budgets.
The accumulated synthesis certificate.
Instances For
Begin with the source wires, without adding gates.
Instances For
Append a construction whose inputs are available, retaining both old and new wires.
Instances For
Select outputs from the final wires and enlarge the accumulated budget.