Integer threshold gates in logarithmic depth #
An integer threshold gate (Cslib.Circuits.Boolean.IntThreshold.Op) is true when ∑ uᵢ xᵢ > θ.
Reading each input with a negative weight as its negation, the condition becomes T ≤ ∑ |uᵢ| ℓᵢ
for the literals ℓᵢ and a target T.
With W bits for the sum and the target, the masked words |uᵢ| · ℓᵢ and the offset 2 ^ W - T
are summed by a balanced carry-save tree with a logarithmic-depth finishing adder
(Cslib.Circuits.Boolean.sumPairs), and bit W of the result decides the gate
(Cslib.Circuits.Boolean.IntThreshold.Op.eval_deMorganCircuit). The De Morgan circuit has
O(k W²) gates and depth O(log k + log W) for k inputs
(Cslib.Circuits.Boolean.IntThreshold.Op.size_deMorganCircuit_le,
Cslib.Circuits.Boolean.IntThreshold.Op.depth_deMorganCircuit_le).
Main definitions #
Cslib.Circuits.Boolean.IntThreshold.Op,Cslib.Circuits.Boolean.IntThreshold.signature,Cslib.Circuits.Boolean.IntThreshold.interpretation: integer threshold gates.Cslib.Circuits.Boolean.IntThreshold.Op.deMorganCircuit: the De Morgan circuit of a gate.
Main results #
Cslib.Circuits.Boolean.IntThreshold.Op.eval_deMorganCircuit: correctness.Cslib.Circuits.Boolean.IntThreshold.Op.size_deMorganCircuit_le,Cslib.Circuits.Boolean.IntThreshold.Op.depth_deMorganCircuit_le,Cslib.Circuits.Boolean.IntThreshold.Op.width_le: size, depth and width.
References #
The signature of integer threshold gates.
An integer threshold gate is true when the weighted sum of its inputs exceeds its bias.
The word width: every literal sum and the target are below 2 ^ width.
The circuit #
The De Morgan circuit of an integer threshold gate: a constant true when the target is
at most zero, and otherwise bit width of the sum of the masked words and the offset.
The De Morgan circuit of an integer threshold gate computes it.