AFTD Auto-Formalizing Theoretical Domains

eval_matrix3_triad_smul_left

theoremverified

Given a commutative semiring R, a triad t of type Matrix3Triad R, a scalar c : R, and matrices A and B, eval_matrix3_triad t (c • A) B equals c • eval_matrix3_triad t A B.

Statement

theorem eval_matrix3_triad_smul_left {R : Type*} [CommSemiring R] (t : Matrix3Triad R) (c : R) (A B : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_triad t (c • A) B = c • eval_matrix3_triad t A B
Source
step towards matrix3_tensor_rank_int_le_22
Verified
23 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • eval_matrix3_triadGiven a commutative semiring R, a triad t of type Matrix3Triad R, and 3x3 matrices A and B over R, eval_matrix3_triad t A B is the scalar…
  • Matrix3TriadGiven a type R, a Matrix3Triad R is a structure consisting of three 3-by-3 matrices with entries in R, labeled u, v, and w.
Used by 1
  • matrix3_valid_of_unit_checksIf a list L of triads over a commutative semiring R evaluates to matrix multiplication on all 81 pairs of matrix units, then L is a valid…

The proof, explained

The evaluation of a triad t on matrices A and B is given by the product of two matrix inner products scaling the third matrix t.w. By distributing multiplication and reordering factors, the scalar c factors out of the inner product with the first matrix. Reassociating the scalar products then pulls c out to scale the overall evaluation matrix.

  1. The triad evaluation is expanded according to its definition.

    Unfolding the definition of `eval_matrix3_triad` on both sides reduces the goal to showing that the scalar multiple c pulls out of the coefficient of t.w, which is the product of the Frobenius inner products of t.u with c • A and t.v with B.

    line 3

    uses eval_matrix3_triad

      simp only [eval_matrix3_triad]
  2. Scalar multiplication factors out of the double sum: ∑ i j, t.u i j * (c • A) i j = c * ∑ i j, t.u i j * A i j.

    First, the matrix scalar multiplication (c • A) i j is expanded into entrywise multiplication c * A i j using `Matrix.smul_apply` and `smul_eq_mul`. Then, Finset.mul_sum is applied to factor c into the outer sum and inner sum, using `Finset.sum_congr` to work under the summations. Finally, mul_left_comm rewrites each summand t.u i j * (c * A i j) into c * (t.u i j * A i j).

    lines 4–10

    uses Matrix.smul_apply, smul_eq_mul, Finset.mul_sum, Finset.sum_congr, mul_left_comm

      have hsum : (∑ i, ∑ j, t.u i j * (c • A) i j) = c * ∑ i, ∑ j, t.u i j * A i j := by
        simp only [Matrix.smul_apply, smul_eq_mul]
        rw [Finset.mul_sum]
        refine Finset.sum_congr rfl fun i _ => ?_
        rw [Finset.mul_sum]
        refine Finset.sum_congr rfl fun j _ => ?_
        rw [mul_left_comm]
  3. The evaluation eval_matrix3_triad t (c • A) B equals c • eval_matrix3_triad t A B.

    Substituting the factored sum `hsum` into the LHS yields ((c * sA) * sB) • t.w. Reassociating the product via `mul_assoc` produces (c * (sA * sB)) • t.w, which by `smul_smul` is equal to c • ((sA * sB) • t.w), completing the proof.

    line 11

    uses mul_assoc, smul_smul

      rw [hsum, mul_assoc, smul_smul]
eval_matrix3_triad
The definition of triad evaluation: for a triad t = (u, v, w) and matrices A and B, the evaluation is ((∑ i j, u i j * A i j) * ∑ i j, v i j * B i j) • w.
Matrix.smul_apply
Scalar multiplication on matrices is entrywise: (r • A) i j = r • A i j.
smul_eq_mul
Scalar multiplication of ring elements on themselves coincides with multiplication: a • b = a * b.
Finset.mul_sum
Left multiplication distributes over a finite sum: a * ∑ i ∈ s, f i = ∑ i ∈ s, a * f i.
Finset.sum_congr
Two finite sums are equal if their index sets coincide and their summands are equal at every element.
mul_left_comm
Multiplication satisfies the left-commutativity identity a * (b * c) = b * (a * c) in any commutative semigroup.
mul_assoc
Multiplication is associative: (a * b) * c = a * (b * c).
smul_smul
Successive scalar multiplications combine via the product of the scalars: a₁ • a₂ • b = (a₁ * a₂) • b.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- Scalar multiplication on the left factor of a triad evaluation pulls out as a scalar multiple of the whole evaluation matrix. -/theorem eval_matrix3_triad_smul_left {R : Type*} [CommSemiring R] (t : Matrix3Triad R) (c : R) (A B : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_triad t (c • A) B = c • eval_matrix3_triad t A B := by  simp only [eval_matrix3_triad]  have hsum : (∑ i, ∑ j, t.u i j * (c • A) i j) = c * ∑ i, ∑ j, t.u i j * A i j := by    simp only [Matrix.smul_apply, smul_eq_mul]    rw [Finset.mul_sum]    refine Finset.sum_congr rfl fun i _ => ?_    rw [Finset.mul_sum]    refine Finset.sum_congr rfl fun j _ => ?_    rw [mul_left_comm]  rw [hsum, mul_assoc, smul_smul]
See it in the graphDiscuss this resultChallenge it