Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.Schedule

The parameter schedule of the tensor contraction recursion #

This file fixes the parameters of the recursion in the proof of the Boolean tensor contraction theorem (Theorem D.1) of [OAI26k] (§D.4.2, (D.4)–(D.6), p. 58) and proves the inequalities its running time rests on: the conditions of the packing lemma, the precision bound (D.11) (p. 61) and the count (D.15) of the mode tuples (pp. 62–63). Correctness of the recursion does not depend on these choices; they bound the number of its calls by 2 ^ O(s / √⌊log₂ s⌋) (§D.4.7, p. 64).

The schedule. Fix the size s and write λ = ⌊log₂ s⌋.

Active calls. Active C s d M p says that a call at depth d has M edges, with 16 ^ d M ≤ C s and H < M, and precision p ≤ precisionBound C s d. The root is active when it has more than H edges, at most C s edges and precision at most C s (⌊log₂ s⌋ + 1) (Active.root_logPrecision), and an active call's children are active when they have more than H edges (Active.child): Lemma D.3 gives them at most M / 16 edges.

The certificate. For every C there is s₀ such that for all s ≥ s₀ (exists_activeBounds):

From (D.11), the mode count (D.15) gives at most 2 ^ e_d mode tuples with e_d = 4 ⌊15360 C s / (⌊√λ⌋ 8 ^ d)⌋ + 4 (card_modeBudget_le, branchExponent), and the exponents sum to O(s / √⌊log₂ s⌋) over the levels (sum_branchExponent_le). With the factor 2 ^ (2 λ) for the nodes, interpolation points and groups (ActiveBounds.branching_le), a call at depth d has at most 2 ^ (2 λ + e_d) children. These are the hypotheses of a recursion tree with 2 ^ O(s / √⌊log₂ s⌋) nodes.

Differences from the source. We use λ = ⌊log₂ s⌋ and H = ⌊s / ⌊√λ⌋⌋, the scale of the consumer interface of #1833, where the manuscript has ⌈log₂ s⌉ and ⌈s / ⌊√λ⌋⌉; we take Δ = 2 ^ (⌊9 λ / 10⌋ + 2) instead of ⌈s ^ (9/10)⌉; and we prove the weaker lower bound u_d ≥ ⌊√λ⌋ / (2 ^ 17 C) instead of u_d ≥ λ ^ (4/5), which suffices for (D.11). The manuscript's precision bound p ≤ s λ^{O(1)} 2 ^ (a_{d-1}) is precisionBound_le.

The logarithmic factor in the root precision extends the manuscript's O(s) allowance. It changes only the polynomial factor in the inherited-precision estimate (D.11); the taper absorbs it, so the mode and call-count bounds are unchanged.

Main definitions #

Main results #

References #

The schedule #

The leaf size H = ⌊s / ⌊√⌊log₂ s⌋⌋⌋: calls with at most H edges are evaluated by direct summation.

The taper u_d = ⌊⌊log₂ s⌋ / 2 ^ (17 + d)⌋ at depth d, the manuscript's ⌊ε λ / 2 ^ d⌋ with ε = 2 ^ (-17).

2 ∑_{j < d} u_j, the manuscript's a_{d - 1}.

The number a_d = 2 ∑_{j ≤ d} u_j of label coordinates at depth d: packets have 2 ^ a_d slots.

The degree bound Δ = 2 ^ (⌊9 ⌊log₂ s⌋ / 10⌋ + 2), a power of two at least s ^ (9/10).

The precision p_t = p + 8 h 2 ^ (a - i) + 8 M (a + 1) at which a node t of valuation i is recovered by Lemma D.5, for input precision p, h = ⌈3 M / u⌉ and 2 ^ a slots.

The precision schedule: C s (⌊log₂ s⌋ + 1) at the root, growing by 8 C s (4 · 2 ^ a_d + a_d + 1) from depth d to d + 1.

