Unsigned binary minimum #
This module exposes a linear-size fan-in-two circuit that compares two little-endian words and returns the word with smaller unsigned value.
@[simp]
Selecting the smaller word also selects the minimum unsigned value.
@[simp]
The comparator-with-payload circuit has exact linear size.
@[simp]
theorem
Complexity.Circuit.eval_unsignedLEWithPayload
(width : ℕ)
[NeZero width]
(left right : BitString width)
:
(unsignedLEWithPayload width).eval (Fin.append left right) = BitString.multiplexerInput (decide (left.unsignedValue ≤ right.unsignedValue)) left right
Comparator-with-payload emits its decision bit before the original words.
@[simp]
The unsigned-minimum selector has exact linear size.
@[simp]
theorem
Complexity.Circuit.eval_unsignedMin
(width : ℕ)
[NeZero width]
(left right : BitString width)
:
The selector returns the smaller unsigned word, choosing left on ties.