Sorting packed records by selected fields #
The routing construction uses one physical record layout but sorts the same records by several different tuples of fields. Since input and output wiring is free in the circuit model, a within-record bit permutation turns any such tuple into the prefix consumed by the verified Batcher sorter. This module builds that wrapper and proves that it sorts the selected key, preserves every complete physical record, and has exactly the cost of the underlying sorter.
Apply the same within-record bit permutation to every record in a flat row-major array. The permutation maps a virtual bit position to its physical position in the record.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reinterpret each physical record according to bitOrder.
Equations
- Algebraic.MassProduction.Sorting.reindexRecordBits bitOrder input = input ∘ Algebraic.MassProduction.Sorting.recordBitEquiv depth recordWidth bitOrder
Instances For
Reindexing every record by the same bit permutation preserves a record-level permutation relation.
Semantic sort by the first keyWidth virtual bits selected by
bitOrder, returning records in their original physical layout.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Explicit Batcher circuit sorting by an arbitrary fixed tuple of record bits. Both layout conversions are free wire permutations.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The selected virtual prefix is sorted in the requested direction.
Equations
- One or more equations did not get rendered due to their size.