The charged dependency graph #
The predicates in this module describe the circuit graph after contracting zero-cost gates. A charged gate reads an input or another charged gate when one of its raw argument wires has that charged origin.
An internal gate is charged exactly when it is an AND or OR gate.
Equations
- Algebraic.DeMorgan.ChargedGate program gate = (Algebraic.DeMorgan.binaryCost (program.lines gate).op = 1)
Instances For
A contracted origin is simple when it is a constant or a signed input.
Equations
- Algebraic.DeMorgan.SimpleOrigin (Algebraic.DeMorgan.ResidualValue.constant value) = True
- Algebraic.DeMorgan.SimpleOrigin (Algebraic.DeMorgan.ResidualValue.wire negated wire) = ∃ (input : Fin n), wire = Cslib.Circuits.Wire.input input
Instances For
Simplicity is preserved when a program is extended by one gate.
A simple origin cannot be the output of a charged gate.
An initial charged gate, presented with its two named arguments. Its arguments have no charged predecessors after contracting the free gates.
- gate : Fin g
The selected gate.
- op : BinaryOp
Its binary operation.
- left : Wire n g
Its left input wire.
- right : Wire n g
Its right input wire.
The widened program line has the claimed binary presentation.
- left_simple : SimpleOrigin (origins program self.left)
The left contracted origin is a constant or literal.
- right_simple : SimpleOrigin (origins program self.right)
The right contracted origin is a constant or literal.
Instances For
Every initial charged gate is charged in the weighted De Morgan model.
The four structural possibilities for an initial charged gate.
- constantLeft {n g : ℕ} {program : Program signature n g} {initial : InitialChargedGate program} (value : Bool) : origins program initial.left = ResidualValue.constant value → InitialGatePattern initial
- constantRight {n g : ℕ} {program : Program signature n g} {initial : InitialChargedGate program} (value : Bool) : origins program initial.right = ResidualValue.constant value → InitialGatePattern initial
- singleInput {n g : ℕ} {program : Program signature n g} {initial : InitialChargedGate program} (input : Fin n) (leftNegated rightNegated : Bool) : origins program initial.left = ResidualValue.wire leftNegated (Wire.input input) → origins program initial.right = ResidualValue.wire rightNegated (Wire.input input) → InitialGatePattern initial
- distinctInputs {n g : ℕ} {program : Program signature n g} {initial : InitialChargedGate program} (leftInput rightInput : Fin n) (leftNegated rightNegated : Bool) : leftInput ≠ rightInput → origins program initial.left = ResidualValue.wire leftNegated (Wire.input leftInput) → origins program initial.right = ResidualValue.wire rightNegated (Wire.input rightInput) → InitialGatePattern initial
Instances For
Classify the two simple origins of an initial charged gate.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The left literal of an initial gate gives a direct-input edge.
The right literal of an initial gate gives a direct-input edge.
Two literals of the same input make an initial gate a single-input gate.
No charged predecessor feeds an initial charged gate.
Every nonempty collection of charged gates has an initial member.
Extend a direct-input edge through an appended program gate.
Reflect a direct-input edge from an appended program to its prefix.
Expose the prefix-level literal read by a charged newly-appended gate.
Reflect a single-input charged gate from an appended program to its prefix.
Expose the prefix-level literals of a newly appended single-input gate.
Build a direct-input edge into a newly appended charged gate.
Reflect a charged edge from an appended program to its prefix.
Build a charged edge into a newly appended charged gate.