Explicit Boolean record comparators #
The scheduler and router need oblivious sorting on fixed-width records. This
module supplies the local building block: a lexicographic compare--exchange
over the first keyWidth bits of two records. Its De Morgan circuit is
explicit, its semantics are tied to Mathlib's lexicographic linear order, and
its cost is polynomial. Network topology is developed separately.
Row-major index of one bit in a pair of equal-width records.
Equations
- Algebraic.MassProduction.Sorting.recordPairIndex side bit = finProdFinEquiv (side, bit)
Instances For
Select one of the two records from a paired input.
Equations
- Algebraic.MassProduction.Sorting.recordPairSide input side bit = input (Algebraic.MassProduction.Sorting.recordPairIndex side bit)
Instances For
Select the first keyWidth bits of one record.
Equations
- Algebraic.MassProduction.Sorting.recordKey keyFits input side bit = input (Algebraic.MassProduction.Sorting.recordPairIndex side (Fin.castLE keyFits bit))
Instances For
XNOR expression for one pair of key bits.
Equations
- One or more equations did not get rendered due to their size.
Instances For
All key coordinates before pivot are equal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One possible first differing coordinate witnessing lexicographic strict inequality.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lexicographic strict-comparison expression for two record keys.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The Boolean swap flag is true exactly when the right key is lexicographically smaller than the left key.
Equations
- Algebraic.MassProduction.Sorting.compareSwapFlag keyFits input = Algebraic.DeMorgan.Expression.eval input (Algebraic.MassProduction.Sorting.keyLessExpression keyFits 1 0)
Instances For
A Boolean multiplexer expression.
Equations
Instances For
One output bit of ascending compare--exchange.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Gate count of one compiled compare--exchange output bit.
Equations
- Algebraic.MassProduction.Sorting.compareSwapBitGateCount keyFits output = (Algebraic.MassProduction.Sorting.compareSwapBitExpression keyFits output).gateCount
Instances For
Total emitted gate count of one compiled compare--exchange.
Equations
- Algebraic.MassProduction.Sorting.compareSwapGateCount keyFits = ∑ output : Fin (2 * recordWidth), Algebraic.MassProduction.Sorting.compareSwapBitGateCount keyFits output
Instances For
Explicit ascending compare--exchange circuit on two packed records.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The compiled compare--exchange emits exactly compareSwapGateCount
gates.
Direct cost formula for a tree-shaped Boolean multiplexer.
Explicit polynomial bound for one compare--exchange circuit.
Ascending compare--exchange orders its two output keys.
Compare--exchange either preserves the record pair or swaps its two members, according to the comparison flag.