The rank of 3×3 matrix multiplication over F2 is 23
Abstract
The rank of the tensor of 3×3 matrix multiplication over the field with two elements is at most 23 by Laderman's algorithm, and Rudich and Rousseau recently proved that it is at least 22. We prove that it equals 23. Hence Laderman's algorithm uses the fewest multiplications among all bilinear algorithms over F2 and among all bilinear algorithms with integer coefficients. The proof uses the substitution method in the form developed by D'Ambrosio, Wang and Yang et al., which bounds the number of first factors of a decomposition that lie in a given subspace of the space of first factors. We sharpen these bounds for 111 of Wang's 496 classes of subspaces, constrain the ranks of the first factors through a 27×27 flattening of the tensor, and list, up to symmetry, all sets of 22 first factors that satisfy these constraints. An exact completion search shows that none of them is the set of first factors of a decomposition. The computation emits certificates, which are checked in the Lean 4 proof assistant. In one formal proof the largest checks are evaluated as compiled code, and in a second one the kernel evaluates every check, so that its final theorem depends only on the three standard axioms of Lean. The Lean proofs build on the formalization of Rudich and Rousseau and import their table of bounds and their reduction for block algorithms.
In plain words
Computers multiply tables of numbers, called matrices, everywhere from neural networks to scientific computing. A shortcut for small tables can be reused on blocks of large ones, as Strassen showed for 2×2 tables in 1969. For 3×3 tables the best such methods known use 23 multiplications. Laderman found the first of these methods in 1976, and whether fewer multiplications would do has been open ever since. This paper proves that 23 are needed in two cases: when the arithmetic is done on single bits, where 1 + 1 = 0, and when every constant in the method is an integer. With arbitrary real constants, the question is still open.
Formal statement and axioms
Each main result as stated in Lean, copied verbatim from the published package, with the axioms that the proof rests on. Lean v4.30.0, Mathlib v4.30.0. The package.
R22K.Final.rank_eq_23
The rank over F₂: kernel-only
theorem rankEq23 :
(∃ (a b c : Fin 23 → M3), IsDecomp a b c) ∧ ∀ (n : ℕ) (a b c : Fin n → M3), IsDecomp a b c → 23 ≤ nDefinitions used in the statement
abbrev M3 := Matrix (Fin 3) (Fin 3) F2def F2 : Type := ZMod 2def IsDecomp {n : ℕ} (a b c : Fin n → M3) : Prop :=
∀ i j j' k k' i' : Fin 3,
(∑ s, a s i j * b s j' k * c s k' i') = if j = j' ∧ k = k' ∧ i = i' then 1 else 0Axioms, as Lean reports them. Recorded in the published file (also THEOREM.md#L41).
'R22K.Final.rank_eq_23' depends on axioms: [propext, Classical.choice, Quot.sound]R22K.Final.recursive_23
The bound for algorithms that use integer coefficients and can be applied to blocks of matrices: kernel-only
theorem recursive23 : RecursiveAlgorithmMultiplicationsAtLeast 23Definitions used in the statement
def RecursiveAlgorithmMultiplicationsAtLeast (n : ℕ) : Prop :=
∀ steps : List Step, DoesMatrixMultiplicationOnBlocks steps → n ≤ multiplication_count stepsdef DoesMatrixMultiplicationOnBlocks (steps : List Step) : Prop :=
∀ m : ℕ, ∀ A B : BlockGrid m, program_output steps A B = A * Babbrev BlockGrid (m : ℕ) : Type := Matrix (Fin 3) (Fin 3) (Block m)abbrev Block (m : ℕ) : Type := Matrix (Fin m) (Fin m) ℝdef multiplication_count (steps : List Step) : ℕ :=
(steps.filter fun s => match s with | .mul _ _ => true | _ => false).lengthinductive Step
/-- Read the entry of `A` at cell `(i, j)`. -/
| fromA (i j : Fin 3)
/-- Read the entry of `B` at cell `(i, j)`. -/
| fromB (i j : Fin 3)
/-- The sum of the values at steps `x` and `y`. -/
| add (x y : ℕ)
/-- The difference of the values at steps `x` and `y`. -/
| sub (x y : ℕ)
/-- The value at step `x` multiplied by the integer `w`. -/
| scale (w : ℤ) (x : ℕ)
/-- The product of the values at steps `x` and `y`. -/
| mul (x y : ℕ)
/-- Store the value at step `x` into cell `(i, j)` of the output. -/
| toC (i j : Fin 3) (x : ℕ)def step_value {R : Type} [Ring R] (s : Step) (A B : Matrix (Fin 3) (Fin 3) R)
(value_at : List R) : R :=
match s with
| .fromA i j => A i j
| .fromB i j => B i j
| .add x y => value_at[x]?.getD 0 + value_at[y]?.getD 0
| .sub x y => value_at[x]?.getD 0 - value_at[y]?.getD 0
| .scale w x => (w : R) * value_at[x]?.getD 0
| .mul x y => value_at[x]?.getD 0 * value_at[y]?.getD 0
| .toC _ _ x => value_at[x]?.getD 0def run {R : Type} [Ring R] (steps : List Step) (A B : Matrix (Fin 3) (Fin 3) R) : List R :=
steps.foldl (fun value_at s => value_at ++ [step_value s A B value_at]) []def stored_value {R : Type} [Ring R] (steps : List Step) (A B : Matrix (Fin 3) (Fin 3) R)
(i j : Fin 3) : R :=
(((steps.zip (run steps A B)).filter fun sv =>
match sv.1 with
| .toC a b _ => a == i && b == j
| _ => false).getLast?.map Prod.snd).getD 0def program_output {R : Type} [Ring R] (steps : List Step) (A B : Matrix (Fin 3) (Fin 3) R) :
Matrix (Fin 3) (Fin 3) R :=
Matrix.of fun i j => stored_value steps A B i jAxioms, as Lean reports them. Recorded in the published file (also THEOREM.md#L44).
'R22K.Final.recursive_23' depends on axioms: [propext, Classical.choice, Quot.sound]R22B.rank_eq_23
The rank over F₂: with compiled code
theorem rank_eq_23 :
(∃ (a b c : Fin 23 → M3), IsDecomp a b c) ∧ ∀ (n : ℕ) (a b c : Fin n → M3), IsDecomp a b c → 23 ≤ nDefinitions used in the statement
abbrev M3 := Matrix (Fin 3) (Fin 3) F2def F2 : Type := ZMod 2def IsDecomp {n : ℕ} (a b c : Fin n → M3) : Prop :=
∀ i j j' k k' i' : Fin 3,
(∑ s, a s i j * b s j' k * c s k' i') = if j = j' ∧ k = k' ∧ i = i' then 1 else 0The package records no axiom report for this theorem.
1 more formal statements
R22B.recursive_23
The bound for algorithms that use integer coefficients and can be applied to blocks of matrices: with compiled code
theorem recursive_23 : RecursiveAlgorithmMultiplicationsAtLeast 23Definitions used in the statement
def RecursiveAlgorithmMultiplicationsAtLeast (n : ℕ) : Prop :=
∀ steps : List Step, DoesMatrixMultiplicationOnBlocks steps → n ≤ multiplication_count stepsdef DoesMatrixMultiplicationOnBlocks (steps : List Step) : Prop :=
∀ m : ℕ, ∀ A B : BlockGrid m, program_output steps A B = A * Babbrev BlockGrid (m : ℕ) : Type := Matrix (Fin 3) (Fin 3) (Block m)abbrev Block (m : ℕ) : Type := Matrix (Fin m) (Fin m) ℝdef multiplication_count (steps : List Step) : ℕ :=
(steps.filter fun s => match s with | .mul _ _ => true | _ => false).lengthinductive Step
/-- Read the entry of `A` at cell `(i, j)`. -/
| fromA (i j : Fin 3)
/-- Read the entry of `B` at cell `(i, j)`. -/
| fromB (i j : Fin 3)
/-- The sum of the values at steps `x` and `y`. -/
| add (x y : ℕ)
/-- The difference of the values at steps `x` and `y`. -/
| sub (x y : ℕ)
/-- The value at step `x` multiplied by the integer `w`. -/
| scale (w : ℤ) (x : ℕ)
/-- The product of the values at steps `x` and `y`. -/
| mul (x y : ℕ)
/-- Store the value at step `x` into cell `(i, j)` of the output. -/
| toC (i j : Fin 3) (x : ℕ)def step_value {R : Type} [Ring R] (s : Step) (A B : Matrix (Fin 3) (Fin 3) R)
(value_at : List R) : R :=
match s with
| .fromA i j => A i j
| .fromB i j => B i j
| .add x y => value_at[x]?.getD 0 + value_at[y]?.getD 0
| .sub x y => value_at[x]?.getD 0 - value_at[y]?.getD 0
| .scale w x => (w : R) * value_at[x]?.getD 0
| .mul x y => value_at[x]?.getD 0 * value_at[y]?.getD 0
| .toC _ _ x => value_at[x]?.getD 0def run {R : Type} [Ring R] (steps : List Step) (A B : Matrix (Fin 3) (Fin 3) R) : List R :=
steps.foldl (fun value_at s => value_at ++ [step_value s A B value_at]) []def stored_value {R : Type} [Ring R] (steps : List Step) (A B : Matrix (Fin 3) (Fin 3) R)
(i j : Fin 3) : R :=
(((steps.zip (run steps A B)).filter fun sv =>
match sv.1 with
| .toC a b _ => a == i && b == j
| _ => false).getLast?.map Prod.snd).getD 0def program_output {R : Type} [Ring R] (steps : List Step) (A B : Matrix (Fin 3) (Fin 3) R) :
Matrix (Fin 3) (Fin 3) R :=
Matrix.of fun i j => stored_value steps A B i jThe package records no axiom report for this theorem.