Skip to content

Commit d74f0f9

Browse files
SnirBroshiBergschaf
authored andcommitted
feat(LinearAlgebra/Matrix/Charpoly/Eigs): generalize to CommRings (leanprover-community#39601)
Also adds `r ∈ spectrum R B ↔ ¬IsUnit (B.charpoly.eval r)` which is the ring version of `r ∈ spectrum K A ↔ A.charpoly.IsRoot r`.
1 parent 6226957 commit d74f0f9

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

  • Mathlib/LinearAlgebra/Matrix/Charpoly

Mathlib/LinearAlgebra/Matrix/Charpoly/Eigs.lean

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,35 @@ open scoped Matrix
6363

6464
namespace Matrix
6565

66-
/-- The roots of the characteristic polynomial are in the spectrum of the matrix. -/
67-
theorem mem_spectrum_of_isRoot_charpoly [Nontrivial R]
68-
{r : R} (hr : IsRoot B.charpoly r) : r ∈ spectrum R B := by
69-
simp_all [eval_charpoly, spectrum.mem_iff, isUnit_iff_isUnit_det, algebraMap_eq_diagonal,
66+
theorem mem_spectrum_iff_not_isUnit_eval_charpoly {r : R} :
67+
r ∈ spectrum R B ↔ ¬IsUnit (B.charpoly.eval r) := by
68+
simp [eval_charpoly, spectrum.mem_iff, isUnit_iff_isUnit_det, algebraMap_eq_diagonal,
7069
Pi.algebraMap_def]
7170

71+
/-- The roots of the characteristic polynomial are in the spectrum of the matrix. -/
72+
theorem mem_spectrum_of_isRoot_charpoly [Nontrivial R] {r : R} (hr : IsRoot B.charpoly r) :
73+
r ∈ spectrum R B := by
74+
simp [mem_spectrum_iff_not_isUnit_eval_charpoly, hr.eq_zero]
75+
7276
/--
7377
In fields, the roots of the characteristic polynomial are exactly the spectrum of the matrix.
7478
The weaker direction is true in nontrivial rings (see `Matrix.mem_spectrum_of_isRoot_charpoly`).
7579
-/
7680
theorem mem_spectrum_iff_isRoot_charpoly {r : K} : r ∈ spectrum K A ↔ IsRoot A.charpoly r := by
77-
simp [eval_charpoly, spectrum.mem_iff, isUnit_iff_isUnit_det, algebraMap_eq_diagonal,
78-
Pi.algebraMap_def]
81+
simp [mem_spectrum_iff_not_isUnit_eval_charpoly]
7982

80-
theorem det_eq_prod_roots_charpoly_of_splits (hAps : A.charpoly.Splits) :
81-
A.det = (Matrix.charpoly A).roots.prod := by
82-
rw [det_eq_sign_charpoly_coeff, ← charpoly_natDegree_eq_dim A,
83-
hAps.coeff_zero_eq_prod_roots_of_monic A.charpoly_monic, ← mul_assoc,
83+
theorem det_eq_prod_roots_charpoly_of_splits [IsDomain R] (hAps : B.charpoly.Splits) :
84+
B.det = (Matrix.charpoly B).roots.prod := by
85+
rw [det_eq_sign_charpoly_coeff, ← charpoly_natDegree_eq_dim B,
86+
hAps.coeff_zero_eq_prod_roots_of_monic B.charpoly_monic, ← mul_assoc,
8487
← pow_two, pow_right_comm, neg_one_sq, one_pow, one_mul]
8588

86-
theorem trace_eq_sum_roots_charpoly_of_splits (hAps : A.charpoly.Splits) :
87-
A.trace = (Matrix.charpoly A).roots.sum := by
89+
theorem trace_eq_sum_roots_charpoly_of_splits [IsDomain R] (hAps : B.charpoly.Splits) :
90+
B.trace = (Matrix.charpoly B).roots.sum := by
8891
rcases isEmpty_or_nonempty n with h | _
8992
· simp
9093
· rw [trace_eq_neg_charpoly_nextCoeff, neg_eq_iff_eq_neg,
91-
← hAps.nextCoeff_eq_neg_sum_roots_of_monic A.charpoly_monic]
94+
← hAps.nextCoeff_eq_neg_sum_roots_of_monic B.charpoly_monic]
9295

9396
variable (A)
9497

0 commit comments

Comments
 (0)