Ledgers for gates of unbounded fan-in #
The frontier method charges each gate for its fan-in, so it cannot afford gates of unbounded fan-in. A few of them can nevertheless be absorbed, when they aggregate: when their outputs are determined by a product, in a commutative monoid, of contributions of the wires.
Mark a set of gates as special. A ledger for them in a commutative monoid M
(Frontier.Ledger) assigns to each wire and each of its values a contribution in M, and
reads off the value of every special gate from the product of the contributions of all wires.
The defining identity holds for every assignment of values to the wires, not only for runs of
the circuit. For example, k gates computing AND, OR, parity, or counts modulo m of their
arguments have a ledger in a product of k small monoids.
Guess and check. Replace each special gate by a constant placeholder (Frontier.erase):
the result has fan-in bounded by that of the other gates. To run it, guess the final product
m ∈ M and let each placeholder read its value from m (Frontier.Ledger.run). The guess is
consistent when the run reproduces it: when the product of the contributions of the run is m.
- A consistent guess yields the true run (
Frontier.Ledger.run_eq_trace): the placeholders hold the values that the special gates would compute from the run. - The product of the contributions of the true run is a consistent guess
(
Frontier.Ledger.run_total_trace).
So a circuit with special gates is an ordinary circuit, of bounded fan-in, together with one
global register in M: the guess, checked against an accumulated product. A sweep carries the
guess and the product accumulated so far in its messages, at a cost of 2 log |M|.
Main definitions #
Frontier.guessSignature σ: the signatureσwith a placeholder constant for every natural.Frontier.erase special p: the programpwith its special gates replaced by placeholders.Frontier.Ledger p I special M: a ledger for the special gates ofpinM.
Main results #
Frontier.Ledger.run_eq_trace,Frontier.Ledger.run_total_trace: guess and check.
The signature σ with a placeholder constant for every natural number.
Equations
Instances For
The interpretation I, with the placeholder k holding the value γ k.
Equations
- Complexity.Frontier.guessInterpretation I γ (Sum.inl o) x_2 = I o x_2
- Complexity.Frontier.guessInterpretation I γ (Sum.inr k) x_2 = γ k
Instances For
The line of the placeholder for gate g.
Instances For
An ordinary line, over the signature with placeholders.
Instances For
Erasing the special gates. The gate numbered g becomes the placeholder g when
special g, and is unchanged otherwise.
Equations
- Complexity.Frontier.erase special Cslib.Circuits.Program.empty = Cslib.Circuits.Program.empty
- Complexity.Frontier.erase special (p.gate line) = (Complexity.Frontier.erase special p).gate (if special s then Complexity.Frontier.placeholderLine s else Complexity.Frontier.liftLine line)
Instances For
The lines of an erased program.
Erasing the special gates leaves the fan-in of the others.
A ledger for the special gates of a program, in a commutative monoid M: a contribution
of each wire for each of its values, and a readout of the value of each special gate from the
product of all contributions. The identity holds for every assignment of values to the wires.
- contribution : Cslib.Circuits.Wire n s → U → M
The contribution of a wire carrying a value.
- readout : M → ℕ → U
The value of each special gate, read off the product of the contributions.
- readout_prod (v : Cslib.Circuits.Wire n s → U) (g : Fin s) : special ↑g → self.readout (∏ w : Cslib.Circuits.Wire n s, self.contribution w (v w)) ↑g = I (p.lines g).op fun (a : Fin (σ.Arity (p.lines g).op)) => v ((p.lines g).wires a)
The readout of a special gate is the gate applied to the values of its arguments.
Instances For
The product of the contributions of an assignment of values to the wires.
Equations
- L.total v = ∏ w : Cslib.Circuits.Wire n s, L.contribution w (v w)
Instances For
The run of the erased program, with the placeholders reading their values from the guess
m.
Equations
- L.run m x = (Complexity.Frontier.erase special p).trace (Complexity.Frontier.guessInterpretation I (L.readout m)) x
Instances For
The value of a special gate in the run with guess m is its readout.
The value of an ordinary gate in the run with guess m is the gate applied to its
arguments.
Guess and check, soundness. If the run with guess m reproduces m, it is the true
run.
Guess and check, completeness. The product of the contributions of the true run is a guess whose run is the true run.
A guessed ledger is consistent exactly when it is the ledger of the unique true run. This is the uniqueness needed when summing counts over ledger guesses.