Circuit wires and renamings #
A Wire inputCount gateCount refers to an original input or an internal gate.
Wire.Renaming fixes the original inputs and maps each gate to an input or gate
in the target namespace. This file provides identity and composition, extension
by a gate, replacement of the last gate, and renaming by a permutation.
A wire is either an original input or the output of an earlier gate.
Equations
- Cslib.Circuits.Wire inputCount gateCount = Fin (inputCount + gateCount)
Instances For
Regard an original input as a wire.
Equations
- Cslib.Circuits.Wire.input input = Fin.castAdd gateCount input
Instances For
Regard a gate output as a wire.
Equations
- Cslib.Circuits.Wire.gate gate = Fin.natAdd inputCount gate
Instances For
A renaming of gate wires that fixes every original input. Gate wires may be sent to either inputs or gates in the target namespace.
The target wire representing each source gate.
Instances For
Apply an input-fixing wire renaming.
Equations
- ρ.apply i = Fin.addCases Cslib.Circuits.Wire.input ρ.gates i
Instances For
The identity wire renaming.
Equations
Instances For
Compose input-fixing wire renamings.
Instances For
Include all wires into a namespace with one additional gate.
Equations
- Cslib.Circuits.Wire.Renaming.castSucc = { gates := fun (gate : Fin gateCount) => Cslib.Circuits.Wire.gate gate.castSucc }
Instances For
Extend a renaming while replacing the new last gate by an existing wire.
Equations
Instances For
Extend a renaming and retain the new last gate as a fresh target gate.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Rename gate wires by a permutation.
Equations
- Cslib.Circuits.Wire.Renaming.ofPermutation permutation = { gates := fun (gate : Fin gateCount) => Cslib.Circuits.Wire.gate (permutation gate) }
Instances For
A source and target gate valuation agree along a renaming when they agree on the image of every source gate. Original inputs agree automatically.