Contracting a network with described tensors by direct summation #
The leaves of the recursion in the proof of Theorem D.1 of [OAI26k] are summed directly
over all Boolean edge assignments (Appendix D.4.7, p. 64), but their tensors are not tables: a
packet vertex has up to 2 L ports, so its table would be superpolynomial, and its entries are
computed from a description instead (Appendix D.4.6, p. 63). A described network
(DescribedNetwork T) has, for each vertex, its ports and a descriptor t : T of its tensor,
whose entry at the bits bs on the ports is eval t bs for an evaluator eval. Explicit
networks are the case of tables (ExplicitTensorNetwork, DescribedNetwork.contraction_entry).
Values and their operations (SumOps). The entries are values Y combined by ring
operations that depend on a precision q : Q: a zero, a one, a sum and a product, whose results
are reduced (of bounded size). The two instances are natural numbers modulo 2 ^ P
(SumOps.mod) and the coefficient lists of A_p = (ℤ / 2 ^ p)[U] / (f) at the precision
(p, fl) (SumOps.galois), the coefficient rings of the recursion (Appendix D.4.1, p. 57). A map
of the values into a commutative semiring that takes the operations at q to the semiring
operations (SumOps.IsHom) takes the computed sum to the contraction of the mapped entries.
Direct summation as a stack recursion (DescribedNetwork.sumScheme). The sum over the
2 ^ m assignments is a call whose children are the assignments, in binary order, added with the
operations; an assignment is a call whose children are the entries of the vertices at its bits,
multiplied with the operations; an entry is a leaf, evaluated by the evaluator. The derivation has
2 ^ m (k + 1) + 1 nodes for k vertices and two open calls, and its value is the fold of the
operations (DescribedNetwork.sumValue, DescribedNetwork.eval_sumRoot). So a native certificate
of the evaluator, with any bounds, gives one native machine for the sum on every input
(DescribedNetwork.contractionCertificate), through
Cslib.Algorithms.StackRecursion.Scheme.certificate. If the evaluator takes time E, space ES
and outputs at most Ev bits on every vertex, and reduced values are at most Rv bits, the
machine takes time 2 ^ m (k + 1) + 1 times K (n + Ev + Rv + 1) ^ K + 2 E and space
K (n + Ev + Rv + 1) ^ K + ES on inputs of length n
(DescribedNetwork.contractionCertificate_le). Under a homomorphism the value is the contraction
(DescribedNetwork.SumOps.IsHom.map_sumValue): modulo 2 ^ P for natural numbers
(DescribedNetwork.sumValue_mod, DescribedNetwork.modContractionCertificate), and in A_p for
coefficient lists (DescribedNetwork.val_sumValue_galois). This is the leaf step of the
contraction algorithm, with implicit packet tensors as descriptors.
Main definitions #
Cslib.Circuits.Frontier.SumOps: ring operations on values, withSumOps.IsHomandSumOps.PolyTime; the instancesSumOps.modandSumOps.galois.Cslib.Circuits.Frontier.DescribedNetwork.sumScheme: direct summation as a recursion scheme.Cslib.Circuits.Frontier.DescribedNetwork.sumValue: its value.Cslib.Circuits.Frontier.DescribedNetwork.encDescribed: the encoding of a described network.Cslib.Circuits.Frontier.DescribedNetwork.contractionCertificate: one native machine for the sum.
Main results #
Cslib.Circuits.Frontier.DescribedNetwork.eval_sumRoot: direct summation evaluates tosumValue, with2 ^ m (k + 1) + 1nodes and two open calls.Cslib.Circuits.Frontier.SumOps.IsHom.map_sumValue: under a homomorphism, the value is the contraction;DescribedNetwork.sumValue_modandDescribedNetwork.val_sumValue_galois.Cslib.Circuits.Frontier.DescribedNetwork.run_sumScheme: the machine computessumValue.Cslib.Circuits.Frontier.DescribedNetwork.contractionCertificate_le: its time and space.
References #
- OpenAI, The Exponential Time Hypothesis is False, Appendix D.4.1 (p. 57) and Appendix D.4.6–D.4.7 (pp. 63–64).
Values and their operations #
Ring operations on values for direct summation: at each precision q : Q, a zero, a
one, a sum and a product on the values Y, and the reduced values at q, among which are the
zero, the one and every sum and product.
- zero : Q → Y
The zero at a precision.
- one : Q → Y
The one at a precision.
- add : Q → Y → Y → Y
The sum at a precision.
- mul : Q → Y → Y → Y
The product at a precision.
- Reduced : Q → Y → Prop
The reduced values at a precision.
A homomorphism of the operations at q: a map of the values into a commutative semiring
taking the zero, the one, sums and products at q to those of the semiring.
Polynomial-time operations, for encodings of the precisions and the values.
- zero : Turing.MultiTapeTM.ComputableInPolyTime ops.zero encQ encY
- one : Turing.MultiTapeTM.ComputableInPolyTime ops.one encQ encY
- add : Turing.MultiTapeTM.ComputableInPolyTime (fun (z : Q × Y × Y) => ops.add z.1 z.2.1 z.2.2) (Turing.MultiTapeTM.encPair encQ (Turing.MultiTapeTM.encPair encY encY)) encY
- mul : Turing.MultiTapeTM.ComputableInPolyTime (fun (z : Q × Y × Y) => ops.mul z.1 z.2.1 z.2.2) (Turing.MultiTapeTM.encPair encQ (Turing.MultiTapeTM.encPair encY encY)) encY
A left fold of the sum or the product from a reduced start is reduced.
A homomorphism takes a fold of products to the product of the images.
A homomorphism takes a fold of sums over a range to the sum of the images.
Direct summation as a recursion scheme #
A node of direct summation: its kind (0 the sum, 1 an assignment, 2 an entry), the
precision and the network, and the current word and vertex index.
Direct summation as a recursion scheme. The sum (kind 0) has the 2 ^ m assignments as
children, adding their values; an assignment (kind 1) has the entries of the vertices as
children, multiplying them; an entry (kind 2) is a leaf. The operations are those at the
precision of the node, and the accumulator is a counter and a value.
The root of direct summation on (q, d).
The weight of a word: the product of the entries at its bits, folded with the operations at
q.
The value of direct summation: the weights of the 2 ^ m words in binary order, folded
with the sum at q.
The shape of a node of direct summation on q: it keeps q, its kind is at most 2, its
word has at most m bits and its index is at most the number of vertices.
The invariant of direct summation on q: nodes have the shape of NodeShape, frames also
have a counter at most 2 ^ m + k and a reduced value, and every value is reduced or an entry of
a vertex at the bits of an m-bit word.
An assignment evaluates to the weight of its word, with one node per vertex plus one and one open call.
Direct summation computes sumValue, with 2 ^ m (k + 1) + 1 nodes for m edges and
k vertices, and at most two open calls.
sumValue is reduced.
Under a homomorphism, the value is the contraction of the mapped entries.
Natural numbers modulo a power of two #
Natural numbers modulo 2 ^ P, with the precision P; the reduced values are those
below 2 ^ P.
Modulo 2 ^ P, the value is the contraction modulo 2 ^ P.
Coefficient lists of (ℤ / 2 ^ p)[U] / (f) #
The value in A_p is a homomorphism of the operations at (p, fl).
In A_p, the value is the contraction of the values of the entries.
The native machine #
The encoding of a described network: its number of edges in unary, then its vertices, each the pair of its list of ports in binary and its descriptor.
The number of edges of a described network, in unary.
The vertices of a described network.
The kind of a node.
The network of a node.
The word of a node.
The vertex index of a node.
The polynomial-time components of direct summation, from polynomial-time operations.
The descriptor of a vertex and the bits of the node's word on its ports.
The vertex of a node, if its index is in range.
The query to the evaluator: the descriptor and the bits on the ports.
The leaf step: the evaluator at the descriptor of the node's vertex and its bits, from a native certificate of the evaluator with any bounds.
The time of the leaf step: the vertex lookup, and the zero or the query and the evaluator at a vertex.
The space of the leaf step.
The number of steps of direct summation: 2 (2 ^ m (k + 1) + 1) - 1.
One native machine for direct summation over described networks, from polynomial-time
operations and a native certificate of the evaluator. It returns some (sumValue ops eval q d)
(run_sumScheme).
Direct summation over described networks, as a native certificate for sumValue on
every input (q, d), from polynomial-time operations and a native certificate of the
evaluator.
The time is that of the stack machine.
The space is that of the stack machine.
Resources #
The number of edges and the number of vertices are at most the encoded length.
The encoded argument of the evaluator at a vertex and bits on its ports is at most three times the encoded network length plus a constant.
The resources of direct summation over described networks. There is K such that, for
an input (q, d) of length n with m edges and k vertices, if the evaluator takes time at
most E and space at most ES and outputs at most Ev bits on every vertex and every list of
bits on its ports, and the reduced values at q are at most Rv bits, then the time is at most
2 ^ m (k + 1) + 1 times K (n + Ev + Rv + 1) ^ K + 2 E, and the space at most
K (n + Ev + Rv + 1) ^ K + ES.
The two instances #
Natural numbers modulo 2 ^ P are polynomial-time, with P in unary.
Coefficient lists are polynomial-time, with p in unary and the coefficients of f in
binary.
Direct summation modulo 2 ^ P: one native machine for d.contraction eval % 2 ^ P on
every input (P, d), with P in unary, from a native certificate of a natural-number
evaluator.