Correctness of depth-bounded Boolean circuit compilation #
After the two microlevels for depth k, every original wire of depth at most k is available
at its original position and has its original value. Deeper gates may remain placeholders.
This invariant covers unused gates and the input-only initial row.
Main results #
Cslib.Circuits.Boolean.Layered.getD_eval_schedule: every ready wire has its original value.Cslib.Circuits.Boolean.Layered.wellFormed_compile: every scheduled reference is valid.Cslib.Circuits.Boolean.Layered.outputs_valid_compile: output indices address the final row.Cslib.Circuits.Boolean.Layered.select_eval_compile: the ordered outputs equal the original circuit evaluation, including depth-zero wiring and repeated outputs.
Every compiled reference reads an available preceding-layer wire, including at depth zero.
Every original wire of depth at most the completed level is available at its original index.
The schedule preserves each completed original wire's value; deeper unused gates need not have been computed.
The actual compiler produces a well-formed layered schedule for every typed circuit.
All designated outputs select existing final wires. This also covers an empty schedule with dead gates, whose available final wires are only the original inputs.