Documentation

Complexitylib.Circuits.Threshold

Threshold circuits #

Basis.threshold consists of unbounded-fan-in unweighted threshold gates. Cutoff zero is constant true, cutoff one is disjunction, cutoff equal to fan-in is conjunction, and cutoff n / 2 + 1 is strict majority.

The exact basis map Basis.andOrToThresholdHom shows that every unbounded AND/OR circuit becomes a threshold circuit without changing wiring, size, depth, negation flags, or semantics.

A true-input count never exceeds gate arity.

theorem Complexity.ThresholdOp.eval_conjunction (n : ) (inputs : BitString n) :
(conjunction n).eval n inputs = AndOrOp.and.eval n inputs

Cutoff equal to fan-in computes conjunction.

Cutoff one computes disjunction, including false at arity zero.

theorem Complexity.ThresholdOp.eval_majority (n : ) (inputs : BitString n) :
(majority n).eval n inputs = decide (n / 2 < Fin.countP inputs)

The designated majority operation is strict majority: more than half of the inputs must be true.

theorem Complexity.ThresholdOp.eval_zero (n : ) (inputs : BitString n) :
{ cutoff := 0 }.eval n inputs = true

Cutoff zero is the constant-true operation.

theorem Complexity.ThresholdOp.eval_of_arity_lt {cutoff n : } (hcutoff : n < cutoff) (inputs : BitString n) :
{ cutoff := cutoff }.eval n inputs = false

A cutoff strictly larger than arity is constant false.

Exact, arity-dependent embedding of unbounded AND/OR into threshold gates.

Equations
Instances For