NonzeroSpectrum.lean
1module2public import SubentropyCertificates.BinaryPureHelstrom3public import SubentropyCertificates.UniformEndpoint4public import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff5import all D5.S3.Quantum.Subentropy.DensityKernel67/-! Nonzero eigenvalues counted with algebraic multiplicity, and their8relation to the determinant integral defining subentropy. -/9@[expose] public section10noncomputable section11set_option autoImplicit false12open Matrix Polynomial MeasureTheory13open scoped BigOperators14namespace SubentropyCertificates.BinarySpectra15open D5.S3.Quantum.Subentropy.Basic16open D5.S3.Quantum.Subentropy.DensityKernel1718variable {D K : Type*} [Fintype D] [DecidableEq D] [Fintype K] [DecidableEq K]1920def nonzeroSpectrum (A : Matrix D D ℂ) : Multiset ℂ :=21 A.charpoly.roots.filter (· ≠ 0)2223private theorem filter_zero_copies (n : ℕ) :24 (n • ({0} : Multiset ℂ)).filter (· ≠ 0) = 0 := by25 induction n with26 | zero => simp27 | succ n ih => simp [succ_nsmul,Multiset.filter_add,ih]2829/-- Rectangular products in either order have the same nonzero eigenvalues,30including their multiplicities. -/31theorem nonzeroSpectrum_mul_comm (A : Matrix D K ℂ) (B : Matrix K D ℂ) :32 nonzeroSpectrum (A*B) = nonzeroSpectrum (B*A) := by33 have h := congrArg (fun f : ℂ[X] => f.roots.filter (· ≠ 0)) (Matrix.charpoly_mul_comm' A B)34 simpa only [Polynomial.roots_mul (mul_ne_zero (pow_ne_zero _ Polynomial.X_ne_zero)35 (Matrix.charpoly_monic _).ne_zero),Polynomial.roots_X_pow,Multiset.filter_add,36 filter_zero_copies,zero_add,nonzeroSpectrum] using h3738private theorem prod_filter_zero (r : Multiset ℂ) (t : ℝ) :39 ((r.filter (· ≠ 0)).map (fun z => 1+(t:ℂ)*z)).prod =40 (r.map (fun z => 1+(t:ℂ)*z)).prod := by41 induction r using Multiset.induction with42 | empty => simp43 | cons a r ih =>44 by_cases ha : a = 045 · subst a; simp [ih]46 · simp [ha,ih]4748theorem shifted_det_nonzeroSpectrum {A : Matrix D D ℂ} (hA : A.IsHermitian) (t : ℝ) :49 (1+t • A).det = ((nonzeroSpectrum A).map (fun z => 1+(t:ℂ)*z)).prod := by50 rw [nonzeroSpectrum,prod_filter_zero,hA.roots_charpoly_eq_eigenvalues,51 Multiset.map_map,det_spectral hA]52 change (∏ i, ((1+t*hA.eigenvalues i : ℝ):ℂ)) = ∏ i, (1+(t:ℂ)*(hA.eigenvalues i:ℂ))53 push_cast54 rfl5556theorem subentropy_eq_of_nonzeroSpectrum {A : Matrix D D ℂ} {B : Matrix K K ℂ}57 (hA : A.IsHermitian) (hB : B.IsHermitian) (h : nonzeroSpectrum A = nonzeroSpectrum B) :58 matrixSubentropy A = matrixSubentropy B := by59 unfold matrixSubentropy60 apply integral_congr_ae61 exact Filter.Eventually.of_forall fun t => by62 simp only [subentropyKernel,shifted_det_nonzeroSpectrum hA,shifted_det_nonzeroSpectrum hB,h]6364/-- The two spectral values of a binary diagonal matrix; a zero value is65omitted, while a repeated nonzero value retains both copies. -/66theorem diagonal_pair_spectrum (a b : ℝ) :67 nonzeroSpectrum (diagonal ![(a:ℂ),(b:ℂ)]) =68 (({(a:ℂ),(b:ℂ)} : Multiset ℂ).filter (· ≠ 0)) := by69 unfold nonzeroSpectrum70 rw [Matrix.charpoly_diagonal,Fin.prod_univ_two]71 simp [Polynomial.roots_mul,Polynomial.X_sub_C_ne_zero]7273end SubentropyCertificates.BinarySpectra
Axioms used
Choose a statement to see which axioms its proof uses.