Generating repeated Boolean squaring in logarithmic space #
A generator enumerates the squarings, the matrix entries in each squaring, and the intermediate vertex in each entry. It writes the binary wire numbers in program order.
Main results #
computableInLogSpace_iterate_squareGateListemits all gate lines with a prescribed logspace relabeling of the wire addresses.
References #
The circuit is the Boolean matrix-powering construction of Arora and Barak, Chapter 6, Exercise 9(b–c), 2007 draft.
theorem Cslib.Circuits.Boolean.computableInLogSpace_iterate_squareGateList {N rounds : ℕ → ℕ} {wire : ℕ → ℕ → ℕ} (hN : Turing.MultiTapeTM.ComputableInLogSpace N Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hr : Turing.MultiTapeTM.ComputableInLogSpace rounds Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hw :
Turing.MultiTapeTM.ComputableInLogSpace (fun (p : ℕ × ℕ) => wire p.1 p.2)
(Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) Turing.MultiTapeTM.encNat) :
Turing.MultiTapeTM.ComputableInLogSpace
(fun (n : ℕ) =>
(List.ofFn fun (r : Fin (rounds n)) =>
List.map (fun (g : Unbounded.Op × List ℕ) => (g.1, List.map (wire n) g.2))
(squareGateList (N n) (N n * N n + ↑r * (N n ^ 2 * (N n + 1))) fun (i : Fin (N n * N n)) =>
squareOutputWire (N n) ↑r ↑i)).flatten)
Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encList (Circuit.encGate Unbounded.encOp))
Logspace generation of the gate list of repeated matrix squaring, after applying the given wire numbering. Numerical dimensions, round counts and address arguments are unary. The generated circuit lines use native operation tags and binary wire addresses.