Recursive (fuel-driven) Strassen block multiplication #
Strassen.lean proves the one-level 2×2 Strassen identity over a
commutative ring. This file lifts it to a recursive Strassen
multiply on block matrices: a matrix on a doubled index type B ⊕ B is split
into four B-indexed blocks, the seven Strassen products are computed by
recursive sub-multiplications (one fuel level down), and the four result
blocks are recombined via Matrix.fromBlocks.
Design #
- Block index family.
dim fuel m₀doubles the base index typem₀once per fuel level:dim 0 m₀ = m₀,dim (k+1) m₀ = dim k m₀ ⊕ dim k m₀. This sidesteps the dependentFin (2*n)reindexing (finSumFinEquiv/reindex) that fights the recursion — the recursion is on the type-level doubling directly, exactly the shapeMatrix.fromBlocksconsumes. - Recursion.
strassenRec fuelmultiplies twodim fuel m₀-indexed matrices. At fuel0it is the ordinary product*; at fuelk+1it splits both operands into four blocks (toBlocks₁₁ …), forms the seven Strassen block products with seven recursivestrassenRec kcalls, and recombines. - Correctness.
strassenRec_eq : strassenRec fuel A B = A * B, by induction on fuel. The step rewrites the seven recursive products to*(IH), folds the blocks back withMatrix.fromBlocks_toBlocks, and discharges the algebraic Strassen identity withMatrix.fromBlocks_multiply+noncomm_ring(the blocks form a non-commutative matrix ring, and the Strassen recombination is order-preserving, so it holds over that ring).
Scope #
The recursion performs actual sub-multiplications at every fuel level. The
complexity accounting (that fuel k uses 7^k base multiplications, the
O(n^log₂7) bound) and the Fin (2*n) data layout are outside the scope of
this file.
API #
dim— the fuel-indexed doubled block index type.strassenRec— fuel-recursive Strassen multiply.strassen_blocks_eq— the non-commutative block Strassen recombination identity (the algebraic heart).strassenRec_eq—strassenRec fuel A B = A * B.
The fuel-indexed doubled block index type: doubles the base index m₀ once
per fuel level.
Equations
Instances For
The non-commutative block Strassen recombination identity. For four
blocks of each operand (over any matrix ring Matrix m m R, which is not
commutative), the Strassen seven-product recombination of the blocks equals
the block product fromBlocks … * fromBlocks …. The seven products appear
in operand order, so the identity holds over the non-commutative block ring.
Fuel-recursive Strassen multiply on the doubled block index dim m₀ fuel.
Fuel 0 is the ordinary product; each fuel step splits into four blocks,
forms seven Strassen products with recursive calls, and recombines.
Equations
- One or more equations did not get rendered due to their size.
- Transfer.Examples.CoqEAL.StrassenRec.strassenRec m₀ 0 A B = A * B
Instances For
Recursive Strassen correctness. The fuel-recursive Strassen multiply
equals the ordinary matrix product, for any fuel. Induction on fuel: the base
is *; the step rewrites the seven recursive products to * via the IH,
reassembles via Matrix.fromBlocks_toBlocks, and closes with the
non-commutative block Strassen identity strassen_blocks_eq.