Coefficient extraction as a stack recursion #
An entry of a packet tensor of the contraction algorithm of [OAI26k] expands a product of
at most L affine row factors and keeps the coefficient of a mode monomial. The source evaluates
it in time exp(O(L log s)) and polynomial space (§D.4.6, p. 63). This file gives that
evaluation as an instance of Cslib.Algorithms.StackRecursion.Scheme, on the coefficient lists
of A_p = (ℤ / 2 ^ p)[U] / (f).
The data (CoeffScheme.Terms) are, at a context x : C, the precision (p, fl), the list of
the (dense indices of the) modes, and the terms of the row factors: term x r none is the local
term of the row r, and term x r (some k) the coefficient of the mode k. A node of the
recursion is a context, the rows still to expand and the exponents still needed, as a dense list.
A node with rows r :: rs has m + 1 children for m modes: the local term (c = 0), and the
mode modes[c - 1] with its exponent lowered (c ≥ 1); it adds the products of their values
with the terms of r, skipping the modes with exponent zero. A node without rows is a leaf: one
when every exponent is zero, else zero.
CoeffScheme.Terms.valueis the value the recursion computes, andCoeffScheme.Terms.val_valueproves that its value inA_pisTensorNetwork.listCoeffalong the modes, at the values of the terms.CoeffScheme.Terms.eval_value: the derivation hasCoeffScheme.count m L ≤ (m + 2) ^ Lnodes forLrows (CoeffScheme.count_le) and at mostLopen calls, with nodes whose rows are a suffix of the root's and whose exponents are below the root's, and reduced values.
So the run has exp(O(L log m)) steps on a stack of at most L + 1 frames of polynomial size:
the time and space of §D.4.6. With polynomial-time data (CoeffScheme.Terms.PolyTime: the
precision with p in unary, the modes and the terms), every component of the scheme is
polynomial-time (CoeffScheme.Terms.scheme_polyTime), and one native machine computes value
on every node (CoeffScheme.Terms.valueCertificate), within time K (m + 2) ^ L Z ^ K and space
K Z ^ K for Z = n + m + Rv + 2, where n is the length of the node and Rv bounds the
reduced coefficient lists (CoeffScheme.Terms.valueCertificate_le).
Main definitions #
Cslib.Circuits.Frontier.CoeffScheme.Terms: the data of coefficient extraction.Cslib.Circuits.Frontier.CoeffScheme.Terms.value: its value.Cslib.Circuits.Frontier.CoeffScheme.Terms.scheme: the recursion scheme.Cslib.Circuits.Frontier.CoeffScheme.Terms.valueCertificate: one native machine forvalue.
Main results #
Cslib.Circuits.Frontier.CoeffScheme.Terms.val_value: the value islistCoeff.Cslib.Circuits.Frontier.CoeffScheme.Terms.eval_value: the derivation, its nodes and height.Cslib.Circuits.Frontier.CoeffScheme.count_le: the node count.Cslib.Circuits.Frontier.CoeffScheme.Terms.scheme_polyTime: polynomial-time components.Cslib.Circuits.Frontier.CoeffScheme.Terms.run_scheme: the machine computesvalue.Cslib.Circuits.Frontier.CoeffScheme.Terms.valueCertificate_le: its time and space.
References #
- OpenAI, The Exponential Time Hypothesis is False, §D.4.6 (p. 63).
The data of coefficient extraction: at a context x : C, the precision (p, fl) of the
coefficient lists, the list of the modes, and the terms of the row factors (term x r none the
local term of the row r, term x r (some k) the coefficient of the mode k).
The precision
(p, fl).The modes, as dense indices.
The terms of the row factors.
A node: a context, the rows still to expand, and the exponents still needed, as a dense list.
The number of nodes of the derivation for m modes and L rows.
The contribution of child c with value y at the row r: the local term times y for
c = 0; for c ≥ 1, zero when the mode has exponent zero, else its coefficient times y.
Correctness #
The value is listCoeff: along duplicate-free modes, the value in A_p of value is
TensorNetwork.listCoeff at the values of the terms and the exponents of the dense list.
The recursion scheme #
Coefficient extraction as a recursion scheme. A node with rows has m + 1 children,
counted by the accumulator, and adds their contributions at its first row; a node without rows
is a leaf.
The invariant at the root (x₀, (rows₀, γ₀)): nodes keep the context, have a suffix of the
rows and exponents of the same length below those of the root; frames also have a counter at
most m + 1 and a reduced value; values are reduced.
The leaf value is reduced.
The derivation of coefficient extraction. From a node whose rows are a suffix of the
root's and whose exponents are below the root's, the recursion computes value, with
count m L nodes for L rows and at most L open calls.
Polynomial-time components #
Polynomial-time data: the precision with p in unary, the modes, and the terms.
- term : Turing.MultiTapeTM.ComputableInPolyTime (fun (z : C × Rw × Option ℕ) => S.term z.1 z.2.1 z.2.2) (Turing.MultiTapeTM.encPair encC (Turing.MultiTapeTM.encPair encRw (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encNat))) (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)
The leaf is polynomial-time.
The components of coefficient extraction are polynomial-time.
The native machine and its resources #
One native machine for coefficient extraction, from polynomial-time data: the clocked run of the scheme from the node itself.
Coefficient extraction, as a native certificate for value on every node.
A node of the derivation from a root is at most as long as the root.
The resources of coefficient extraction. There is K such that on a node of length n
with m modes and L rows, if the reduced values of its precision are at most Rv bits long,
then with Z = n + m + Rv + 2 the time is at most K (m + 2) ^ L Z ^ K and the space at most
K Z ^ K: time exp(O(L log m)) times a polynomial, in polynomial space.