The excess exponent e_d = 4 ⌊15360 C s / (⌊√⌊log₂ s⌋⌋ 8 ^ d)⌋ + 4 of the mode count at depth d.

An active call at depth d of the recursion for size s and constant C: it has M edges, at most C s / 16 ^ d and more than the leaf size, and precision p within the schedule.

  • edges_le : 16 ^ d * M ≤ C * s

    Each level divides the number of edges by at least 16.

  • leafSize_lt : leafSize s < M

    The call is not a leaf.

  • precision_le : p ≤ precisionBound C s d

    The precision is within the schedule.

theorem Cslib.Circuits.Frontier.ContractionSchedule.Active.root {C s M p : ℕ} (hM : M ≤ C * s) (hH : leafSize s < M) (hp : p ≤ C * s) :
Active C s 0 M p

The root is active when it is not a leaf and its edges and precision are at most C s.

theorem Cslib.Circuits.Frontier.ContractionSchedule.Active.root_logPrecision {C s M p : ℕ} (hM : M ≤ C * s) (hH : leafSize s < M) (hp : p ≤ C * s * (Nat.log 2 s + 1)) :
Active C s 0 M p

The same schedule allows root precision C s (⌊log₂ s⌋ + 1), with unchanged branching bounds. The additional logarithm is absorbed by the taper in (D.11).

