Documentation

Complexitylib.Algebraic.Basis.DeMorgan.Threshold

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
Instances For
    theorem Algebraic.DeMorgan.inputRank_lt {n : ℕ} (input : Fin n → Bool) :
    inputRank input < 2 ^ n

    Input ranks lie below the number of truth-table coordinates.

    The numerical ordering distinguishes all input assignments.

    A comparison with a fixed threshold, simplifying constant subexpressions.

    Equations
    Instances For
      theorem Algebraic.DeMorgan.thresholdExpression_eval {n : ℕ} (threshold : ℕ) (input : Fin n → Bool) :
      Expression.eval input (thresholdExpression n threshold) = decide (threshold ≤ inputRank input)

      The threshold expression tests the input's numerical rank.

      theorem Algebraic.DeMorgan.thresholdExpression_gateCount_le {n : ℕ} (threshold : ℕ) (positive : 0 < threshold) (interior : threshold < 2 ^ n) :

      An interior threshold needs at most one fewer gate than input bits.