Circuits for comparison with a fixed numerical threshold #
The first input bit is the most significant bit. An interior threshold on
n bits has a constant-free AND/OR expression with at most n - 1 gates.
The two endpoint thresholds are represented by Boolean constants.
Interpret a Boolean input as a natural number, most significant bit first.
Equations
- Algebraic.DeMorgan.inputRank x_2 = 0
- Algebraic.DeMorgan.inputRank input = (if input 0 = true then 2 ^ n else 0) + Algebraic.DeMorgan.inputRank (Fin.tail input)
Instances For
The numerical ordering distinguishes all input assignments.
A comparison with a fixed threshold, simplifying constant subexpressions.
Equations
- One or more equations did not get rendered due to their size.
- Algebraic.DeMorgan.thresholdExpression 0 x✝ = Algebraic.DeMorgan.Expression.constant (decide (x✝ = 0))
Instances For
theorem
Algebraic.DeMorgan.thresholdExpression_eval
{n : ℕ}
(threshold : ℕ)
(input : Fin n → Bool)
:
The threshold expression tests the input's numerical rank.