De Morgan circuit restriction #
This module partially evaluates a De Morgan circuit after fixing one input. Every old wire is represented by a Boolean constant or by a possibly-negated wire of the residual circuit. Binary gates made constant, projections, or tautologies are deleted; every other binary gate is retained. The construction tracks the exact number of deleted charged gates.
Restricting a whole program #
Result of restricting a program. deleted records exactly the charged source
gates removed by partial evaluation.
- gateCount : ℕ
Number of residual internal gates, including free materialization gates.
Residual program on the remaining inputs.
- values : Wire (n + 1) g → ResidualValue n self.gateCount
Residual constant or signed wire representing every source wire.
- trace_eq (input : Fin n → Bool) (sourceWire : Wire (n + 1) g) : ResidualValue.eval self.result input (self.values sourceWire) = source.trace interpretation ((InputSubstitution.fix selected fixedValue).apply input) sourceWire
Every represented source wire has the correct restricted semantics.
The selected source input is represented by its fixed Boolean value.
- followsOrigins (sourceWire : Wire (n + 1) g) : self.values sourceWire = (origins source sourceWire).bindWires self.values
Partial evaluation follows every chain of zero-cost origin gates.
Charged internal gates deleted during partial evaluation.
Deleted gates account exactly for the charged-cost decrease.
Instances For
Evaluate a source line through a restriction of its preceding program.
Evaluation of a binary source line from its residual arguments.
Restriction of the empty program.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Append a free source gate represented by an existing residual value. No charged gate is added to either the result or the deletion set.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Append a charged source gate whose restricted value is already available. The new source gate is recorded as deleted.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Append a charged source gate retained by partial evaluation. The materializer's wire embedding is propagated to all earlier residual values.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Restrict one charged binary gate after its preceding program.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Partial-evaluate every gate of a program after fixing one input.
Equations
- One or more equations did not get rendered due to their size.
- Algebraic.DeMorgan.restrictProgram selected fixedValue Cslib.Circuits.Program.empty = Algebraic.DeMorgan.ProgramRestriction.empty selected fixedValue