Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.ExplicitTables

Tables of explicit tensor networks #

Tables for the vertices of an ExplicitTensorNetwork, and two contraction identities for networks assembled from them.

A bounded table lists the values f 0, …, f (2 ^ w - 1) of a function on the words of length w, by keeping the numbers below 2 ^ w among the first 2 ^ B for a bound w ≤ B (ExplicitTensorNetwork.boundedTable), so that a network with degrees at most B is computed from constant-length lists. Looking it up at a word evaluates f at the value of the word (ExplicitTensorNetwork.entry_boundedTable). The equality table on two ports (ExplicitTensorNetwork.eqTable) joins two edges into one bit: equality vertices on consecutive pairs of edges reduce the contraction to a sum over one bit per pair (ExplicitTensorNetwork.contraction_append_pairs). Mapping every table entry by a semiring homomorphism maps the contraction (ExplicitTensorNetwork.map_contraction).

Main definitions #

Main results #

Bounded tables #

A table of the 2 ^ w values f 0, …, f (2 ^ w - 1) when w ≤ B, listed by keeping the numbers below 2 ^ w among the first 2 ^ B.

theorem Cslib.Circuits.Frontier.ExplicitTensorNetwork.boundedTable_eq {R : Type u_1} {B w : ℕ} (f : ℕ → R) (h : w ≤ B) :

For w ≤ B, the bounded table is the table of f on 0, …, 2 ^ w - 1.

Looking up a bounded table at a word of length at most B evaluates its function at the value of the word.

Equality vertices and maps of tables #

The equality table on two ports.

theorem Cslib.Circuits.Frontier.ExplicitTensorNetwork.contraction_append_pairs {R : Type u_1} [CommSemiring R] (W : ℕ) (rows : List (List ℕ × List R)) :
contraction { numEdges := 2 * W, vertices := rows ++ List.map (fun (w : ℕ) => ([2 * w, 2 * w + 1], eqTable)) (List.range W) } = ∑ y : Fin W → Bool, (List.map (fun (v : List ℕ × List R) => entry v.2 (List.map (fun (e : ℕ) => if h : e / 2 < W then y ⟨e / 2, h⟩ else false) v.1)) rows).prod

Equality vertices on pairs of edges. If the last vertices of a network with 2 W edges are W equality vertices, vertex w joining the edges 2 w and 2 w + 1, then the contraction is the sum over one bit y w per pair of the product of the other entries, where edge e carries y (e / 2).

The network with every table entry mapped by ψ.

The contraction commutes with maps of semirings applied to the tables.