Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.FastContractionShape

The shapes of the calls of the native contraction recursion #

Structural bounds on every call reached from a root of the native recursion (FastContraction.scheme FastContraction.nativeMk) with m edges, valid for every input, whatever the schedule: they are what makes the calls, frames and values polynomially long.

The invariant (FastContraction.Shape). A reached call at depth d keeps the root's scale and modulus, is well-formed, has at most 2 m edges, precision at most p₀ + 40 m² d for the root's precision p₀, at most V₀ + m² d vertices for the root's V₀ vertices, as many rows (unless it is the root), and every vertex descriptor is a descriptor of the root or a packet descriptor whose fields are bounded (FastContraction.PacketBound). It passes to the native children (FastContraction.Shape.child): a child has at most twice the edges of its parent (NativeChild.numEdges_nativeChild_le), its precision p_t = p + 8 h 2 ^ (a - i) + 8 M (a + 1) is at most p + 40 m² since 2 ^ a ≤ m, and it adds at most M (2 ^ a) ^ 12 ≤ m² packet vertices (NativeChild.numPackets_nativeParentPacking_le).

Root descriptors keep their number of ports along the recursion (FastContraction.Reach.exists_root_of_inl), since the native child renumbers the ports of the vertices it keeps (NativeChild.exists_mem_of_mem_nativeChild_inl).

Main definitions #

Main results #

References #

A bounded packet descriptor for a root with modulus fl and m edges, at precision at most P, on a vertex with k ports: its precision is at most P and is its number of exponents per tile, its modulus is fl, it has 2 ^ a slots with a ≤ ⌊log₂ m⌋, 2 ^ (i + 1) tiles with i ≤ a, a grid point of size at most 2 ^ a, no column list, a 0/1 interpolation value with at most e coordinates, k tags with slots below 2 ^ a, and at most 2 ^ (i + 1) p exponents, each at most p.

theorem Cslib.Circuits.Frontier.FastContraction.PacketBound.mono {fl : List ℕ} {m P P' k : ℕ} {d : NativePacket.PacketDesc} (h : PacketBound fl m P k d) (hP : P ≤ P') :
PacketBound fl m P' k d

The shape of a call reached from a root x₀ with m edges, precision p₀ and V₀ vertices, at depth d.

The ports of a vertex of a well-formed call are at most its edges.

The schedule's numbers at an active call at scale m: a ≤ ⌊log₂ m⌋, 2 ^ (12 a) ≤ m, u ≤ ⌊log₂ m⌋ < m, and h ≤ 3 M + u.

theorem Cslib.Circuits.Frontier.FastContraction.nodePrec_le_add {T : Type} {x : Call T} (ha : active x = true) (hM : x.edges ≤ x.scale) (j : ℕ) :
nodePrec x j ≤ x.prec + 40 * x.scale ^ 2

The node precisions grow by at most 40 m², at an active call at scale m with at most m edges.

The level of a node index is at most a, and its node has size at most 2 ^ a.

The interpolation points are 0/1 lists with e coordinates.

The rows of a native child are at most the parent's vertices.

theorem Cslib.Circuits.Frontier.FastContraction.packetBound_packetCtx {fl ζ β : List ℕ} {m P k a i pt g q : ℕ} {t : ℤ} {tags : List (Bool × ℕ)} (hpt : pt ≤ P) (ha : a ≤ Nat.log 2 m) (hi : i ≤ a) (ht : t.natAbs ≤ 2 ^ a) (hζ : ζ.length ≤ fl.length) (hζ1 : ∀ z ∈ ζ, z ≤ 1) (htags : tags.length = k) (hslots : ∀ b ∈ tags, b.2 < 2 ^ a) (hβ : β.length ≤ 2 ^ (i + 1) * pt) (hβ' : ∀ b ∈ β, b ≤ pt) :
PacketBound fl m P k (NativeChild.packetCtx fl a i pt t ζ g q, tags, β)

A packet descriptor built from a packet context with bounded fields is bounded.

theorem Cslib.Circuits.Frontier.FastContraction.Shape.child {T : Type} {x₀ x : Call T} (h₀s : x₀.scale = x₀.edges) (h₀b : x₀.bound + x₀.depth = x₀.edges + 1) (h : Shape x₀ x) (ha : active x = true) {c : ChildCursor.State} (hc : c ∈ children x) :

The shape passes to the native children of an active call, from a root x₀ at scale m equal to its number of edges, with bound plus depth m + 1.

theorem Cslib.Circuits.Frontier.FastContraction.Reach.shape {T : Type} {x₀ x : Call T} (h₀s : x₀.scale = x₀.edges) (h₀b : x₀.bound + x₀.depth = x₀.edges + 1) (h₀ : WF x₀) (h : Reach nativeMk x₀ x) :
Shape x₀ x

Every reached call has the shape of a root x₀ that is well-formed, at scale its number of edges, with bound plus depth m + 1.

theorem Cslib.Circuits.Frontier.FastContraction.Reach.exists_root_of_inl {T : Type} {x₀ x : Call T} (h : Reach nativeMk x₀ x) {v : List ℕ × VertexDesc T} (hv : v ∈ x.net.vertices) {t : T} (ht : v.2 = Sum.inl t) :
∃ w ∈ x₀.net.vertices, w.2 = Sum.inl t ∧ w.1.length = v.1.length

Root descriptors keep their number of ports along the recursion: every root descriptor of a call reached by the native child builder is the descriptor of a vertex of the root with as many ports.