matrix_trace_unitaryGroup_one
The trace of the identity unitary matrix indexed by a finite type n equals the cardinality of n.
Statement
theorem matrix_trace_unitaryGroup_one {n : Type*} [Fintype n] [DecidableEq n] : Matrix.trace (((1 : Matrix.unitaryGroup n ℂ)) : Matrix n n ℂ) = (Fintype.card n : ℂ)
- Source
- step towards local_encoding_via_abelian_traceless_group
- Verified
- 14 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- matrix_has_psd_factorization_of_nonnegEvery entrywise nonnegative real matrix with finitely many rows m has a positive semidefinite factorization of size |m|: diagonal factors,…
The proof, explained
The statement asserts that the trace of the identity matrix in the unitary group over ℂ is equal to the dimension of the matrix, given by the cardinality of the indexing type n. The proof is closed automatically by simplification, which unwinds the coercion of the group identity to the identity matrix and applies the identity for the trace of the identity matrix.
The trace of the identity unitary matrix equals the cardinality of the index type n as a complex number. automation
The proof executes a cascade of candidate tactics via `first`. The first three alternatives fail, but the fourth, `simpa`, succeeds: the simplifier recognizes that the coercion of the identity element of the unitary group is the identity matrix, and evaluates its trace to the cardinality of n. The provided lemma `matrix_has_psd_factorization_of_nonneg` is ignored by the simplifier as it is not needed to close the goal.
uses
matrix_has_psd_factorization_of_nonnegMatrix.trace (((1 : Matrix.unitaryGroup n ℂ)) : Matrix n n ℂ) = (Fintype.card n : ℂ) := by first | exact matrix_has_psd_factorization_of_nonneg | (apply matrix_has_psd_factorization_of_nonneg <;> assumption) | (apply matrix_has_psd_factorization_of_nonneg <;> simp_all) | simpa using matrix_has_psd_factorization_of_nonneg
matrix_has_psd_factorization_of_nonneg- every entrywise nonnegative real matrix has a positive semidefinite factorization of size at most its row dimension
- The proof script is the result of automated proof search: it tries several branches with `first | ...`, and the final branch `simpa using matrix_has_psd_factorization_of_nonneg` succeeds purely through standard simplification. The lemma `matrix_has_psd_factorization_of_nonneg` is completely unused by the simplifier.
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 trace of the identity matrix is the dimension. -/theorem matrix_trace_unitaryGroup_one {n : Type*} [Fintype n] [DecidableEq n] : Matrix.trace (((1 : Matrix.unitaryGroup n ℂ)) : Matrix n n ℂ) = (Fintype.card n : ℂ) := by first | exact matrix_has_psd_factorization_of_nonneg | (apply matrix_has_psd_factorization_of_nonneg <;> assumption) | (apply matrix_has_psd_factorization_of_nonneg <;> simp_all) | simpa using matrix_has_psd_factorization_of_nonneg