eval_matrix3_triad_smul_right
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 A (c • B) equals c • eval_matrix3_triad t A B.
Statement
theorem eval_matrix3_triad_smul_right {R : Type*} [CommSemiring R] (t : Matrix3Triad R) (c : R) (A B : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_triad t A (c • 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 matrix triad t = (u, v, w) on matrices A and B is the scalar multiple (sA * sB) • w, where sA and sB are the entrywise inner products of A and B with u and v respectively. When B is scaled by c, the scalar c factors out of the sum sB by linearity of finite sums and commutativity of multiplication in R. Commuting and associating the scalars then factors c out of the product sA * (c * sB), matching c • eval_matrix3_triad t A B.
Unfolding the definition of triad evaluation expresses the goal as an equality between scalar multiples of the matrix t.w.
Expanding `eval_matrix3_triad` on both sides reduces the theorem to showing that ((∑ i j, t.u i j * A i j) * ∑ i j, t.v i j * (c • B) i j) • t.w equals c • ((∑ i j, t.u i j * A i j) * ∑ i j, t.v i j * B i j) • t.w.
uses
eval_matrix3_triadsimp only [eval_matrix3_triad]The scalar c factors out of the double sum: ∑ i j, t.v i j * (c • B) i j = c * ∑ i j, t.v i j * B i j.
Using `Matrix.smul_apply` and `smul_eq_mul`, each matrix entry (c • B) i j is rewritten as c * B i j. Distributing c through the outer and inner sums via `Finset.mul_sum` and `Finset.sum_congr`, and commuting factors within each term via `mul_left_comm`, establishes this equality as the helper hypothesis `hsum`.
uses
Matrix.smul_apply,smul_eq_mul,Finset.mul_sum,Finset.sum_congr,mul_left_commhave hsum : (∑ i, ∑ j, t.v i j * (c • B) i j) = c * ∑ i, ∑ j, t.v i j * B 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]
Substituting the factored sum into the goal and combining the scalar multiplications on the right-hand side leaves an equation with identical base matrix t.w.
Rewriting with `hsum` replaces the sum involving c • B with c * ∑ i j, t.v i j * B i j. Then `smul_smul` combines the outer scalar multiplications on the right-hand side, rewriting c • (X • t.w) as (c * X) • t.w.
uses
smul_smulrw [hsum, smul_smul]The scalar coefficients of t.w on both sides are equal, completing the proof. automation
Stripping the common matrix factor t.w reduces the goal to showing that sA * (c * sB) = c * (sA * sB) in the commutative semiring R, where sA and sB are the respective inner products with t.u and t.v. The `ring` tactic verifies this identity by commutativity and associativity of multiplication.
congr 1 ring
eval_matrix3_triad- the evaluation of a 3×3 triad t = (u, v, w) on matrices A and B, defined as ((∑ i j, t.u i j * A i j) * (∑ i j, t.v i j * B i j)) • t.w
Matrix.smul_apply- the (i, j)-entry of a scalar multiple of a matrix r • A equals r • A i j
smul_eq_mul- scalar multiplication by an element of the ring equals ring multiplication: a • b = a * b
Finset.mul_sum- multiplication by a scalar distributes over a finite sum: a * ∑ i ∈ s, f i = ∑ i ∈ s, a * f i
Finset.sum_congr- two finite sums over the same set are equal if their terms agree at every index
mul_left_comm- in a commutative semigroup, multiplication satisfies a * (b * c) = b * (a * c)
smul_smul- consecutive scalar multiplications associate as (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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
/-- Scalar multiplication on the right factor of a triad evaluation pulls out as a scalar multiple of the whole evaluation matrix. -/theorem eval_matrix3_triad_smul_right {R : Type*} [CommSemiring R] (t : Matrix3Triad R) (c : R) (A B : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_triad t A (c • B) = c • eval_matrix3_triad t A B := by simp only [eval_matrix3_triad] have hsum : (∑ i, ∑ j, t.v i j * (c • B) i j) = c * ∑ i, ∑ j, t.v i j * B 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, smul_smul] congr 1 ring