The native contraction recursion as a stack recursion #
The recursion of Theorem D.1 of [OAI26k] (Appendix D.4.7, p. 64), as a depth-first stack
recursion (Cslib.Algorithms.StackRecursion.Scheme) over calls. A call
(FastContraction.Call T) is a described network (DescribedNetwork (VertexDesc T)) whose first
r vertices are its rows, with the schedule's scale s (the number of edges of the root, since
the machine sees no other size), its depth d, an edge bound, its precision p and the
coefficients fl of the modulus f. The vertices of the input network have descriptors of a type
T, read by an entry procedure ev : T → List Bool → List ℕ (VertexDesc.entry ev); only the
leaves and the correctness statement read them, so the recursion is the same for every T.
Active calls and leaves. A call with M edges is active (FastContraction.active) when the
schedule makes it an active call (ContractionSchedule.callParams, with a = slotBits s d,
u = taper s d and h = ⌈3 M / u⌉), its parameters satisfy the hypotheses of Lemma D.5, its
degrees are at most degreeBound s, the M (2 L - 1) + 1 interpolation points are distinct
residues (n ≤ 2 ^ e for e = deg f), and M is below its edge bound. Every other call is a leaf,
evaluated by direct summation over the coefficient lists of A_p (FastContraction.leafValue ev).
A child receives its parent's number of edges as its bound, so the recursion terminates, as
TensorNetwork.contractRec does; a child that is not smaller is a leaf.
An active call walks the children (t, k, β, g) with the cursor of
Cslib.Circuits.Frontier.ChildCursor, over the nodes ts of positive multiplicity
(FastContraction.nodes), the points, the mode tuples of weight below p_t and the 64 groups.
The child at a cursor state is given by a child builder mk, which computes the child's rows and
network (the native child of §D.4.6). The call absorbs the children's values with the operations of
A_N at the common precision N = p + Δ' (FastContraction.wide), where
Δ' = (a + 1) 2 ^ (a + 1) h u + 8 h 2 ^ a + 8 M (a + 1) bounds both the shift of Lemma D.5 and
every node precision p_t - p; it then places the sums at the rows ts[i] of the table of native
recovery (FastContraction.table) and recovers its value with
Cslib.Circuits.Frontier.NativeRecovery.recover.
Values and derivations. The values of the scheme are tagged with the depth.
FastContraction.value is the value of a call by well-founded recursion on the edge bound, and
FastContraction.exists_eval derives it in the scheme, so a run returning a value tagged 0 from a
root at depth 0 returns value of the root, for every fuel (FastContraction.eq_value_of_run).
Correctness (FastContraction.val_value): if the step of an active call is correct
(FastContraction.StepCorrect, the correctness of one call from the correctness of its children,
through Lemma D.5) and a well-formedness predicate passes to the children, then every well-formed
call computes the contraction of its network in A_p.
Main definitions #
Cslib.Circuits.Frontier.FastContraction.Call: a call.Cslib.Circuits.Frontier.FastContraction.active: whether a call is active.Cslib.Circuits.Frontier.FastContraction.scheme: the stack recursion.Cslib.Circuits.Frontier.FastContraction.value: the value of a call.Cslib.Circuits.Frontier.FastContraction.StepCorrect: the correctness of one active call.
Main results #
Cslib.Circuits.Frontier.FastContraction.pow_slots_le_edges_of_active: an active call has at least64 ^ aedges.Cslib.Circuits.Frontier.FastContraction.exists_eval: derivations of the values.Cslib.Circuits.Frontier.FastContraction.eq_value_of_run: a tagged value returned by the run is the root's value.Cslib.Circuits.Frontier.FastContraction.val_table_runLoop: the table of an active call holds, at each node's precision, the sums over the mode tuples of the products of the children's values.Cslib.Circuits.Frontier.FastContraction.val_value: correctness from the step.
References #
- OpenAI, The Exponential Time Hypothesis is False, Appendix D.4.5–D.4.7 (pp. 62–64).
The parameters of a call: the scale s, the depth d, the edge bound, the precision p, the
coefficients fl of the modulus and the number r of rows.
A call of the recursion: its parameters and its network over root descriptors T, whose
first r vertices are its rows.
The scale s of the schedule.
The depth.
The edge bound: the call is a leaf unless it has fewer edges.
The precision p.
The number of rows.
The network.
The number M of edges.
The data of a call #
The packets have 2 ^ a slots, a = slotBits s d.
The number u = taper s d of levels of positive multiplicity.
The multiplicity step h = ⌈3 M / u⌉.
The number n = M (2 L - 1) + 1 of interpolation points.
Whether a call is active: the schedule makes it an active call, its parameters satisfy
Lemma D.5 (1 ≤ u ≤ M, u ≤ a), its degrees are at most degreeBound s, its interpolation
points are distinct residues (n ≤ 2 ^ e), and it has fewer edges than its bound.
The number of rows capped at the number of vertices. The packing and the child builder use it
in place of the number of rows: it changes nothing for a rows-first network with an edge
(FastContraction.rowCap_eq), and it keeps them polynomial-time on every call, since the number
of rows is stored in binary and the packing lists one word per row.
The shift Δ' = (a + 1) 2 ^ (a + 1) h u + 8 h 2 ^ a + 8 M (a + 1), which bounds the shift
(a + 1) ∑_t q_t of Lemma D.5 and every p_t - p.
The common precision N = p + Δ' of the accumulator.
The binary digits of k, as a coefficient list of length e: the lift of the k-th
residue.
The cursor's list of children.
The accumulator after absorbing the values vals of the children in order.
The value of an active call from its final accumulator: native recovery from the table of the stored values.
The scheme #
The child call at a cursor state c = (i, k, β, g): the rows and the network given by the
child builder mk, at depth d + 1, with the parent's number of edges as its bound and the
node's precision p_i.
The accumulator of a call: the cursor state of the next child, if any, and the accumulator of the cursor.
The recursion as a stack recursion, with values tagged by the depth.
The value of a call, by well-founded recursion on the edge bound: the leaf value, or the recovery from the values of the children.
Derivations #
An active call has at least 64 ^ a edges, the hypothesis r ^ a ≤ M of the native packing
(PacketPacking.nativePacking_eq), which active implies: with λ = ⌊log₂ s⌋, 1 ≤ u forces
λ ≥ 1, a ≤ λ / 32768 (ContractionSchedule.slotBits_le), and
M > leafSize s = ⌊s / ⌊√λ⌋⌋ ≥ 2 ^ (6 ⌊λ / 32768⌋), since ⌊√λ⌋ ≤ 2 ^ ((λ + 1) / 2).
The frames of an active call along its children: the cursor at the c-th child, with the
values vals of the earlier children absorbed.
The loop of an active call walks its children: from start, the c-th frame asks for the
child at the c-th cursor state, absorbing it gives the next frame, and the last frame stops.
The invariant of the derivation from a root x₀ at depth 0: the only node at depth 0 is
the root, and a value tagged 0 is the root's value.
Derivations of the values. Every call satisfying the invariant of a root x₀ has a
derivation of its tagged value.
A tagged value returned by the run is the root's value, for any fuel: if the root is at
depth 0 and the run returns (0, y), then y is the value of the root.
The stored values #
The values stored by an active call. At the j-th node of positive multiplicity and the
i-th point, the table of native recovery holds, at the node's precision p_j, the sum over the
mode tuples of weight below p_j of the products over the 64 groups of the children's values:
the hypothesis of the one-call correctness of Lemma D.5 at that node.
Correctness #
The correctness of one active call for a well-formedness predicate WF: at a well-formed
active call, if the values vals of the children are their contractions in A_{p_i}, then the
recovered value is the contraction of the call's network in A_p.
Well-formedness passes to the children of an active call.
Correctness of the recursion. If the step of an active call is correct and
well-formedness passes to the children, every well-formed call computes the contraction of its
network in A_p.