Documentation

CslibFrontier.Algorithms.MatrixMultiplication.Schonhage.Orders

Orders and counts of contributing leaves #

Main definitions #

Main results #

References #

Adapted selectively from [AlmanWilliams2026, Section 2] and Anthropic's pinned formal source. Source pin: 16a5ce41304fcdaea4e0be7c132e1c361dc26da5. These are finite mathematical counts and identities; they give no native program or instruction-cost certificate.

The set of levels at which a leaf chooses P₀.

The integer difference between m and the number of P0 positions of a leaf. It can be negative for arbitrary leaves; nonnegativity is proved for leaves contributing to an output with m inner positions.

The quantity m.choose d * 9 ^ d, counting order-d leaves contributing to one output with m inner positions.

The quantity L.choose (m - d) * 9 ^ (L - m + d), using natural-number subtraction. Its interpretation as the number of order-d leaves requires d ≤ m ≤ L.

One level: which terms contribute to which variables #

The order of a leaf #

@[simp]

Membership in the set of levels at which a leaf chooses P₀.

@[simp]

Membership in the inner set of an output string.

A contributing leaf can use P0 only at an inner position of the output string.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.order_nonneg {L m : ℕ} {w : OutStr L} (hw : (innerSetO w).card = m) {τ : Leaf L} (h : τ.Contributes w) :
0 ≤ order m τ

A leaf contributing to a string with exactly m inner positions has nonnegative order relative to m.

The order relative to m of any leaf is at most m, regardless of which outputs it contributes to.

A leaf has order d exactly if it chooses P₀ at m - d levels.

The counts #

Exactly 10 ^ m leaves contribute to an output string with m inner positions.

For a string with m inner positions, alpha m d leaves of order d contribute to it. The natural parameter d is unrestricted; for d > m both sides are zero.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.card_filter_order_eq {L m : ℕ} (hmL : m ≤ L) (d : ℕ) (hd : d ≤ m) :
{τ : Leaf L | order m τ = ↑d}.card = beta L m d

If d ≤ m ≤ L, the full leaf index type contains exactly beta L m d leaves of order d.

Evaluate beta at order zero.

The order-zero count formula equals M L m.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.card_outStr_of_leaf {L m : ℕ} (hmL : m ≤ L) (d : ℕ) (τ : Leaf L) (hτ : order m τ = ↑d) :
{w : OutStr L | (innerSetO w).card = m ∧ τ.Contributes w}.card = (L - m + d).choose d

Assuming m ≤ L, a leaf of natural order d contributes to exactly (L - m + d).choose d output strings with m inner positions. The order hypothesis forces d ≤ m.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.beta_pos {L m : ℕ} (hmL : m ≤ L) (d : ℕ) :
0 < beta L m d

β_d is positive when m ≤ L.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.Equation5.ratio_nat {L m : ℕ} (hmL : m ≤ L) (d : ℕ) (hd1 : 1 ≤ d) (hd : d ≤ m) :
beta L m d * (L - m + d) = 9 * (m - d + 1) * beta L m (d - 1)

For 1 ≤ d ≤ m ≤ L, consecutive values of beta satisfy the displayed multiplication identity, without division (cf. [AlmanWilliams2026, equation (5)]).

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.beta_ratio {L m : ℕ} (hmL : m ≤ L) (d : ℕ) (hd1 : 1 ≤ d) (hd : d ≤ m) :
↑(beta L m d) / ↑(beta L m (d - 1)) = 9 * (↑m - ↑d + 1) / (↑L - ↑m + ↑d)

For 1 ≤ d ≤ m ≤ L, the ratio of consecutive beta values is 9 * (m - d + 1) / (L - m + d), with the ratio and subtractions interpreted in ℚ. This extends the parameter ranges used in [AlmanWilliams2026, equations (5) and (7)].

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.beta_ratio_lt_half (m d : ℕ) (hd1 : 1 ≤ d) (hd : d ≤ m) :
↑(beta (19 * m) m d) / ↑(beta (19 * m) m (d - 1)) ≤ 9 * ↑m / (18 * ↑m + 1) ∧ 9 * ↑m / (18 * ↑m + 1) < 1 / 2

At L = 19 * m and 1 ≤ d ≤ m, the ratio of consecutive beta values is bounded above by 9 * m / (18 * m + 1), which is strictly below 1 / 2. All divisions here are in ℚ.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.two_pow_mul_beta_le (m d : ℕ) (hd : d ≤ m) :
2 ^ d * beta (19 * m) m d ≤ M (19 * m) m

For d ≤ m and L = 19 * m, the order count satisfies 2 ^ d * beta L m d ≤ M L m. This is the division-free geometric bound from [AlmanWilliams2026, equation (5)].