transpose_one_add_diagonal_mul_mul
For any finite index type n with decidable equality, any real n-by-n matrix M, and any vector d : n → ℝ, the transpose of 1 + Matrix.diagonal d * M * Matrix.diagonal d equals 1 + Matrix.diagonal d * M.transpose * Matrix.diagonal d.
Statement
theorem transpose_one_add_diagonal_mul_mul {n : Type*} [Fintype n] [DecidableEq n] (M : Matrix n n ℝ) (d : n → ℝ) : (1 + Matrix.diagonal d * M * Matrix.diagonal d).transpose = 1 + Matrix.diagonal d * M.transpose * Matrix.diagonal d
- Source
- scout/2611-07815-newton-steps-are-faster-for-linear-complementarity-problems.md:529
- Verified
- 07 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
Read back from the Lean
For every finite type $n$ with decidable equality, every $n \times n$ matrix $M$ with real entries, and every function $d : n \to \mathbb{R}$, the transpose of the matrix $(I + D M D)$ equals $I + D M^{\top} D$, where $I$ is the $n \times n$ identity matrix and $D = \text{diagonal}(d)$ is the diagonal matrix whose diagonal entries are given by $d$.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
The identity states that transposing I + D * M * D yields I + D * Mᵀ * D, where D is the diagonal matrix with entries d. The proof invokes the simplifier augmented with matrix associativity (`Matrix.mul_assoc`). The simplifier distributes the transpose across addition and products, uses the fact that both the identity and diagonal matrices are symmetric, and closes the goal.
The transpose of I + D * M * D is equal to I + D * Mᵀ * D, where D = Matrix.diagonal d. automation
The simplifier evaluates the transpose of the sum and products. Transposition distributes over addition and reverses matrix products, transforming (I + (D * M) * D)ᵀ into Iᵀ + Dᵀ * (D * M)ᵀ = Iᵀ + Dᵀ * Mᵀ * Dᵀ. Because the identity matrix and diagonal matrices are symmetric (Iᵀ = I and Dᵀ = D), and matrix multiplication is associative via `Matrix.mul_assoc`, this simplifies directly to I + D * Mᵀ * D.
uses
Matrix.mul_assocsimp [Matrix.mul_assoc]
Matrix.mul_assoc- Matrix multiplication is associative: (L * M) * N = L * (M * N) for conformable matrices.
- The `simp` tactic silently applies library simplification lemmas for matrices: transposition distributing over addition (`Matrix.transpose_add`) and multiplication (`Matrix.transpose_mul`), invariance of the identity matrix under transposition (`Matrix.transpose_one`), and the symmetry of diagonal matrices (`Matrix.diagonal_transpose`).
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.
/-- The transpose of I_n + DMD is I_n + DMᵀD for any diagonal matrix D. -/theorem transpose_one_add_diagonal_mul_mul {n : Type*} [Fintype n] [DecidableEq n] (M : Matrix n n ℝ) (d : n → ℝ) : (1 + Matrix.diagonal d * M * Matrix.diagonal d).transpose = 1 + Matrix.diagonal d * M.transpose * Matrix.diagonal d := by simp [Matrix.mul_assoc]