AFTD Auto-Formalizing Theoretical Domains

eval_matrix3_triad_add_right

theoremverified

Given a commutative semiring R, a triad t of type Matrix3Triad R, and matrices A, B₁, and B₂ in Matrix (Fin 3) (Fin 3) R, eval_matrix3_triad t A (B₁ + B₂) equals eval_matrix3_triad t A B₁ + eval_matrix3_triad t A B₂.

Statement

theorem eval_matrix3_triad_add_right {R : Type*} [CommSemiring R] (t : Matrix3Triad R) (A B₁ B₂ : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_triad t A (B₁ + B₂) = eval_matrix3_triad t A B₁ + 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
  • eval_matrix3_decomposition_add_rightGiven a commutative semiring R, a list L of Matrix3Triad R, and matrices A, B₁, and B₂, eval_matrix3_decomposition L A (B₁ + B₂) equals…

The proof, explained

The evaluation of a triad t on matrices A and B computes a scalar product of t.u with A and of t.v with B, multiplies these two scalars, and scales t.w by the product. To prove right-additivity, the definition is unfolded and entrywise matrix addition is distributed through the inner product with t.v. Distributing the scalar multiplication by the A-factor and then the scaling of t.w across this sum splits the evaluation on B₁ + B₂ into the sum of the evaluations on B₁ and B₂.

  1. Express the goal explicitly in terms of double sums and scalar multiplications by unfolding the definition of triad evaluation.

    Unfolding `eval_matrix3_triad` replaces each occurrence of the evaluation with its definition: computing the Frobenius-like inner product with t.u, computing the inner product with t.v, multiplying those two scalars, and scaling t.w by the result.

    line 3

      unfold eval_matrix3_triad
  2. The evaluation of the triad on B₁ + B₂ equals the sum of the evaluations on B₁ and B₂.

    Simplification rewrites (B₁ + B₂) i j as B₁ i j + B₂ i j using `Matrix.add_apply`, distributes multiplication by t.v i j across the sum via `mul_add`, and splits the double sum over indices i and j into two separate double sums using `Finset.sum_add_distrib`. Then, `mul_add` distributes the scalar factor from the A-sum across this sum of B-scalars, and `add_smul` distributes the scalar multiplication by t.w, matching the right-hand side.

    line 4

    uses Matrix.add_apply, mul_add, Finset.sum_add_distrib, add_smul

      simp only [Matrix.add_apply, mul_add, Finset.sum_add_distrib, add_smul]
Matrix.add_apply
The (i, j)-th entry of a sum of matrices A + B is the sum of their individual entries A i j + B i j.
mul_add
Multiplication distributes over addition on the left: a * (b + c) = a * b + a * c.
Finset.sum_add_distrib
The sum of a pointwise sum over a finite set splits into the sum of the two separate sums: ∑ x ∈ s, (f x + g x) = ∑ x ∈ s, f x + ∑ x ∈ s, g x.
add_smul
Scalar multiplication distributes over addition of scalars: (r + s) • x = r • x + s • x.

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

/-- Right-additivity of triad evaluation: eval_matrix3_triad t A (B₁ + B₂) = eval_matrix3_triad t A B₁ + eval_matrix3_triad t A B₂. -/theorem eval_matrix3_triad_add_right {R : Type*} [CommSemiring R] (t : Matrix3Triad R) (A B₁ B₂ : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_triad t A (B₁ + B₂) = eval_matrix3_triad t A B₁ + eval_matrix3_triad t A B₂ := by  unfold eval_matrix3_triad  simp only [Matrix.add_apply, mul_add, Finset.sum_add_distrib, add_smul]
See it in the graphDiscuss this resultChallenge it