Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: Matrix.PosDef (A + B) and Matrix.PosSemidef (A + B) #13750

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Mathlib/LinearAlgebra/Matrix/PosDef.lean
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ protected lemma zpow [DecidableEq n] {M : Matrix n n R} (hM : M.PosSemidef) (z :
· simpa using hM.pow n
· simpa using (hM.pow n).inv

protected lemma add {A : Matrix m m R} {B : Matrix m m R}
(hA : A.PosSemidef) (hB : B.PosSemidef) : (A + B).PosSemidef :=
⟨hA.isHermitian.add hB.isHermitian, fun x => by
rw [add_mulVec, dotProduct_add]
exact add_nonneg (hA.2 x) (hB.2 x)⟩

/-- The eigenvalues of a positive semi-definite matrix are non-negative -/
lemma eigenvalues_nonneg [DecidableEq n] {A : Matrix n n 𝕜}
(hA : Matrix.PosSemidef A) (i : n) : 0 ≤ hA.1.eigenvalues i :=
Expand Down Expand Up @@ -315,6 +321,22 @@ theorem transpose {M : Matrix n n R} (hM : M.PosDef) : Mᵀ.PosDef := by
rw [mulVec_transpose, Matrix.dotProduct_mulVec, star_star, dotProduct_comm]
#align matrix.pos_def.transpose Matrix.PosDef.transpose

protected lemma add_posSemidef {A : Matrix m m R} {B : Matrix m m R}
(hA : A.PosDef) (hB : B.PosSemidef) : (A + B).PosDef :=
⟨hA.isHermitian.add hB.isHermitian, fun x hx => by
rw [add_mulVec, dotProduct_add]
exact add_pos_of_pos_of_nonneg (hA.2 x hx) (hB.2 x)⟩

protected lemma posSemidef_add {A : Matrix m m R} {B : Matrix m m R}
(hA : A.PosSemidef) (hB : B.PosDef) : (A + B).PosDef :=
⟨hA.isHermitian.add hB.isHermitian, fun x hx => by
rw [add_mulVec, dotProduct_add]
exact add_pos_of_nonneg_of_pos (hA.2 x) (hB.2 x hx)⟩

protected lemma add {A : Matrix m m R} {B : Matrix m m R}
(hA : A.PosDef) (hB : B.PosDef) : (A + B).PosDef :=
hA.add_posSemidef hB.posSemidef

theorem of_toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.IsSymm)
(hMq : M.toQuadraticForm'.PosDef) : M.PosDef := by
refine ⟨hM, fun x hx => ?_⟩
Expand Down
Loading