Semantic circuit normalization #
Programs are hash-consed by the scalar functions computed at their gates. The result computes the same values, has no duplicate gate functions, and never has more gates. This is the semantic bridge needed for the factorial Shannon count.
Program normalization #
The result and semantic invariant produced by hash-consing a program's gate functions.
- gateCount : ℕ
Number of gates after semantic hash-consing.
Program with pairwise distinct gate functions.
- wireMap : Wire.Renaming n g self.gateCount
Input-fixing translation of old wires to their representatives.
- trace_eq (input : Fin n → U) (wire : Wire n g) : self.result.trace interpretation input (self.wireMap.apply wire) = program.trace interpretation input wire
Every translated wire computes its original value.
- injective_gateFunction : Function.Injective (self.result.gateFunction interpretation)
No two retained gates compute the same scalar function.
Normalization never adds gates.
- cost_le (operationCost : Algebraic.OperationCost σ) : cost operationCost self.result ≤ cost operationCost program
Normalization does not increase any nonnegative operation cost.
Instances For
Hash-cons a program by semantic gate function, preserving every wire value.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Circuit normalization #
A semantics-preserving circuit normalization with pairwise distinct internal gate functions.
- result : Circuit σ n m
The normalized circuit.
- injective_gateFunction : Function.Injective (self.result.program.gateFunction interpretation)
- cost_le (operationCost : Algebraic.OperationCost σ) : self.result.cost operationCost ≤ circuit.cost operationCost
Normalization does not increase any nonnegative operation cost.
Instances For
Number of internal gates after normalization.
Instances For
Normalize the program and rename the designated output wires.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Irredundant function families #
Functions computed by irredundant circuits with exactly g internal gates.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Functions computed by irredundant circuits with at most G internal gates.
Equations
- Cslib.Circuits.Circuit.irredundantFunctionsAtMost interpretation n m G = (Finset.range (G + 1)).biUnion fun (g : ℕ) => Cslib.Circuits.Circuit.irredundantFunctions interpretation n g m