Documentation

CslibFrontier.Algorithms.MatrixMultiplication.Schonhage.BoxPartition

Disjoint box decomposition of the contributing leaves #

For an output with m inner levels and t ≤ m, pad each high-order leaf's P0 levels from below. Its resulting box is unique. Different indexing sets give disjoint box families, and their leaf sets partition exactly the high-order contributing leaves. The remaining low-order leaves are explicit in boxQuery; bilinearProduct_eq_boxQuery holds for arbitrary signed input arrays, including cancellation.

The level assignment is finite algebra from [AlmanWilliams2026, Lemmas 27–28], adapted from Lemma27_28.lean at anthropics/formal-math@16a5ce41304fcdaea4e0be7c132e1c361dc26da5. It uses the existing alphabets, encodings, contribution relation, signed leaf order and alpha counts. There is no assumed native lookup, enumeration, layout or cost contract.

Pad a restricted P0 set with the lowest remaining levels to the threshold size.

Levels preceding every omitted level; if none are omitted this is all of Q.

Cubes for an output and an indexing set, with stars, fixed P0, nine-way and private regions.

Eligible indexing sets have the required cardinality within the output's inner levels.

The contributing leaves below the order threshold, retained explicitly in every query.

Complete finite query expression: low-order products plus the values of the output's boxes.

The P0 coordinates of a leaf lying in the selected levels.

Restricted P0 coordinates determine the order of a contributing leaf.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.paddedLevels_subset {L : ℕ} (m t : ℕ) {Q Z : Finset (Fin L)} (hZ : Z ⊆ Q) :
paddedLevels m t Q Z ⊆ Q

Padding stays within its ambient set.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.card_paddedLevels {L m t : ℕ} (ht : t ≤ m) {Q Z : Finset (Fin L)} (hQ : Q.card = m) (hZ : Z ⊆ Q) (hZc : Z.card ≤ m - t) :
(paddedLevels m t Q Z).card = m - t

