Little-endian binary comparison #
This module exposes unsigned semantics for fixed-width little-endian words, a linear-size Boolean formula comparing two consecutive input words, and its verified compilation to a typed fan-in-two circuit.
Recursive most-significant-bit comparison agrees with unsigned natural comparison.
Comparing vectors of formulas compares their evaluated unsigned words.
The generalized comparator retains the exact linear size when every operand bit is represented by one formula node.
Constant-left comparison has the expected unsigned semantics.
Constant-right comparison has the expected unsigned semantics.
A constant-left comparator has exactly fifteen nodes per bit, plus its base constant.
A constant-right comparator has exactly fifteen nodes per bit, plus its base constant.
Every variable in a constant-left comparator lies in its right operand block.
Every variable in a constant-right comparator lies in its left operand block.
The unsigned-comparison formula has exactly fifteen nodes per input bit, plus its base constant.
The formula compares two consecutive fixed-width little-endian input words as unsigned naturals.
Exact raw gate count for the unsigned-comparison construction.
The raw unsigned-comparison construction is a valid single-output circuit for every positive word width.
Typed fan-in-two circuit comparing two consecutive width-bit unsigned
little-endian words.
Equations
- Complexity.Circuit.unsignedLE width = Complexity.CircuitCode.RawCircuit.toCircuit (width + width) (Complexity.CircuitCode.unsignedLERawCircuit width) ⋯
Instances For
Exact size of the typed unsigned-comparison circuit.
The typed circuit returns the unsigned comparison of its two input words.