Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.EntryContractionMachine

The native machine of the contraction with entry procedures #

The machine behind the instance of the contraction interface for entry procedures (Cslib.Circuits.Frontier.EntryContractionAlgorithm, milestone E1.3 of #1538): the recursion of Theorem D.1 of [OAI26k] (FastContraction.scheme with the native child builder) run from a root call whose descriptors are the vertex descriptors of the input network, read by the entry procedure, with direct summation as the fallback.

The input (P, fl, r, G) has the precision P in unary (EntryContraction.encInput), so the precision is not capped: the cap at the encoded length of the network that the explicit machine uses (ExplicitTensorNetwork.capPrecision) keeps the residue only for tables of natural numbers.

The guard (EntryContraction.guard) checks that fl is the modulus FastContraction.modulus m of the number m of edges, that the network is rows-first bipartite, and that every vertex has at most degreeBound m ports. It is polynomial-time (EntryContraction.guard_polyTime), with the rows-first test DescribedNetwork.rowsFirst_polyTime, and every admissible input at the modulus passes it (EntryContraction.guard_of_entryAdmissible), since ⌈s ^ (9/10)⌉ ≤ degreeBound s ≤ degreeBound m (ContractionSchedule.degreeBound_mono).

The root and the clock. The root call (EntryContraction.rootCall) has scale m, depth 0, edge bound m + 1, precision P, modulus fl, r rows and the network FastContraction.rootNet G. The clock (EntryContraction.clock) is 2 ^ (K₀ (m + q) / √⌊log₂ (m + q)⌋), where q = P / (⌊log₂ m⌋ + 1). The logarithmic normalization uses the schedule's larger precision allowance without charging an extra logarithm in the exponential clock. On guarded inputs the root is well-formed (EntryContraction.wf_rootCall), and it has no packets (EntryContraction.packetShape_rootCall).

The result (EntryContraction.coreValue): on guarded inputs, the coefficient list of a value tagged 0 returned by the clocked run, and direct summation otherwise. It is correct at the modulus of the number of edges for every fuel (EntryContraction.val_coreValue), from the correctness of the recursion (FastContraction.val_value) and the root (FastContraction.contraction_rootNet). Its native certificate is EntryContraction.fastCore; its resources are analyzed in Cslib.Complexity.CountingSimulation.EntryAnalysis.

Main definitions #

Main results #

References #

The root network #

theorem Cslib.Circuits.Frontier.FastContraction.contraction_rootNet {T : Type} {R : Type u_1} [CommSemiring R] (f : List ℕ → R) (ev : T → List Bool → List ℕ) (G : DescribedNetwork T) :
DescribedNetwork.contraction (fun (d : VertexDesc T) (bs : List Bool) => f (VertexDesc.entry ev d bs)) (rootNet G) = DescribedNetwork.contraction (fun (t : T) (bs : List Bool) => f (ev t bs)) G

The root network computes the contraction, for every entry procedure ev and every map f of its outputs to a commutative semiring: reading the root descriptors through VertexDesc.entry ev is reading the descriptors of G through ev.

The guard #

The guard on an input (P, fl, r, G): fl is the modulus of the number m of edges of G, G is rows-first bipartite at r rows, and every vertex has at most degreeBound m ports.

Admissible inputs pass the guard at the modulus of the number of edges: their degree is at most ⌈s ^ (9/10)⌉ ≤ degreeBound s ≤ degreeBound m, for s ≤ m.

The root and the clock #

The root call of an input (P, fl, r, G): scale m, depth 0, edge bound m + 1, precision P, modulus fl, r rows and the descriptors of G.

The precision charged to the clock: the schedule absorbs ⌊log₂ m⌋ + 1 precision bits for each unit of its root bound.

The clock of an input (P, fl, r, G): 2 ^ (K₀ (m + q) / √⌊log₂ (m + q)⌋), where q = normalizedPrecision m P.

Guarded roots are well-formed: the modulus is irreducible modulo 2, and the descriptors of G keep its rows-first ports.

The root call has no packets: its descriptors are those of the input network.

The result #

The result of the machine on an input (P, fl, r, G): on guarded inputs, the coefficient list of a value tagged 0 returned by the clocked run from the root call, and direct summation otherwise.

The machine is correct: at the modulus of the number of edges, the value of the result is the contraction of the values of the entries, on every input and for every fuel. A value tagged 0 returned by the run is the root's value (FastContraction.eq_value_of_run), which is the contraction on well-formed roots (FastContraction.val_value).

The machine #

The clocked run from the root call, as one native machine, with direct summation through the entry procedure's certificate ce at the leaves.

The machine: branch on the guard; on guarded inputs run the recursion, and on a value tagged 0 output its coefficient list; otherwise sum directly (EntryContraction.directCore). It computes coreValue.

The time of the machine, unfolded: the guard, and on guarded inputs the run twice, the input, and the output or direct summation.