Documentation

CslibFrontier.Algorithms.MatrixMultiplication.Strassen.Phases

Partial Strassen accumulators for the native traversal proof #

The seven operand forms and their output signs give a pointwise prefix invariant for the explicit native stack. They are ordinary finite mathematics, not a supplied answer or run. Every partialValue quadrant has at most four signed child contributions, including cancellation. The definitions below serve internal execution proofs, rather than another matrix-product API.

The forms/signs are the same Strassen identities adapted in Strassen.Defs, from pinned Spec/Sec3/Theorem17/Strassen.lean at revision 16a5ce41304fcdaea4e0be7c132e1c361dc26da5.

First actual mathematical operand of each of the seven native recursive children.

Second actual mathematical operand of each native child.

The already-defined finite seven-product recursion on one actual child operand pair.

Contribution of a returned child to a selected output quadrant.

def Cslib.Algorithms.MatrixMultiplication.Strassen.partialValue (p k completed : ℕ) (a b : ℕ → ℤ) (quadrant : Fin 4) (r : ℕ) :

Signed partial output after the first completed children have been accumulated.

@[simp]
theorem Cslib.Algorithms.MatrixMultiplication.Strassen.partialValue_zero (p k : ℕ) (a b : ℕ → ℤ) (quadrant : Fin 4) (r : ℕ) :
partialValue p k 0 a b quadrant r = 0

No child has contributed immediately after the actual native clear.

theorem Cslib.Algorithms.MatrixMultiplication.Strassen.partialValue_succ (p k : ℕ) (completed : Fin 7) (a b : ℕ → ℤ) (quadrant : Fin 4) (r : ℕ) :
partialValue p k (↑completed + 1) a b quadrant r = partialValue p k (↑completed) a b quadrant r + contribution completed quadrant * childProduct p k a b completed r

One returned child changes the partial sum by exactly its fixed signed contribution.

theorem Cslib.Algorithms.MatrixMultiplication.Strassen.contribution_weight_le_four (completed : ℕ) (hc : completed ≤ 7) (q : Fin 4) :
(∑ t : Fin 7, if ↑t < completed then (contribution t q).natAbs else 0) ≤ 4

Each output quarter has at most four contributions at every intermediate stage.

theorem Cslib.Algorithms.MatrixMultiplication.Strassen.partialValue_natAbs_le {p k completed r C : ℕ} (a b : ℕ → ℤ) (q : Fin 4) (hc : completed ≤ 7) (hchild : ∀ (t : Fin 7), (childProduct p k a b t r).natAbs ≤ C) :
(partialValue p k completed a b q r).natAbs ≤ 4 * C

Every partial accumulator fits the four-term envelope, without assuming a sparse result.

theorem Cslib.Algorithms.MatrixMultiplication.Strassen.operands_natAbs_le {p k A r : ℕ} (a : ℕ → ℤ) (t : Fin 7) (ha : ∀ j < 4 ^ (k + 1) * p, (a j).natAbs ≤ A) (hr : r < 4 ^ k * p) :
(leftOperand p k a t r).natAbs ≤ 2 * A ∧ (rightOperand p k a t r).natAbs ≤ 2 * A

Each concrete operand form has at most twice the original coefficient magnitude.

theorem Cslib.Algorithms.MatrixMultiplication.Strassen.childProduct_natAbs_le {p k A B r : ℕ} (a b : ℕ → ℤ) (t : Fin 7) (ha : ∀ j < 4 ^ (k + 1) * p, (a j).natAbs ≤ A) (hb : ∀ j < 4 ^ (k + 1) * p, (b j).natAbs ≤ B) (hr : r < 4 ^ k * p) :
(childProduct p k a b t r).natAbs ≤ p * (2 * A * (2 * B)) * 16 ^ k

Child coefficient bounds come from the already-proved finite recursion, rather than an assumed child result bound.

theorem Cslib.Algorithms.MatrixMultiplication.Strassen.partialValue_seven (p k : ℕ) (a b : ℕ → ℤ) (q : Fin 4) (r : ℕ) :
partialValue p k 7 a b q r = match q with | 0 => childProduct p k a b 0 r + childProduct p k a b 3 r - childProduct p k a b 4 r + childProduct p k a b 6 r | 1 => childProduct p k a b 2 r + childProduct p k a b 4 r | 2 => childProduct p k a b 1 r + childProduct p k a b 3 r | 3 => childProduct p k a b 0 r - childProduct p k a b 1 r + childProduct p k a b 2 r + childProduct p k a b 5 r

The four completed output expressions are exactly the usual Strassen combinations.

theorem Cslib.Algorithms.MatrixMultiplication.Strassen.multiply_eq_partialValue {p k r : ℕ} (hp : 0 < p) (a b : ℕ → ℤ) (t : Fin 4) (hr : r < 4 ^ k * p) :
multiply p (k + 1) a b (↑t * (4 ^ k * p) + r) = partialValue p k 7 a b t r

The completed native-style partial invariant agrees with the existing finite multiply specification on every real coefficient of each output quadrant.