Depth-two weighted threshold circuits and wire counts #
This module defines the canonical depth-two weighted threshold circuit constructor
WeightedThreshold.depthTwo (THR ∘ THR) and aggregated wire-count measures for weighted
threshold programs and circuits.
For any program p : Program signature n g, lineSupport (p.lines gate) is the set of wires
(original inputs and earlier gates) with nonzero aggregated coefficient in gate, decomposing
disjointly into inputSupport p gate and gateSupport p gate. The total active wire count
wireCount p is the sum of #(lineSupport (p.lines gate)) over all gates, and inputWireCount p
is the sum of #(inputSupport p gate) over all gates. Both are bounded by the syntactic slot
count p.cost Op.arity.
Main definitions #
Cslib.Circuits.Boolean.WeightedThreshold.lineSupport: active wires of a weighted threshold gate.Cslib.Circuits.Boolean.WeightedThreshold.inputWireCount,Cslib.Circuits.Boolean.WeightedThreshold.wireCount,Cslib.Circuits.Circuit.inputWireCount,Cslib.Circuits.Circuit.wireCount: aggregated direct-input and total wire counts.Cslib.Circuits.Boolean.WeightedThreshold.depthTwo: depth-two weighted threshold circuit built fromtop.aritybottom threshold gates and a single output threshold gatetop.Cslib.Circuits.Boolean.WeightedThreshold.altLinear: alternating linear function(u.negOnePow : ℤ) * uused in depth-two threshold telescoping constructions.
Main results #
Cslib.Circuits.Boolean.WeightedThreshold.card_lineSupport_eq,Cslib.Circuits.Boolean.WeightedThreshold.wireCount_eq_inputWireCount_add: active wires split into direct-input wires and internal gate-to-gate wires.Cslib.Circuits.Boolean.WeightedThreshold.card_lineSupport_le_arity,Cslib.Circuits.Boolean.WeightedThreshold.wireCount_le_cost_arity: active wire count is at most the syntactic argument-slot countp.cost Op.arity.Cslib.Circuits.Boolean.WeightedThreshold.eval_depthTwo,Cslib.Circuits.Boolean.WeightedThreshold.size_depthTwo,Cslib.Circuits.Boolean.WeightedThreshold.depth_depthTwo_le,Cslib.Circuits.Boolean.WeightedThreshold.wireCount_depthTwo_le: evaluation, gate count, depth, and wire count ofdepthTwo.Cslib.Circuits.Boolean.WeightedThreshold.lines_depthTwo_bottom_or_top: every gate ofdepthTwois a bottom gate reading only original inputs or the top gate reading only gates.Cslib.Circuits.Boolean.WeightedThreshold.negOnePow_mul_altLinear_add_sub_altLinear,Cslib.Circuits.Boolean.WeightedThreshold.sum_sub_mul_decide_le: alternating linear shift identity and integer interval telescoping into threshold indicators.Cslib.Circuits.Boolean.WeightedThreshold.altLinear_neg,Cslib.Circuits.Boolean.WeightedThreshold.altLinear_sq:altLinearis odd and preserves squares.Cslib.Circuits.Boolean.WeightedThreshold.altLinearTrunc,Cslib.Circuits.Boolean.WeightedThreshold.altLinearTruncErrorPair,Cslib.Circuits.Boolean.WeightedThreshold.sq_altLinearTrunc_sub_altLinear: the truncationf_R(u) = φ(u) [|u| ≤ R]ofaltLinear, the odd error of a reflected pair, and the squared truncation error;altLinearTrunc_eq_sum:f_Ras a staircase of2 R + 2threshold stepsaltLinearTruncStepataltLinearTruncThreshold.
References #
Active wire supports and wire counts #
A wire belongs to lineSupport line if and only if its aggregated weight lineWeight line w
is nonzero.
The number of active wires of a line is at most the syntactic arity of its operation.
The active wires of a program gate decompose disjointly into its active original inputs and its active predecessor gates.
The total active wire count of a program splits into its direct-input wire count and its internal gate-to-gate wire count.
The direct-input wire count of a program is at most its total active wire count.
Total number of active direct-input wires across all gates of a weighted threshold circuit.
Total number of active wires across all gates of a weighted threshold circuit.
The direct-input wire count of a circuit is at most its total active wire count.
The active wire count of a circuit is at most its syntactic argument-slot count
c.program.cost Op.arity.
Depth-two weighted threshold circuits (THR ∘ THR) #
A depth-two weighted threshold circuit (THR ∘ THR) with top.arity bottom threshold gates
bottom j on input selections args j, feeding into the single output threshold gate top.
Evaluating depthTwo top bottom args applies each bottom threshold gate bottom j to its
selected inputs x ∘ args j and feeds their Boolean outputs into top.
A depth-two circuit depthTwo top bottom args has top.arity bottom gates and one top gate,
for top.arity + 1 gates in total.
Every gate of depthTwo top bottom args is either a bottom gate bottom j, reading the
original inputs args j, or the top gate top, reading only gates.
Alternating linear function and integer interval telescoping #
The alternating linear function φ(u) = (-1) ^ u * u, defined via Int.negOnePow.
Int.negOnePow sends a finite sum of integers to the product of their powers of -1.
Alternating linear shift identity: for all integers X and t,
(-1) ^ X * φ(X + t) - φ(t) = X * (-1) ^ t. For even X this is
φ(X + t) - φ(t) = X * (-1) ^ t.
altLinearTrunc is odd.
The truncation error of the pair of reflected forms x + d and x - d:
(f_R - φ)(x + d) + (f_R - φ)(x - d). It is odd in x.
Integer interval telescoping: any function f : ℤ → ℤ on an integer u ∈ [ℓ, ℓ + L]
equals f ℓ plus the sum of its step differences weighted by threshold indicators
decide (ℓ + k + 1 ≤ u).
The staircase of f_R: f_R(u) = ∑_{k < 2 R + 2} (f_R(θ_k) - f_R(θ_k - 1)) [θ_k ≤ u] for
every integer u, with thresholds θ_k = -R + k.
Linear threshold functions on general finite domains and depth-one gate decomposition #
The active coordinate support of inputWeight p gate is inputSupport p gate.
Any gate of depth at most 1 in a weighted threshold program has zero aggregated weight from
every gate k : Fin g.
Any gate of depth at most 1 in a weighted threshold program evaluates as the linear threshold
function ltfEval (inputWeight p gate) (p.lines gate).op.threshold on the primary inputs x.