chars
int64
40
24k
content_type
stringclasses
9 values
id
stringlengths
13
64
source
stringclasses
5 values
subset
stringclasses
31 values
text
stringlengths
40
24k
391
leanexplore_declaration
leanexplore:379513
leanexplore_sqlite
leanexplore_declarations
theorem zero_rank_eq_zero {A : Matrix n n 𝕜} [Fintype n] (hA : A.rank = 0) : A = 0 := by have h : ∀ v, A.mulVecLin v = 0 := by intro v rw [rank, Module.finrank_zero_iff] at hA have := hA.elim ⟨A.mulVecLin v, ⟨v, rfl⟩⟩ ⟨0, ⟨0, by rw [mulVecLin_apply, mulVec_zero]⟩⟩ simpa only [Subtype.mk.injEq] using ...
123
leanexplore_declaration
leanexplore:379514
leanexplore_sqlite
leanexplore_declarations
theorem smul_selfAdjoint {c : 𝕜} (hc : _root_.IsSelfAdjoint c) : (c • A).IsHermitian := by exact IsSelfAdjoint.smul hc hA
127
leanexplore_declaration
leanexplore:379515
leanexplore_sqlite
leanexplore_declarations
theorem smul_im_zero {c : 𝕜} (h : RCLike.im c = 0) : (c • A).IsHermitian := hA.smul_selfAdjoint (RCLike.conj_eq_iff_im.mpr h)
181
leanexplore_declaration
leanexplore:379516
leanexplore_sqlite
leanexplore_declarations
theorem smul_real (c : ℝ) : (c • A).IsHermitian := by convert hA.smul_im_zero (RCLike.ofReal_im c) using 1 ext simp only [smul_apply, smul_eq_mul, RCLike.real_smul_eq_coe_mul]
383
leanexplore_declaration
leanexplore:379517
leanexplore_sqlite
leanexplore_declarations
def HermitianSubspace (n 𝕜 : Type*) [Fintype n] [RCLike 𝕜] : Subspace ℝ (Matrix n n 𝕜) where carrier := { A : Matrix n n 𝕜 | A.IsHermitian } add_mem' _ _ := by simp_all only [Set.mem_setOf_eq, IsHermitian.add] zero_mem' := by simp only [Set.mem_setOf_eq, isHermitian_zero] smul_mem' c A := by simp only [...
140
leanexplore_declaration
leanexplore:379518
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem re_trace_eq_trace : RCLike.re (A.trace) = A.trace := by rw [trace, map_sum, RCLike.ofReal_sum, IsHermitian.coe_re_diag hA]
291
leanexplore_declaration
leanexplore:379519
leanexplore_sqlite
leanexplore_declarations
/-- The sum of the eigenvalues of a Hermitian matrix is equal to its trace. -/ theorem sum_eigenvalues_eq_trace : ∑ i, hA.eigenvalues i = A.trace := by nth_rewrite 2 [hA.spectral_theorem] simp only [Unitary.conjStarAlgAut_apply] rw [trace_mul_comm, ← mul_assoc] simp [trace_diagonal]
293
leanexplore_declaration
leanexplore:379520
leanexplore_sqlite
leanexplore_declarations
/-- If all eigenvalues are equal to zero, then the matrix is zero. -/ theorem eigenvalues_zero_eq_zero (h : ∀ i, hA.eigenvalues i = 0) : A = 0 := by suffices A.rank = 0 from zero_rank_eq_zero this simp only [hA.rank_eq_card_non_zero_eigs, h, ne_eq, not_true_eq_false, Fintype.card_eq_zero]
77
leanexplore_declaration
leanexplore:379521
leanexplore_sqlite
leanexplore_declarations
theorem kroneckerMap_conjTranspose : (A ⊗ₖ B)ᴴ = (Aᴴ ⊗ₖ Bᴴ) := by ext; simp
120
leanexplore_declaration
leanexplore:379522
leanexplore_sqlite
leanexplore_declarations
theorem kroneckerMap_IsHermitian : (A ⊗ₖ B).IsHermitian := by exact (hA ▸ hB ▸ kroneckerMap_conjTranspose A B : _ = _)
333
leanexplore_declaration
leanexplore:379523
leanexplore_sqlite
leanexplore_declarations
theorem trace_zero : A.trace = 0 → A = 0 := by open Classical in intro h rw [← hA.isHermitian.sum_eigenvalues_eq_trace, RCLike.ofReal_eq_zero] at h rw [Finset.sum_eq_zero_iff_of_nonneg (fun i _ ↦ hA.eigenvalues_nonneg i)] at h simp only [Finset.mem_univ, forall_const] at h exact hA.isHermitian.eigenvalues_z...
88
leanexplore_declaration
leanexplore:379524
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem trace_zero_iff : A.trace = 0 ↔ A = 0 := ⟨trace_zero hA, (by simp [·])⟩
145
leanexplore_declaration
leanexplore:379525
leanexplore_sqlite
leanexplore_declarations
theorem _root_.RCLike.normSq_eq_conj_mul_self {z : 𝕜} : RCLike.normSq z = conj z * z := by rw [RCLike.ext_iff] simp [RCLike.normSq] ring_nf
355
leanexplore_declaration
leanexplore:379526
leanexplore_sqlite
leanexplore_declarations
theorem Finsupp.sum_eq_ite {α : Type u_1} {M : Type u_8} {N : Type u_10} [Zero M] [AddCommMonoid N] [Fintype α] [DecidableEq M] (f : α →₀ M) (g : α → M → N) : f.sum g = ∑ i, if f i ≠ 0 then g i (f i) else 0 := by rw [Finsupp.sum, eq_comm] classical convert Finset.sum_ite_mem Finset.univ f.support (f...
781
leanexplore_declaration
leanexplore:379527
leanexplore_sqlite
leanexplore_declarations
theorem outer_self_conj (v : n → 𝕜) : PosSemidef (vecMulVec v (conj v)) := by constructor · ext simp [vecMulVec_apply, mul_comm] · intro x rw [Finsupp.sum_fintype _ _ (by simp)] conv => enter [2, 2, i] rw [Finsupp.sum_fintype _ _ (by simp)] simp_rw [RCLike.star_def, vecMulVec_ap...
129
leanexplore_declaration
leanexplore:379528
leanexplore_sqlite
leanexplore_declarations
theorem convex_cone {c₁ c₂ : 𝕜} (hc₁ : 0 ≤ c₁) (hc₂ : 0 ≤ c₂) : (c₁ • A + c₂ • B).PosSemidef := (hA.smul hc₁).add (hB.smul hc₂)
2,042
leanexplore_declaration
leanexplore:379529
leanexplore_sqlite
leanexplore_declarations
/-- A standard basis matrix (with a positive entry) is positive semidefinite iff the entry is on the diagonal. -/ theorem stdBasisMatrix_iff_eq (i j : m) {c : 𝕜} (hc : 0 < c) : (single i j c).PosSemidef ↔ i = j := by constructor · intro ⟨hherm, _⟩ rw [IsHermitian, ← ext_iff] at hherm replace hherm := hherm...
535
leanexplore_declaration
leanexplore:379530
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef_kronecker : (A ⊗ₖ B).PosSemidef := by open Classical in rw [hA.left.spectral_theorem, hB.left.spectral_theorem] simp only [Unitary.conjStarAlgAut_apply] rw [mul_kronecker_mul, mul_kronecker_mul] rw [star_eq_conjTranspose, star_eq_conjTranspose] rw [← kroneckerMap_conjTranspose] rw [diag...
345
leanexplore_declaration
leanexplore:379531
leanexplore_sqlite
leanexplore_declarations
theorem zero_dotProduct_zero_iff : (∀ x : m → 𝕜, 0 = star x ⬝ᵥ A.mulVec x) ↔ A = 0 := by constructor · intro h ext i j have h₂ := fun x ↦ (PosSemidef.dotProduct_mulVec_zero_iff hA x).mp (h x).symm classical have : DecidableEq m := inferInstance convert congrFun (h₂ (Pi.single j 1)) i using 1 si...
246
leanexplore_declaration
leanexplore:379532
leanexplore_sqlite
leanexplore_declarations
theorem pos_smul {c : 𝕜} (hA : (c • A).PosSemidef) (hc : 0 < c) : A.PosSemidef := by have : 0 < 1/c := by rw [RCLike.pos_iff] at hc ⊢ aesop convert hA.smul (a := 1/c) this.le rw [smul_smul, one_div, inv_mul_cancel₀ hc.ne', one_smul]
550
leanexplore_declaration
leanexplore:379533
leanexplore_sqlite
leanexplore_declarations
theorem zero_posSemidef_neg_posSemidef_iff : A.PosSemidef ∧ (-A).PosSemidef ↔ A = 0 := by constructor · intro ⟨hA, hNegA⟩ have h0 : ∀ x : m → 𝕜, 0 = star x ⬝ᵥ A.mulVec x := fun x ↦ by simp only [Matrix.posSemidef_iff_dotProduct_mulVec] at hA hNegA have hNegA' := hNegA.right (Finsupp.ofSupportFinite...
245
leanexplore_declaration
leanexplore:379534
leanexplore_sqlite
leanexplore_declarations
theorem toLin_ker_eq_bot (hA : A.PosDef) : LinearMap.ker A.toLin' = ⊥ := by ext v rw [Matrix.posDef_iff_dotProduct_mulVec] at hA have := @hA.right v grind [mulVec_zero, dotProduct_zero, LinearMap.mem_ker, toLin'_apply, Submodule.mem_bot]
190
leanexplore_declaration
leanexplore:379535
leanexplore_sqlite
leanexplore_declarations
theorem of_toLin_ker_eq_bot (hA : LinearMap.ker A.toLin' = ⊥) (hA₂ : A.PosSemidef) : A.PosDef := by rwa [hA₂.posDef_iff_isUnit, ← Matrix.isUnit_toLin'_iff, LinearMap.isUnit_iff_ker_eq_bot]
479
leanexplore_declaration
leanexplore:379536
leanexplore_sqlite
leanexplore_declarations
theorem ker_range_antitone {d : Type*} [Fintype d] [DecidableEq d] {A B : Matrix d d ℂ} (hA : A.IsHermitian) (hB : B.IsHermitian) : LinearMap.ker A.toEuclideanLin ≤ LinearMap.ker B.toEuclideanLin ↔ LinearMap.range B.toEuclideanLin ≤ LinearMap.range A.toEuclideanLin := by rw [Matrix.isHermitian_iff_isSy...
274
leanexplore_declaration
leanexplore:379537
leanexplore_sqlite
leanexplore_declarations
theorem le_of_nonneg_imp {R : Type*} [AddCommGroup R] [PartialOrder R] [IsOrderedAddMonoid R] (f : Matrix n n 𝕜 →+ R) (h : ∀ A, A.PosSemidef → 0 ≤ f A) : (A ≤ B → f A ≤ f B) := by intro hAB rw [←sub_nonneg, ←map_sub] exact h (B - A) <| by rwa [← Matrix.le_iff]
322
leanexplore_declaration
leanexplore:379538
leanexplore_sqlite
leanexplore_declarations
theorem le_of_nonneg_imp' {R : Type*} [AddCommGroup R] [PartialOrder R] [IsOrderedAddMonoid R] {x y : R} (f : R →+ Matrix n n 𝕜) (h : ∀ x, 0 ≤ x → (f x).PosSemidef) : (x ≤ y → f x ≤ f y) := by intro hxy rw [← sub_nonneg, ← map_sub, Matrix.nonneg_iff_posSemidef] rw [← sub_nonneg] at hxy exact h (y - x) ...
478
leanexplore_declaration
leanexplore:379539
leanexplore_sqlite
leanexplore_declarations
theorem mul_mul_conjTranspose_mono (C : Matrix m n 𝕜) : A ≤ B → C * A * C.conjTranspose ≤ C * B * C.conjTranspose := fun hAB ↦ by rw [Matrix.le_iff] at hAB ⊢ have hDistrib : C * B * Cᴴ - C * A * Cᴴ = C * (B - A) * Cᴴ := by ext i j simp only [sub_apply, mul_apply, conjTranspose_apply, RCLike.star_...
218
leanexplore_declaration
leanexplore:379540
leanexplore_sqlite
leanexplore_declarations
theorem conjTranspose_mul_mul_mono (C : Matrix n m 𝕜) : A ≤ B → C.conjTranspose * A * C ≤ C.conjTranspose * B * C := fun hAB ↦ by convert mul_mul_conjTranspose_mono Cᴴ hAB <;> rw [conjTranspose_conjTranspose]
169
leanexplore_declaration
leanexplore:379541
leanexplore_sqlite
leanexplore_declarations
theorem nonneg_iff_eigenvalue_nonneg [DecidableEq n] : 0 ≤ A ↔ ∀ x, 0 ≤ hA.eigenvalues x := Iff.trans Matrix.nonneg_iff_posSemidef hA.posSemidef_iff_eigenvalues_nonneg
141
leanexplore_declaration
leanexplore:379542
leanexplore_sqlite
leanexplore_declarations
theorem diag_monotone : Monotone (diag : Matrix n n 𝕜 → (n → 𝕜)) := fun _ _ ↦ le_of_nonneg_imp (diagAddMonoidHom n 𝕜) (fun _ ↦ diag_nonneg)
73
leanexplore_declaration
leanexplore:379543
leanexplore_sqlite
leanexplore_declarations
theorem diag_mono : A ≤ B → ∀ i, A.diag i ≤ B.diag i := diag_monotone.imp
129
leanexplore_declaration
leanexplore:379544
leanexplore_sqlite
leanexplore_declarations
theorem trace_monotone : Monotone (@trace n 𝕜 _ _) := fun _ _ ↦ le_of_nonneg_imp (traceAddMonoidHom n 𝕜) (fun _ ↦ trace_nonneg)
68
leanexplore_declaration
leanexplore:379545
leanexplore_sqlite
leanexplore_declarations
theorem trace_mono : A ≤ B → A.trace ≤ B.trace := trace_monotone.imp
151
leanexplore_declaration
leanexplore:379546
leanexplore_sqlite
leanexplore_declarations
theorem diagonal_monotone : Monotone (diagonal : (n → 𝕜) → _) := fun _ _ ↦ le_of_nonneg_imp' (diagonalAddMonoidHom n 𝕜) (fun _ ↦ PosSemidef.diagonal)
100
leanexplore_declaration
leanexplore:379547
leanexplore_sqlite
leanexplore_declarations
theorem diagonal_mono {d₁ d₂ : n → 𝕜} : d₁ ≤ d₂ → diagonal d₁ ≤ diagonal d₂ := diagonal_monotone.imp
219
leanexplore_declaration
leanexplore:379548
leanexplore_sqlite
leanexplore_declarations
theorem diagonal_le_iff {d₁ d₂ : n → 𝕜} : d₁ ≤ d₂ ↔ diagonal d₁ ≤ diagonal d₂ := ⟨diagonal_mono, by intro hd rw [Matrix.le_iff, diagonal_sub, posSemidef_diagonal_iff] at hd simp only [sub_nonneg] at hd exact hd⟩
1,733
leanexplore_declaration
leanexplore:379549
leanexplore_sqlite
leanexplore_declarations
theorem le_smul_one_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : (∀ i, hA.eigenvalues i ≤ c) ↔ A ≤ c • (1 : Matrix n n 𝕜) := by let U : Matrix n n 𝕜 := ↑hA.eigenvectorUnitary have hU : U.conjTranspose = star U := by simp only [star] have hU' : U * star U = 1 := by simp only [SetLike.coe_mem, Unitary....
1,794
leanexplore_declaration
leanexplore:379550
leanexplore_sqlite
leanexplore_declarations
theorem smul_one_le_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : (∀ i, c ≤ hA.eigenvalues i) ↔ c • (1 : Matrix n n 𝕜) ≤ A := by -- I did the lazy thing and just copied the previous proof let U : Matrix n n 𝕜 := ↑hA.eigenvectorUnitary have hU : U.conjTranspose = star U := by simp only [star] have hU' : ...
116
leanexplore_declaration
leanexplore:379551
leanexplore_sqlite
leanexplore_declarations
def traceLeft (m : Matrix (d × d₁) (d × d₂) R) : Matrix d₁ d₂ R := Matrix.of fun i₁ j₁ ↦ ∑ i₂, m (i₂, i₁) (i₂, j₁)
117
leanexplore_declaration
leanexplore:379552
leanexplore_sqlite
leanexplore_declarations
def traceRight (m : Matrix (d₁ × d) (d₂ × d) R) : Matrix d₁ d₂ R := Matrix.of fun i₂ j₂ ↦ ∑ i₁, m (i₂, i₁) (j₂, i₁)
155
leanexplore_declaration
leanexplore:379553
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceLeft_trace (A : Matrix (d₁ × d₂) (d₁ × d₂) R) : A.traceLeft.trace = A.trace := by convert (Fintype.sum_prod_type_right _).symm rfl
151
leanexplore_declaration
leanexplore:379554
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceRight_trace (A : Matrix (d₁ × d₂) (d₁ × d₂) R) : A.traceRight.trace = A.trace := by convert (Fintype.sum_prod_type _).symm rfl
227
leanexplore_declaration
leanexplore:379555
leanexplore_sqlite
leanexplore_declarations
theorem IsHermitian.traceLeft {A : Matrix (d × d₁) (d × d₁) R} (hA : A.IsHermitian) : A.traceLeft.IsHermitian := by ext simp only [Matrix.traceLeft, conjTranspose_apply, of_apply, star_sum] congr! exact congrFun₂ hA _ _
230
leanexplore_declaration
leanexplore:379556
leanexplore_sqlite
leanexplore_declarations
theorem IsHermitian.traceRight {A : Matrix (d₁ × d) (d₁ × d) R} (hA : A.IsHermitian) : A.traceRight.IsHermitian := by ext simp only [Matrix.traceRight, conjTranspose_apply, of_apply, star_sum] congr! exact congrFun₂ hA _ _
399
leanexplore_declaration
leanexplore:379557
leanexplore_sqlite
leanexplore_declarations
/-- `Tr(M (A ⊗ I)) = Tr(Tr_B(M) A)` -/ theorem trace_mul_kron_one_right {R : Type*} [Ring R] (M : Matrix (dA × dB) (dA × dB) R) (A : Matrix dA dA R) : (M * (A ⊗ₖ (1 : Matrix dB dB R))).trace = (M.traceRight * A).trace := by simp [trace, mul_apply, kroneckerMap_apply, traceRight, one_apply, Fintype.sum_pro...
420
leanexplore_declaration
leanexplore:379558
leanexplore_sqlite
leanexplore_declarations
/-- `Tr(M (I ⊗ B)) = Tr(Tr_A(M) B)` -/ theorem trace_mul_one_kron_right {R : Type*} [Ring R] (M : Matrix (dA × dB) (dA × dB) R) (B : Matrix dB dB R) : (M * ((1 : Matrix dA dA R) ⊗ₖ B)).trace = (M.traceLeft * B).trace := by simp [trace, mul_apply, kroneckerMap_apply, traceLeft, one_apply, Fintype.sum_prod_...
506
leanexplore_declaration
leanexplore:379559
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.traceLeft [DecidableEq d₁] (hA : A.PosSemidef) : A.traceLeft.PosSemidef := by rw [Matrix.posSemidef_iff_dotProduct_mulVec] at hA ⊢ constructor · exact hA.1.traceLeft · intro x convert Finset.sum_nonneg' (s := .univ) (fun (i : d₁) ↦ hA.2 (fun (j,k) ↦ if i = j then x k else 0)) simp_rw ...
510
leanexplore_declaration
leanexplore:379560
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.traceRight [DecidableEq d₂] (hA : A.PosSemidef) : A.traceRight.PosSemidef := by rw [Matrix.posSemidef_iff_dotProduct_mulVec] at hA ⊢ constructor · exact hA.1.traceRight · intro x convert Finset.sum_nonneg' (s := .univ) (fun (i : d₂) ↦ hA.2 (fun (j,k) ↦ if i = k then x j else 0)) simp_...
859
leanexplore_declaration
leanexplore:379561
leanexplore_sqlite
leanexplore_declarations
theorem PosDef.kron {d₁ d₂ 𝕜 : Type*} [Fintype d₁] [DecidableEq d₁] [Fintype d₂] [DecidableEq d₂] [RCLike 𝕜] {A : Matrix d₁ d₁ 𝕜} {B : Matrix d₂ d₂ 𝕜} (hA : A.PosDef) (hB : B.PosDef) : (A ⊗ₖ B).PosDef := by rw [hA.left.spectral_theorem, hB.left.spectral_theorem] simp only [Unitary.conjStarAlgAut_apply] rw...
226
leanexplore_declaration
leanexplore:379562
leanexplore_sqlite
leanexplore_declarations
theorem PosDef.reindex {d₁ d₂ 𝕜 : Type*} [Fintype d₁] [DecidableEq d₁] [Fintype d₂] [DecidableEq d₂] [RCLike 𝕜] {M : Matrix d₁ d₁ 𝕜} (hM : M.PosDef) (e : d₁ ≃ d₂) : (M.reindex e e).PosDef := hM.submatrix e.symm.injective
281
leanexplore_declaration
leanexplore:379563
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem PosDef.reindex_iff {d₁ d₂ 𝕜 : Type*} [Fintype d₁] [DecidableEq d₁] [Fintype d₂] [DecidableEq d₂] [RCLike 𝕜] {M : Matrix d₁ d₁ 𝕜} (e : d₁ ≃ d₂) : (M.reindex e e).PosDef ↔ M.PosDef := by refine ⟨fun h ↦ ?_, fun h ↦ h.reindex e⟩ convert h.reindex e.symm simp
302
leanexplore_declaration
leanexplore:379564
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.rsmul {n : Type*} [Fintype n] {M : Matrix n n ℂ} (hM : M.PosSemidef) {c : ℝ} (hc : 0 ≤ c) : (c • M).PosSemidef := by rw [Matrix.posSemidef_iff_dotProduct_mulVec] at hM ⊢ constructor · exact hM.1.smul_real c · peel hM.2 rw [smul_mulVec, dotProduct_smul] positivity
355
leanexplore_declaration
leanexplore:379565
leanexplore_sqlite
leanexplore_declarations
theorem PosDef.Convex {n 𝕜 : Type*} [Fintype n] [RCLike 𝕜] : Convex ℝ (Matrix.PosDef (n := n) (R := 𝕜)) := by intro A hA B hB a b ha hb hab rcases ha.lt_or_eq with ha | rfl · apply (hA.smul ha).add_posSemidef exact hB.posSemidef.smul hb · apply Matrix.PosDef.posSemidef_add · simp [Matrix.PosSemidef.z...
232
leanexplore_declaration
leanexplore:379566
leanexplore_sqlite
leanexplore_declarations
theorem PosDef_iff_eigenvalues' (M : Matrix d d 𝕜) : M.PosDef ↔ ∃ (h : M.IsHermitian), ∀ i, 0 < h.eigenvalues i := ⟨fun h ↦ ⟨h.left, h.left.posDef_iff_eigenvalues_pos.mp h⟩, fun ⟨w, h⟩ ↦ w.posDef_iff_eigenvalues_pos.mpr h⟩
3,179
leanexplore_declaration
leanexplore:379567
leanexplore_sqlite
leanexplore_declarations
theorem IsHermitian.cfc_eigenvalues {M : Matrix d d 𝕜} (hM : M.IsHermitian) (f : ℝ → ℝ) : ∃ (e : d ≃ d), Matrix.IsHermitian.eigenvalues (cfc_predicate f M) = f ∘ hM.eigenvalues ∘ e := by have h_eigenvalues : Multiset.map hM.eigenvalues Finset.univ.val = Multiset.map (fun i => hM.eigenvalues i) Finset.univ.val :=...
3,086
leanexplore_declaration
leanexplore:379568
leanexplore_sqlite
leanexplore_declarations
/-- If a Hermitian matrix A is unitarily similar to a diagonal matrix with real entries f, then the eigenvalues of A are a permutation of f. -/ lemma IsHermitian.eigenvalues_eq_of_unitary_similarity_diagonal {d 𝕜 : Type*} [Fintype d] [DecidableEq d] [RCLike 𝕜] {A : Matrix d d 𝕜} (hA : A.IsHermitian) {U :...
129
leanexplore_declaration
leanexplore:379569
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem toEuclideanLin_one : Matrix.toEuclideanLin (1 : Matrix n n α) = .id := by ext1 x simp [Matrix.toEuclideanLin]
1,032
leanexplore_declaration
leanexplore:379570
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem cfc_diagonal (g : d → ℝ) (f : ℝ → ℝ) : cfc f (Matrix.diagonal (fun x ↦ (g x : 𝕜))) = diagonal (RCLike.ofReal ∘ f ∘ g) := by --Thanks Aristotle have h_self_adjoint : _root_.IsSelfAdjoint (diagonal (fun x => (g x : 𝕜))) := by change Matrix.conjTranspose _ = _ simp [Matrix.conjTranspo...
247
leanexplore_declaration
leanexplore:379571
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.pos_of_mem_spectrum {A : Matrix d d 𝕜} (hA : A.PosSemidef) (r : ℝ) : r ∈ spectrum ℝ A → 0 ≤ r := by intro hr rw [hA.left.spectrum_real_eq_range_eigenvalues] at hr rcases hr with ⟨i, rfl⟩ exact hA.eigenvalues_nonneg i
263
leanexplore_declaration
leanexplore:379572
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.pow_add {A : Matrix d d 𝕜} (hA : A.PosSemidef) {x y : ℝ} (hxy : x + y ≠ 0) : cfc (· ^ (x + y) : ℝ → ℝ) A = cfc (fun r ↦ r ^ x * r ^ y : ℝ → ℝ) A := by refine cfc_congr fun r hr ↦ ?_ exact Real.rpow_add' (hA.pos_of_mem_spectrum r hr) hxy
242
leanexplore_declaration
leanexplore:379573
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.pow_mul {A : Matrix d d 𝕜} {x y : ℝ} (hA : A.PosSemidef) : cfc (· ^ (x * y) : ℝ → ℝ) A = cfc (fun r ↦ (r ^ x) ^ y : ℝ → ℝ) A := by refine cfc_congr fun r hr ↦ ?_ exact Real.rpow_mul (hA.pos_of_mem_spectrum r hr) x y
170
leanexplore_declaration
leanexplore:379574
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem trace_submatrix (A : Matrix d₁ d₁ α) (e : d₂ ≃ d₁) : (A.submatrix e e).trace = A.trace := by simpa [Matrix.trace] using e.sum_comp (fun x ↦ A x x)
3,515
leanexplore_declaration
leanexplore:379575
leanexplore_sqlite
leanexplore_declarations
theorem spectrum_prod {d d₂ : Type*} [Fintype d] [DecidableEq d] [Fintype d₂] [DecidableEq d₂] {A : Matrix d d 𝕜} {B : Matrix d₂ d₂ 𝕜} (hA : A.IsHermitian) (hB : B.IsHermitian) : spectrum ℝ (A ⊗ₖ B) = spectrum ℝ A * spectrum ℝ B := by apply subset_antisymm · exact spectrum_prod_le hA hB · rintro x ⟨ y...
478
leanexplore_declaration
leanexplore:379576
leanexplore_sqlite
leanexplore_declarations
theorem PosDef.zero_lt {n : Type*} [Nonempty n] [Fintype n] {A : Matrix n n ℂ} (hA : A.PosDef) : 0 < A := by apply lt_of_le_of_ne · replace hA := hA.posSemidef rwa [Matrix.nonneg_iff_posSemidef] · rintro rfl --wtf do better. TODO have : ¬(0 < 0) := by trivial classical rw [← Matrix.posDef_natCast_...
211
leanexplore_declaration
leanexplore:379577
leanexplore_sqlite
leanexplore_declarations
lemma IsHermitian.spectrum_eq_image_eigenvalues [Fintype n] {A : Matrix n n ℂ} (hA : A.IsHermitian) : spectrum ℝ A = Finset.univ.image hA.eigenvalues := by simpa using hA.spectrum_real_eq_range_eigenvalues
396
leanexplore_declaration
leanexplore:379578
leanexplore_sqlite
leanexplore_declarations
lemma IsHermitian.card_spectrum_eq_image [Fintype n] {A : Matrix n n ℂ} (hA : A.IsHermitian) [Fintype (spectrum ℝ A)] : Fintype.card (spectrum ℝ A) = (Finset.univ.image hA.eigenvalues).card := by trans (Set.univ.image hA.eigenvalues).toFinset.card · symm convert Set.toFinset_card _ rw [Set.image_univ]...
3,825
leanexplore_declaration
leanexplore:379579
leanexplore_sqlite
leanexplore_declarations
lemma sub_iInf_eignevalues (hA : A.IsHermitian) : (A - iInf hA.eigenvalues • 1).PosSemidef := by rw [Matrix.posSemidef_iff_dotProduct_mulVec] constructor · simpa [ Matrix.IsHermitian, sub_eq_add_neg ] using hA · intro x have h_eigenvalue : ∀ i, hA.eigenvalues i ≥ iInf hA.eigenvalues := by -- By de...
536
leanexplore_declaration
leanexplore:379580
leanexplore_sqlite
leanexplore_declarations
lemma iInf_eigenvalues_le_dotProduct_mulVec (hA : A.IsHermitian) (v : d → ℂ) : iInf hA.eigenvalues * (star v ⬝ᵥ v) ≤ star v ⬝ᵥ A *ᵥ v := by conv_lhs => equals (star v ⬝ᵥ (iInf hA.eigenvalues • 1) *ᵥ v) => simp only [dotProduct, Pi.star_apply, RCLike.star_def, mul_comm, mulVec] simp [Matrix.one_app...
864
leanexplore_declaration
leanexplore:379581
leanexplore_sqlite
leanexplore_declarations
lemma iInf_eigenvalues_le_of_posSemidef (hAB : (B - A).PosSemidef) (hA : A.IsHermitian) (hB : B.IsHermitian) : iInf hA.eigenvalues ≤ iInf hB.eigenvalues := by rcases isEmpty_or_nonempty d · simp contrapose! hAB rw [posSemidef_iff_dotProduct_mulVec] simp only [not_and, not_forall] intro _ apply exist...
178
leanexplore_declaration
leanexplore:379582
leanexplore_sqlite
leanexplore_declarations
lemma iInf_eigenvalues_le (hAB : A ≤ B) (hA : A.IsHermitian) (hB : B.IsHermitian) : iInf hA.eigenvalues ≤ iInf hB.eigenvalues := iInf_eigenvalues_le_of_posSemidef hAB hA hB
203
leanexplore_declaration
leanexplore:379583
leanexplore_sqlite
leanexplore_declarations
lemma iInf_eigenvalues_smul_one_le (hA : A.IsHermitian) : iInf hA.eigenvalues • 1 ≤ A := (PosSemidef.smul_one_le_of_eigenvalues_iff hA (iInf hA.eigenvalues)).mp (ciInf_le (Finite.bddBelow_range _))
9,229
leanexplore_declaration
leanexplore:379584
leanexplore_sqlite
leanexplore_declarations
theorem IsHermitian.spectrum_subset_Ici_of_sub {d 𝕜 : Type*} [Fintype d] [DecidableEq d] [RCLike 𝕜] {A x : Matrix d d 𝕜} (hA : A.IsHermitian) (hl : (x - A).PosSemidef) : spectrum ℝ x ⊆ Set.Ici (⨅ i, hA.eigenvalues i) := by --Thanks Aristotle intro μ hμ obtain ⟨v, hv₁, hv₂⟩ : ∃ v : d → 𝕜, v ≠ 0 ∧ x.mulVe...
749
leanexplore_declaration
leanexplore:379585
leanexplore_sqlite
leanexplore_declarations
theorem IsHermitian.spectrum_subset_Iic_of_sub {d 𝕜 : Type*} [Fintype d] [DecidableEq d] [RCLike 𝕜] {A x : Matrix d d 𝕜} (hA : A.IsHermitian) (hl : (A - x).PosSemidef) : spectrum ℝ x ⊆ Set.Iic (⨆ i, hA.eigenvalues i) := by have h := spectrum_subset_Ici_of_sub hA.neg (x := -x) ?_ · rcases isEmpty_or_nonempt...
425
leanexplore_declaration
leanexplore:379586
leanexplore_sqlite
leanexplore_declarations
theorem IsHermitian.spectrum_subset_of_mem_Icc {d 𝕜 : Type*} [Fintype d] [DecidableEq d] [RCLike 𝕜] {A B x : Matrix d d 𝕜} (hA : A.IsHermitian) (hB : B.IsHermitian) (hl : (x - A).PosSemidef) (hr : (B - x).PosSemidef) : spectrum ℝ x ⊆ Set.Icc (⨅ i, hA.eigenvalues i) (⨆ i, hB.eigenvalues i) := by rw [← Set.I...
337
leanexplore_declaration
leanexplore:379587
leanexplore_sqlite
leanexplore_declarations
/-- The right partial trace of a matrix is equal to the left partial trace of the matrix reindexed by swapping the tensor factors. -/ theorem traceRight_eq_traceLeft_reindex {n m R : Type*} [Fintype m] [AddCommMonoid R] (M : Matrix (n × m) (n × m) R) : M.traceRight = (M.reindex (.prodComm ..) (.prodComm ..)).trac...
395
leanexplore_declaration
leanexplore:379588
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.trace_pos {n 𝕜 : Type*} [Fintype n] [RCLike 𝕜] {A : Matrix n n 𝕜} (hA : A.PosSemidef) (h : A ≠ 0) : 0 < A.trace := by apply hA.trace_nonneg.lt_of_ne' classical rw [hA.left.trace_eq_sum_eigenvalues] suffices ∑ i, hA.left.eigenvalues i ≠ 0 from mod_cast this rwa [ne_eq, Fintype.sum_eq_...
143
leanexplore_declaration
leanexplore:379589
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceLeft_add : (A + B).traceLeft = A.traceLeft + B.traceLeft := by ext : 2 simp [Matrix.traceLeft, Finset.sum_add_distrib]
102
leanexplore_declaration
leanexplore:379590
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceLeft_neg : (-A).traceLeft = -A.traceLeft := by ext : 2; simp [Matrix.traceLeft]
107
leanexplore_declaration
leanexplore:379591
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceLeft_sub : (A - B).traceLeft = A.traceLeft - B.traceLeft := by simp [sub_eq_add_neg]
148
leanexplore_declaration
leanexplore:379592
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceRight_add : (A + B).traceRight = A.traceRight + B.traceRight := by ext : 2 simp [Matrix.traceRight, Finset.sum_add_distrib]
106
leanexplore_declaration
leanexplore:379593
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceRight_neg : (-A).traceRight = -A.traceRight := by ext : 2; simp [Matrix.traceRight]
111
leanexplore_declaration
leanexplore:379594
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceRight_sub : (A - B).traceRight = A.traceRight - B.traceRight := by simp [sub_eq_add_neg]
171
leanexplore_declaration
leanexplore:379595
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceLeft_smul {A : Matrix (m × n) (m × n) α} (r : R) : (r • A).traceLeft = r • A.traceLeft := by ext : 2; simp [Matrix.traceLeft, ← Finset.smul_sum]
175
leanexplore_declaration
leanexplore:379596
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceRight_smul {A : Matrix (n × m) (n × m) α} (r : R) : (r • A).traceRight = r • A.traceRight := by ext : 2; simp [Matrix.traceRight, ← Finset.smul_sum]
282
leanexplore_declaration
leanexplore:379597
leanexplore_sqlite
leanexplore_declarations
theorem unitaryGroup_row_norm [Fintype n] (U : Matrix.unitaryGroup n ℂ) (i : n) : ∑ j, ‖U j i‖^2 = 1 := by suffices ∑ j, ‖U j i‖^2 = (1 : ℂ) by exact_mod_cast this simpa [Matrix.mul_apply, Complex.sq_norm, Complex.normSq_eq_conj_mul_self] using congr($(U.prop.left) i i)
151
leanexplore_declaration
leanexplore:379598
leanexplore_sqlite
leanexplore_declarations
def piProd [CommMonoid R] (A : ∀ i, Matrix (d i) (d i) R) : Matrix (∀ i, d i) (∀ i, d i) R := Matrix.of (fun j k : (∀ i, d i) ↦ ∏ i, A i (j i) (k i))
261
leanexplore_declaration
leanexplore:379599
leanexplore_sqlite
leanexplore_declarations
theorem IsHermitian.piProd [CommSemiring R] [StarRing R] (hA : ∀ i, (A i).IsHermitian) : (piProd A).IsHermitian := by ext j k simp [Matrix.piProd] exact Finset.prod_congr rfl fun i _ => by simpa using congr_fun ( congr_fun ( hA i ) ( j i ) ) ( k i ) ;
133
leanexplore_declaration
leanexplore:379600
leanexplore_sqlite
leanexplore_declarations
theorem trace_piProd [CommSemiring R] : (piProd A).trace = ∏ i, (A i).trace := by symm simp [trace, piProd, Fintype.prod_sum]
2,394
leanexplore_declaration
leanexplore:379601
leanexplore_sqlite
leanexplore_declarations
theorem PosSemidef.piProd [RCLike R] (hA : ∀ i, (A i).PosSemidef) : (piProd A).PosSemidef := by -- Let B i be the square root of A i. Let BigB be the pi-product of B i. Show that BigB.conjTranspose * BigB equals the pi-product of A i using Fintype.prod_sum. Then use Matrix.PosSemidef.conjTranspose_mul_self to con...
340
leanexplore_declaration
leanexplore:379602
leanexplore_sqlite
leanexplore_declarations
theorem submatrix_eq_mul_mul {d d₂ d₃ R : Type*} [DecidableEq d] [Fintype d] [Semiring R] (A : Matrix d d R) (e : d₂ → d) (f : d₃ → d) : A.submatrix e f = (submatrix (α := R) 1 e id : Matrix d₂ d R) * A * (submatrix (α := R) 1 id f) := by rw [show id = Equiv.refl d by rfl, Matrix.mul_submatrix_one, Matrix.one_s...
697
leanexplore_declaration
leanexplore:379603
leanexplore_sqlite
leanexplore_declarations
/-- The conjugate of a Kronecker product by a Kronecker product is the Kronecker product of the conjugates (for matrices). -/ lemma kronecker_conj_eq {m n p q α : Type*} [CommSemiring α] [StarRing α] [Fintype m] [Fintype n] (A : Matrix m m α) (B : Matrix n n α) (C : Matrix p m α) (D : Matrix q n α) : (C ⊗ₖ D) *...
147
leanexplore_declaration
leanexplore:379604
leanexplore_sqlite
leanexplore_declarations
/-- The trace norm of a matrix: Tr[√(A† A)]. -/ def traceNorm (A : Matrix m n R) : ℝ := open MatrixOrder in RCLike.re (CFC.sqrt (Aᴴ * A)).trace
90
leanexplore_declaration
leanexplore:379605
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceNorm_zero : traceNorm (0 : Matrix m n R) = 0 := by simp [traceNorm]
271
leanexplore_declaration
leanexplore:379606
leanexplore_sqlite
leanexplore_declarations
/-- The trace norm of the negative is equal to the trace norm. -/ @[simp] theorem traceNorm_eq_neg_self (A : Matrix m n R) : traceNorm (-A) = traceNorm A := by unfold traceNorm congr! 3 rw [Matrix.conjTranspose_neg, Matrix.neg_mul, Matrix.mul_neg] exact neg_neg _
636
leanexplore_declaration
leanexplore:379607
leanexplore_sqlite
leanexplore_declarations
lemma cfc_sqrt_isometry_conj {A : Matrix n n R} (hA : 0 ≤ A) {u : Matrix m n R} (hu₁ : u.Isometry) : CFC.sqrt (u * A * uᴴ) = u * CFC.sqrt A * uᴴ := by have h_conj (B : Matrix n n R) (hB : 0 ≤ B) : 0 ≤ u * B * uᴴ := by rw [Matrix.nonneg_iff_posSemidef] at hB ⊢ exact hB.mul_mul_conjTranspose_same u ...
263
leanexplore_declaration
leanexplore:379608
leanexplore_sqlite
leanexplore_declarations
theorem traceNorm_isometry_left [Fintype k] {A : Matrix n m R} {u : Matrix k n R} (hu₁ : u.Isometry) : traceNorm (u * A) = traceNorm A := by unfold traceNorm congr 1 simp [Matrix.mul_assoc] nth_rw 2 [← Matrix.mul_assoc] simp [show uᴴ * u = 1 from hu₁]
414
leanexplore_declaration
leanexplore:379609
leanexplore_sqlite
leanexplore_declarations
theorem traceNorm_isometry_right [Fintype k] {A : Matrix n m R} {u : Matrix k m R} (hu₁ : u.Isometry) : traceNorm (A * uᴴ) = traceNorm A := by unfold traceNorm congr 1 simp [← Matrix.mul_assoc] nth_rw 2 [Matrix.mul_assoc] have hA := (Matrix.posSemidef_conjTranspose_mul_self A).nonneg rw [cfc_sqrt_isometry...
325
leanexplore_declaration
leanexplore:379610
leanexplore_sqlite
leanexplore_declarations
/-- The trace norm is invariant under isometries u and v, Property 9.1.4 in Wilde -/ theorem traceNorm_isometry_conj {A : Matrix n n R} {u : Matrix m n R} (hu : u.Isometry) {v : Matrix m n R} (hv : v.Isometry) : traceNorm (u * A * vᴴ) = traceNorm A := by rw [traceNorm_isometry_right hv, traceNorm_isometry_lef...
248
leanexplore_declaration
leanexplore:379611
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem traceNorm_unitary_conj {A : Matrix n n R} {U : Matrix.unitaryGroup n R} : traceNorm (U.val * A * U.valᴴ) = traceNorm A := by have hu:= (Matrix.mem_unitaryGroup_iff_isometry U.val).mp U.2 exact traceNorm_isometry_conj hu.1 hu.1
953
leanexplore_declaration
leanexplore:379612
leanexplore_sqlite
leanexplore_declarations
theorem traceNorm_Hermitian_eq_sum_abs_eigenvalues {A : Matrix n n R} (hA : A.IsHermitian) : A.traceNorm = ∑ i, abs (hA.eigenvalues i) := by obtain ⟨U, D, hD, hA_eq, h_eig⟩ : ∃ U : Matrix.unitaryGroup n R, ∃ D : Matrix n n R, D.IsDiag ∧ A = U.val * D * U.valᴴ ∧ ∀ i, D i i = hA.eigenvalues i := by refine' ⟨hA....