AFTD Auto-Formalizing Theoretical Domains

matrix_trace_unitaryGroup_one

theoremverified

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

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.

  1. 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.

    line 3

    uses matrix_has_psd_factorization_of_nonneg

        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
matrix_has_psd_factorization_of_nonneg
every entrywise nonnegative real matrix has a positive semidefinite factorization of size at most its row dimension

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

/-- 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
See it in the graphDiscuss this resultChallenge it