Padding has the prescribed size under the explicit cardinality premises.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.initialLevels_eq {L : ℕ} (Q V : Finset (Fin L)) :
initialLevels Q Q = Q ∧ ∀ (h : (Q \ V).Nonempty), initialLevels Q V = {ℓ ∈ Q | ℓ < (Q \ V).min' h}

The initial levels are all levels at the boundary, or those below the first omission.

The initial levels lie inside the selected set.

The stars of a family member are exactly its initial levels.

Fixed P0 coordinates occupy the rest of the selected levels.

A family member recovers its indexing set from its stars and P0 symbols.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.card_boxesAt {L : ℕ} (m t : ℕ) (ht : t ≤ m) (η : OutStr L) (hη : (innerSetO η).card = m) (V : Finset (Fin L)) (hV : V ∈ boxLevelSets m t η) :
(boxesAt η V).card = 9 ^ t

There are nine choices at each free inner coordinate and one at every other coordinate.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.boxesAt_isBox {L m t : ℕ} {η : OutStr L} {V : Finset (Fin L)} (hV : V ∈ boxLevelSets m t η) {π : Cube L} (hπ : π ∈ boxesAt η V) :
IsBox m t π

Every member of an eligible output family satisfies the global box conditions.

Different indexing sets give disjoint families of cubes.

Assign a cube by starring the initial levels of the padded P0 set.

The assignment retains its original leaf.

The assigned cube belongs to the family indexed by the padded P0 set.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.exists_mem_boxesAt_leaf_iff {L : ℕ} {η : OutStr L} {V : Finset (Fin L)} {τ : Leaf L} (hτ : τ.Contributes η) :
(∃ π ∈ boxesAt η V, τ ∈ π.leaves) ↔ V \ initialLevels (innerSetO η) V ⊆ P0LevelsWithin (innerSetO η) τ ∧ P0LevelsWithin (innerSetO η) τ ⊆ V

Leaf incidence in a family is equivalent to the two P0-set inclusions.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.boxesAt_leaf_unique {L : ℕ} {η : OutStr L} {V : Finset (Fin L)} {τ : Leaf L} {π π' : Cube L} (hπ : π ∈ boxesAt η V) (hτπ : τ ∈ π.leaves) (hπ' : π' ∈ boxesAt η V) (hτπ' : τ ∈ π'.leaves) :
π = π'

Within a single family, a leaf determines its cube.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.paddedLevels_unique {L : ℕ} (m t : ℕ) (ht : t ≤ m) (Q Z : Finset (Fin L)) (hQ : Q.card = m) (hZ : Z ⊆ Q) (hZc : Z.card ≤ m - t) (V : Finset (Fin L)) :
V ⊆ Q ∧ V.card = m - t ∧ V \ initialLevels Q V ⊆ Z ∧ Z ⊆ V ↔ V = paddedLevels m t Q Z

The prescribed padding is the unique set satisfying both incidence inclusions.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.contributes_high_iff_mem_box_leaves {L : ℕ} (m t : ℕ) (ht : t ≤ m) (η : OutStr L) (hη : (innerSetO η).card = m) (τ : Leaf L) :
τ.Contributes η ∧ ↑t ≤ order m τ ↔ ∃ π ∈ (boxLevelSets m t η).biUnion (boxesAt η), τ ∈ π.leaves

The families cover exactly the contributing leaves above the threshold.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.existsUnique_box_containing_leaf {L : ℕ} (m t : ℕ) (ht : t ≤ m) (η : OutStr L) (hη : (innerSetO η).card = m) (τ : Leaf L) (hτ : τ.Contributes η) (hord : ↑t ≤ order m τ) :
∃! π : Cube L, π ∈ (boxLevelSets m t η).biUnion (boxesAt η) ∧ τ ∈ π.leaves

Each high-order contributing leaf lies in exactly one output box.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.sum_contributing_eq_low_add_boxes {L : ℕ} {G : Type u_1} [AddCommMonoid G] (m t : ℕ) (ht : t ≤ m) (η : OutStr L) (hη : (innerSetO η).card = m) (g : Leaf L → G) :
∑ τ : Leaf L with τ.Contributes η, g τ = ∑ τ ∈ lowLeaves m t η, g τ + ∑ V ∈ boxLevelSets m t η, ∑ π ∈ boxesAt η V, ∑ τ ∈ π.leaves, g τ

A sum splits into low-order leaves and the disjoint output boxes.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.bilinearProduct_eq_boxQuery {L : ℕ} (m t : ℕ) (ht : t ≤ m) (a : LeftStr L → ℤ) (b : RightStr L → ℤ) (η : OutStr L) (hη : (innerSetO η).card = m) :
bilinearProduct a b η = boxQuery m t a b η

The signed bilinear product equals the complete query expression.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.card_low_add_box_leaves {L : ℕ} (m t : ℕ) (ht : t ≤ m) (η : OutStr L) (hη : (innerSetO η).card = m) :
(lowLeaves m t η).card + ∑ π ∈ (boxLevelSets m t η).biUnion (boxesAt η), π.leaves.card = 10 ^ m

Low-order leaves and box leaves account for each contributing leaf once.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.box_query_counts {L : ℕ} (m t : ℕ) (ht : t ≤ m) (η : OutStr L) (hη : (innerSetO η).card = m) :
(lowLeaves m t η).card = ∑ d ∈ Finset.range t, alpha m d ∧ ∑ V ∈ boxLevelSets m t η, (boxesAt η V).card = alpha m t ∧ ((boxLevelSets m t η).biUnion (boxesAt η)).card = alpha m t

The exact query counts are given by the existing alpha function.

theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.mem_boxesWithStars_of_mem_boxesAt {L : ℕ} (m t : ℕ) (η : OutStr L) (V : Finset (Fin L)) (hV : V ∈ boxLevelSets m t η) (π : Cube L) (hπ : π ∈ boxesAt η V) :

An output box belongs to the global box set at its actual star count.