Circuit substitution #
A wire substitution may replace both formal inputs and gate wires. The causal
operation in this module is Program.instantiate: it appends a source program
to an ambient program, maps formal inputs to ambient wires, and allocates every
source gate in its original order. Circuits inherit the same operation by
mapping their designated output wires. Sequential composition Circuit.comp is
CSLib's; this module adds its cost law.
Apply a wire substitution.
Equations
Instances For
Include a wire namespace into one with k additional gates.
Equations
- Cslib.Circuits.Wire.Renaming.castAdd k = { gates := fun (gate : Fin g) => Cslib.Circuits.Wire.gate (Fin.castAdd k gate) }
Instances For
Map formal inputs into an ambient program and source gates to the freshly appended block of gates.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Append source to ambient, replacing every formal source input by the
corresponding ambient wire.
Equations
- Cslib.Circuits.Program.empty.instantiate ambient inputWires = ambient
- (source_2.gate line).instantiate ambient inputWires = (source_2.instantiate ambient inputWires).gate (line.mapWires (Cslib.Circuits.Wire.Substitution.append inputWires gateCount).apply)
Instances For
Instantiation leaves every ambient wire unchanged, up to inclusion into the extended wire namespace.
Instantiation evaluates every source wire under the values supplied by the ambient input wires.
Instantiate a circuit after an ambient program.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Circuit instantiation preserves evaluation exactly.
Circuit instantiation has exactly additive gate cost.
Continuing a program by another has exactly additive gate cost.