Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.FastContractionSchedule

The native contraction recursion follows the schedule #

For a root with m edges, the calls of the native recursion (FastContraction.scheme FastContraction.nativeMk) follow the parameter schedule of Cslib.Circuits.Frontier.ContractionSchedule at scale m (§D.4.2 of [OAI26k], p. 58): once m is large enough for the schedule's certificate ContractionSchedule.ActiveBounds, every reached call either has at most leafSize m edges or is an active call of the schedule (ContractionSchedule.Active), and every reached call of the second kind passes the test FastContraction.active of the machine.

The invariant (FastContraction.OnSchedule): the call keeps the root's scale and modulus, is well-formed, has maximum degree at most degreeBound m, has fewer edges than its bound, and is small or active in the schedule. It passes from an active call to its native children (FastContraction.OnSchedule.child) by round 10's child facts in the native numbering: at most M / 16 edges (NativeChild.sixteen_mul_numEdges_nativeChild_le), the degree bound (NativeChild.length_le_of_mem_vertices_nativeChild), and the schedule's precisions (ContractionSchedule.ActiveBounds.nodePrecision_le).

Consequences for the reached calls: a call that the machine treats as a leaf has at most leafSize m edges (FastContraction.OnSchedule.edges_le_leafSize), an active one lies above depth ⌊log₂ m⌋ - 2 (FastContraction.OnSchedule.depth_add_two_le) and has at most 2 ^ (2 ⌊log₂ m⌋ + e_d) children (FastContraction.OnSchedule.length_children_le), by the mode count (D.15). So the root has a derivation with at most 2 ^ ((245760 C + 37) m / √⌊log₂ m⌋) nodes (FastContraction.exists_eval_onSchedule, by ContractionSchedule.recursionBound_le_two_pow_div_sqrt_log_two).

Main definitions #

Main results #

References #

A call on the schedule of a root with m edges, for the constant C: it keeps the root's scale and modulus, is well-formed, has maximum degree at most degreeBound m and fewer edges than its bound, and has at most leafSize m edges or is an active call of the schedule.

4 ⌊log₂ m⌋ ≤ 2 ⬝ 3 ^ t for the exponent t of the modulus.

An active call of the schedule passes the machine's test once the schedule's certificate holds: the certificate gives 1 ≤ u ≤ M, u ≤ a and the number of points, and the invariant gives the degrees and the edge bound.

An active call on the schedule is active in the schedule: it has more than leafSize m edges.

The leaves are small: a call on the schedule that the machine treats as a leaf has at most leafSize m edges, once the schedule's certificate holds.

theorem Cslib.Circuits.Frontier.FastContraction.OnSchedule.depth_add_two_le {T : Type} {C m : ℕ} {x : Call T} (hB : ∀ (d M p : ℕ), ContractionSchedule.Active C m d M p → ContractionSchedule.ActiveBounds C m d M p) (h : OnSchedule C m x) (ha : active x = true) :
x.depth + 2 ≤ Nat.log 2 m

An active call lies above depth ⌊log₂ m⌋ - 2, once the schedule's certificate holds.

The level of the j-th node of positive multiplicity is below u.

The level of the node of a child of an active call is below u.

The invariant passes to the native children of an active call, once the schedule's certificate holds: a child has at most a sixteenth of the edges, keeps the degree bound, and its precision is within the schedule.

theorem Cslib.Circuits.Frontier.FastContraction.Reach.onSchedule {T : Type} {C m : ℕ} {x : Call T} (hB : ∀ (d M p : ℕ), ContractionSchedule.Active C m d M p → ContractionSchedule.ActiveBounds C m d M p) {x₀ : Call T} (h₀ : OnSchedule C m x₀) (h : Reach nativeMk x₀ x) :

Every reached call is on the schedule, from a root on the schedule, once the schedule's certificate holds.

theorem Cslib.Circuits.Frontier.FastContraction.onSchedule_root_logPrecision {T : Type} {C m : ℕ} {x₀ : Call T} (hC : 1 ≤ C) (hs : x₀.scale = m) (he : x₀.edges = m) (hfl : x₀.fl = modulus m) (hwf : WF x₀) (hdeg : ∀ v ∈ x₀.net.vertices, v.1.length ≤ ContractionSchedule.degreeBound m) (hb : x₀.bound = m + 1) (hd : x₀.depth = 0) (hp : x₀.prec ≤ C * m * (Nat.log 2 m + 1)) :
OnSchedule C m x₀

The root is on the schedule: a well-formed root with m edges, at scale m with the modulus of m, of maximum degree at most degreeBound m, with edge bound m + 1 and precision at most C m (⌊log₂ m⌋ + 1) for 1 ≤ C.

theorem Cslib.Circuits.Frontier.FastContraction.onSchedule_root {T : Type} {C m : ℕ} {x₀ : Call T} (hC : 1 ≤ C) (hs : x₀.scale = m) (he : x₀.edges = m) (hfl : x₀.fl = modulus m) (hwf : WF x₀) (hdeg : ∀ v ∈ x₀.net.vertices, v.1.length ≤ ContractionSchedule.degreeBound m) (hb : x₀.bound = m + 1) (hd : x₀.depth = 0) (hp : x₀.prec ≤ C * m) :
OnSchedule C m x₀

A root of linear precision is on the same schedule.

The number of children #

The tuples of weight below p of the modes are the mode budget of the weights b + 1.

theorem Cslib.Circuits.Frontier.FastContraction.length_cursorList_le {ws : ℕ → List ℕ} {ps : ℕ → ℕ} {T n r B : ℕ} (hB : ∀ t < T, (BudgetTuples.budgetTuples (ws t) (ps t)).length ≤ B) :
(ChildCursor.cursorList ws ps T n r).length ≤ T * n * B * r

The length of the cursor's list: at most T n B r for T nodes, n points, at most B tuples at each node and r groups.

The nodes of positive multiplicity are at most 2 ^ (a + 1).

The number of children of an active call on the schedule is at most 2 ^ (2 ⌊log₂ m⌋ + e_d), e_d = branchExponent C m d, once the schedule's certificate holds: the nodes, points and 64 groups contribute 2 ^ (2 ⌊log₂ m⌋), and each node has at most 2 ^ e_d tuples of exponents (the mode count (D.15)).

The derivation on the schedule #

theorem Cslib.Circuits.Frontier.FastContraction.exists_eval_onSchedule {T : Type} {C m : ℕ} (ev : T → List Bool → List ℕ) (hB : ∀ (d M p : ℕ), ContractionSchedule.Active C m d M p → ContractionSchedule.ActiveBounds C m d M p) {x₀ : Call T} (h₀ : OnSchedule C m x₀) (hd : x₀.depth = 0) (hm : 2 ≤ m) :
∃ (N : ℕ) (H : ℕ), (scheme ev nativeMk).Eval (reachInv ev nativeMk x₀) x₀ (0, value ev nativeMk x₀) N H ∧ N ≤ 2 ^ ((245760 * C + 37) * m / (Nat.log 2 m).sqrt) ∧ H ≤ Nat.log 2 m

The derivation of a root on the schedule, with its node count (§D.4.7, p. 64): once the schedule's certificate holds at scale m ≥ 2, a root on the schedule at depth 0 has a derivation of its tagged value over the reached calls with at most 2 ^ ((245760 C + 37) m / √⌊log₂ m⌋) nodes and ⌊log₂ m⌋ stack levels.