Documentation

Complexitylib.Circuits.BinaryMinimum

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) :

Comparator-with-payload emits its decision bit before the original words.

@[simp]
theorem Complexity.Circuit.size_unsignedMin (width : ) [NeZero width] :
(unsignedMin width).size = 20 * width + 1

The unsigned-minimum selector has exact linear size.

@[simp]
theorem Complexity.Circuit.eval_unsignedMin (width : ) [NeZero width] (left right : BitString width) :
(unsignedMin width).eval (Fin.append left right) = left.unsignedMin right

The selector returns the smaller unsigned word, choosing left on ties.