theorem Cslib.Circuits.Frontier.ContractionSchedule.Active.child {C s d M p M' p' : ℕ} (h : Active C s d M p) (hM : 16 * M' ≤ M) (hH : leafSize s < M') (hp : p' ≤ precisionBound C s (d + 1)) :
Active C s (d + 1) M' p'

A child of an active call at depth d with at most a sixteenth of its edges, precision within the schedule and more than the leaf size is an active call at depth d + 1.

Arithmetic of the schedule #

a ≤ 4 ε λ: 2 ∑_{j < d} u_j ≤ ⌊λ / 2 ^ 15⌋.

The degree bound is at least s ^ (9/10): s ^ 9 ≤ Δ ^ 10.

A degree x with x ^ 10 ≤ s ^ 9 is at most the degree bound.

The degree bound is at most 2 ^ 2 s ^ (9/10): Δ ^ 10 ≤ 2 ^ 20 s ^ 9.

The degree bound is monotone.

The precision bound of (D.11), p ≤ s λ^{O(1)} 2 ^ (a_{d - 1}): precisionBound C s d ≤ C s 2 ^ (a_{d - 1}) (λ + 1 + d (8 λ + 40)).

Active calls #

theorem Cslib.Circuits.Frontier.ContractionSchedule.Active.lt_mul_sqrt {C s d M p : ℕ} (h : Active C s d M p) (hs : 2 ≤ s) :
s < M * (Nat.log 2 s).sqrt

At an active call s < M ⌊√λ⌋, since ⌊s / ⌊√λ⌋⌋ < M.

theorem Cslib.Circuits.Frontier.ContractionSchedule.Active.sixteen_pow_lt {C s d M p : ℕ} (h : Active C s d M p) (hs : 2 ≤ s) :
16 ^ d < C * (Nat.log 2 s).sqrt

The depth bound: 16 ^ d < C ⌊√λ⌋ at an active call.

theorem Cslib.Circuits.Frontier.ContractionSchedule.Active.le_taper {C s d M p : ℕ} (h : Active C s d M p) (hs : 2 ≤ s) :
(Nat.log 2 s).sqrt / (2 ^ 17 * C) ≤ taper s d

The taper stays large: u_d ≥ ⌊√λ⌋ / (2 ^ 17 C) at an active call.

⌊√λ⌋ ≤ 2 ^ (10 + d) ⌊√u_d⌋ once u_d ≥ 1: the taper loses at most a factor 2 ^ (17 + d) against λ.

The certificate #

The inequalities that hold at an active call at depth d with M edges and precision p, for s large enough. Write u = taper s d, a = slotBits s d, L = 2 ^ a, Δ = degreeBound s and λ = ⌊log₂ s⌋.

Arithmetic lemmas #

The certificate #

theorem Cslib.Circuits.Frontier.ContractionSchedule.exists_activeBounds (C : ℕ) :
∃ (s₀ : ℕ), ∀ (s : ℕ), s₀ ≤ s → (∀ d ≤ Nat.log 2 s, precisionBound C s d ≤ s ^ 2) ∧ ∀ (d M p : ℕ), Active C s d M p → ActiveBounds C s d M p

The parameter certificate. For every C there is s₀ such that for all s ≥ s₀ the precisions up to depth ⌊log₂ s⌋ are at most s ^ 2, and every active call satisfies ActiveBounds.

The mode count #

theorem Cslib.Circuits.Frontier.ContractionSchedule.card_modeBudget_le {C s d M p : ℕ} (hA : Active C s d M p) (hs : 2 ≤ s) (hu : 1 ≤ taper s d) {i h : ℕ} (hi : i ≤ slotBits s d) (hpt : nodePrecision p h (slotBits s d) M i * taper s d ≤ 34 * M * 2 ^ (slotBits s d - i)) {P : Type u_1} [Fintype P] [DecidableEq P] (hP : Fintype.card P * 2 ^ slotBits s d ≤ 3 * M) :
(TensorNetwork.modeBudget (fun (Z : P × Fin (2 ^ (i + 1)) × Fin (nodePrecision p h (slotBits s d) M i)) => ↑Z.2.2 + 1) (nodePrecision p h (slotBits s d) M i)).card ≤ 2 ^ branchExponent C s d

The mode count (D.15) at an active call: if the node t of valuation i ≤ a satisfies the precision bound (D.11) p_t u ≤ 34 M D_t with u ≥ 1, and the packing has #P 2 ^ a ≤ 3 M packets (Lemma D.3 (1)), then there are at most 2 ^ e_d tuples of exponents of the modes P × Fin (2 ^ (i + 1)) × Fin p_t (packet, tile, b) of weight b + 1 below p_t. There are #P 2 ^ (i + 1) ≤ 6 M / D_t modes of each weight (D.13).

At an active call satisfying the certificate, s ≥ 2.

theorem Cslib.Circuits.Frontier.ContractionSchedule.ActiveBounds.card_modeBudget_le {C s d M p : ℕ} (hB : ActiveBounds C s d M p) (hA : Active C s d M p) {i h : ℕ} (hi : i < taper s d) (hh : h * taper s d ≤ 3 * M + taper s d) {P : Type u_1} [Fintype P] [DecidableEq P] (hP : Fintype.card P * 2 ^ slotBits s d ≤ 3 * M) :
(TensorNetwork.modeBudget (fun (Z : P × Fin (2 ^ (i + 1)) × Fin (nodePrecision p h (slotBits s d) M i)) => ↑Z.2.2 + 1) (nodePrecision p h (slotBits s d) M i)).card ≤ 2 ^ branchExponent C s d

The mode count (D.15) at a certified active call: for a node of valuation i < u and h = ⌈3 M / u⌉, and a packing with #P 2 ^ a ≤ 3 M (Lemma D.3 (1)), there are at most 2 ^ e_d mode tuples. This is card_modeBudget_le with its hypotheses supplied by ActiveBounds.

theorem Cslib.Circuits.Frontier.ContractionSchedule.sum_branchExponent_le (C : ℕ) {s D : ℕ} (hs : 2 ≤ s) (hD : D ≤ Nat.log 2 s) :
∑ d ∈ Finset.range D, branchExponent C s d ≤ (245760 * C + 4) * (s / (Nat.log 2 s).sqrt)

The excess exponents sum to O(s / √⌊log₂ s⌋): over at most ⌊log₂ s⌋ levels, ∑_d e_d ≤ (245760 C + 4) ⌊s / ⌊√⌊log₂ s⌋⌋⌋. The terms decrease geometrically, as in the manuscript's (√2 / 8) ^ d (§D.4.7, p. 64).