Diagonalizable exactly when there is an eigenbasis
ProvedHefferonLinAlg.diagonalizable_iff_eigenbasisAn matrix over a field is similar to a diagonal matrix if and only if has a basis of eigenvectors of — a basis together with scalars satisfying for every . This is the first canonical form of Chapter Five and the model for the last one: Jordan form is what one settles for when no eigenbasis exists.
import Mathlib open Matrix
namespace HefferonLinAlg
theorem diagonalizable_iff_eigenbasis
{K : Type*} [Field K] {n : ℕ} (A : Matrix (Fin n) (Fin n) K) :
(∃ (P : Matrix (Fin n) (Fin n) K) (d : Fin n → K),
IsUnit P.det ∧ P⁻¹ * A * P = Matrix.diagonal d) ↔
(∃ (B : Module.Basis (Fin n) K (Fin n → K)) (lam : Fin n → K),
∀ i, A *ᵥ B i = lam i • B i) := by
sorry
end HefferonLinAlgRead-back
What the Lean code literally says, in plain math · claude-opus-5
For every field (an arbitrary type carrying a field structure, with no assumption of algebraic closure, characteristic, or ordering), every natural number (including ), and every square matrix whose rows and columns are indexed by the -element index type , the following two existence statements are equivalent (a genuine two-directional "if and only if", not an implication in one direction):
-
Left side. There exist a matrix and a function such that is a unit of — equivalently, since is a field, — and , the matrix whose entry is and whose off-diagonal entries are . Here denotes the total inversion operation on matrices (which would return the zero matrix for a singular argument), but the accompanying invertibility hypothesis forces it to be the genuine two-sided inverse of ; note also the specific order of the product, on the left and on the right.
-
Right side. There exist a basis of the -vector space of functions , indexed by (so it consists of exactly vectors ), and a function , such that for every index the matrix–vector product satisfies
where is the usual left action of the matrix on a column vector and is scalar multiplication.
Several things the quantifiers silently permit should be made explicit: the scalars and are unconstrained elements of and may be zero, repeated, or all equal; no relationship (equality, permutation, or matching multiplicities) is asserted between the diagonal entries produced on one side and the scalars produced on the other, nor between and ; the basis vectors are automatically nonzero and linearly independent by virtue of forming a basis, but no normalization, orthogonality, or ordering condition is imposed; and in the degenerate case both sides hold trivially (the unique matrix has determinant , and the empty family is a basis of the zero space, with the universally quantified condition holding vacuously), so the equivalence carries no content there. The statement is asserted for the fixed matrix supplied as an argument, with , , and the field structure on inferred rather than stated by the user; it claims only the equivalence of the two existence statements and does not exhibit or construct either , , , or .
Confirmed by the mission captain (proposal self-audit).