File: Mathlib/LinearAlgebra/Matrix/PosDef.lean

full_name: Matrix.PosSemidef
code: /-- A matrix `M : Matrix n n R` is positive semidefinite if it is Hermitian and `xᴴ * M * x` is
nonnegative for all `x`. -/
def PosSemidef (M : Matrix n n R) 
goal: Prop

full_name: Matrix.posSemidef_diagonal_iff
code: /-- A diagonal matrix is positive semidefinite iff its diagonal entries are nonnegative. -/
lemma posSemidef_diagonal_iff [DecidableEq n] {d : n → R} :
    PosSemidef (diagonal d) ↔ (∀ i : n, 0 ≤ d i) 
goal: (Matrix.diagonal d).PosSemidef ↔ ∀ (i : n), 0 ≤ d i

full_name: Matrix.PosSemidef.isHermitian
code: theorem isHermitian {M : Matrix n n R} (hM : M.PosSemidef) : M.IsHermitian 
goal: M.IsHermitian

full_name: Matrix.PosSemidef.re_dotProduct_nonneg
code: theorem re_dotProduct_nonneg {M : Matrix n n 𝕜} (hM : M.PosSemidef) (x : n → 𝕜) :
    0 ≤ RCLike.re (dotProduct (star x) (M *ᵥ x)) 
goal: 0 ≤ RCLike.re (Matrix.dotProduct (star x) (M.mulVec x))

full_name: Matrix.PosSemidef.conjTranspose_mul_mul_same
code: lemma conjTranspose_mul_mul_same {A : Matrix n n R} (hA : PosSemidef A)
    {m : Type*} [Fintype m] (B : Matrix n m R) :
    PosSemidef (Bᴴ * A * B) 
goal: (B.conjTranspose * A * B).PosSemidef

full_name: Matrix.PosSemidef.mul_mul_conjTranspose_same
code: lemma mul_mul_conjTranspose_same {A : Matrix n n R} (hA : PosSemidef A)
    {m : Type*} [Fintype m] (B : Matrix m n R) :
    PosSemidef (B * A * Bᴴ) 
goal: (B * A * B.conjTranspose).PosSemidef

full_name: Matrix.PosSemidef.submatrix
code: theorem submatrix {M : Matrix n n R} (hM : M.PosSemidef) (e : m → n) :
    (M.submatrix e e).PosSemidef 
goal: (M.submatrix e e).PosSemidef

full_name: Matrix.PosSemidef.transpose
code: theorem transpose {M : Matrix n n R} (hM : M.PosSemidef) : Mᵀ.PosSemidef 
goal: M.transpose.PosSemidef

full_name: Matrix.PosSemidef.conjTranspose
code: theorem conjTranspose {M : Matrix n n R} (hM : M.PosSemidef) : Mᴴ.PosSemidef 
goal: M.conjTranspose.PosSemidef

full_name: Matrix.PosSemidef.zero
code: protected lemma zero : PosSemidef (0 : Matrix n n R) 
goal: Matrix.PosSemidef 0

full_name: Matrix.PosSemidef.one
code: protected lemma one [DecidableEq n] : PosSemidef (1 : Matrix n n R) 
goal: Matrix.PosSemidef 1

full_name: Matrix.PosSemidef.pow
code: protected lemma pow [DecidableEq n] {M : Matrix n n R} (hM : M.PosSemidef) (k : ℕ) :
    PosSemidef (M ^ k) 
goal: (M ^ k).PosSemidef

full_name: Matrix.PosSemidef.inv
code: protected lemma inv [DecidableEq n] {M : Matrix n n R} (hM : M.PosSemidef) : M⁻¹.PosSemidef 
goal: M⁻¹.PosSemidef

full_name: Matrix.PosSemidef.zpow
code: protected lemma zpow [DecidableEq n] {M : Matrix n n R} (hM : M.PosSemidef) (z : ℤ) :
    (M ^ z).PosSemidef 
goal: (M ^ z).PosSemidef

full_name: Matrix.PosSemidef.add
code: protected lemma add {A : Matrix m m R} {B : Matrix m m R}
    (hA : A.PosSemidef) (hB : B.PosSemidef) : (A + B).PosSemidef 
goal: (A + B).PosSemidef

full_name: Matrix.PosSemidef.eigenvalues_nonneg
code: /-- 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 
goal: 0 ≤ ⋯.eigenvalues i

full_name: Matrix.PosSemidef.sqrt
code: /-- The positive semidefinite square root of a positive semidefinite matrix -/
noncomputable def sqrt : Matrix n n 𝕜 
goal: Matrix n n 𝕜

full_name: Matrix.PosSemidef.delabSqrt
code: /-- Custom elaborator to produce output like `(_ : PosSemidef A).sqrt` in the goal view. -/
@[delab app.Matrix.PosSemidef.sqrt]
def delabSqrt : Delab 
goal: Lean.PrettyPrinter.Delaborator.Delab

full_name: Matrix.PosSemidef.posSemidef_sqrt
code: lemma posSemidef_sqrt : PosSemidef hA.sqrt 
goal: hA.sqrt.PosSemidef

full_name: Matrix.PosSemidef.sq_sqrt
code: @[simp]
lemma sq_sqrt : hA.sqrt ^ 2 = A 
goal: hA.sqrt ^ 2 = A

full_name: Matrix.PosSemidef.sqrt_mul_self
code: @[simp]
lemma sqrt_mul_self : hA.sqrt * hA.sqrt = A 
goal: hA.sqrt * hA.sqrt = A

full_name: Matrix.PosSemidef.eq_of_sq_eq_sq
code: lemma eq_of_sq_eq_sq {B : Matrix n n 𝕜} (hB : PosSemidef B) (hAB : A ^ 2 = B ^ 2) : A = B 
goal: A = B

full_name: Matrix.PosSemidef.sqrt_sq
code: lemma sqrt_sq : (hA.pow 2 : PosSemidef (A ^ 2)).sqrt = A 
goal: (⋯ : (A ^ 2).PosSemidef).sqrt = A

full_name: Matrix.PosSemidef.eq_sqrt_of_sq_eq
code: lemma eq_sqrt_of_sq_eq {B : Matrix n n 𝕜} (hB : PosSemidef B) (hAB : A ^ 2 = B) : A = hB.sqrt 
goal: A = hB.sqrt

full_name: Matrix.posSemidef_submatrix_equiv
code: @[simp]
theorem posSemidef_submatrix_equiv {M : Matrix n n R} (e : m ≃ n) :
    (M.submatrix e e).PosSemidef ↔ M.PosSemidef 
goal: (M.submatrix ⇑e ⇑e).PosSemidef ↔ M.PosSemidef

full_name: Matrix.posSemidef_conjTranspose_mul_self
code: /-- The conjugate transpose of a matrix mulitplied by the matrix is positive semidefinite -/
theorem posSemidef_conjTranspose_mul_self (A : Matrix m n R) : PosSemidef (Aᴴ * A) 
goal: (A.conjTranspose * A).PosSemidef

full_name: Matrix.posSemidef_self_mul_conjTranspose
code: /-- A matrix multiplied by its conjugate transpose is positive semidefinite -/
theorem posSemidef_self_mul_conjTranspose (A : Matrix m n R) : PosSemidef (A * Aᴴ) 
goal: (A * A.conjTranspose).PosSemidef

full_name: Matrix.eigenvalues_conjTranspose_mul_self_nonneg
code: lemma eigenvalues_conjTranspose_mul_self_nonneg (A : Matrix m n 𝕜) [DecidableEq n] (i : n) :
    0 ≤ (isHermitian_transpose_mul_self A).eigenvalues i 
goal: 0 ≤ ⋯.eigenvalues i

full_name: Matrix.eigenvalues_self_mul_conjTranspose_nonneg
code: lemma eigenvalues_self_mul_conjTranspose_nonneg (A : Matrix m n 𝕜) [DecidableEq m] (i : m) :
    0 ≤ (isHermitian_mul_conjTranspose_self A).eigenvalues i 
goal: 0 ≤ ⋯.eigenvalues i

full_name: Matrix.posSemidef_iff_eq_transpose_mul_self
code: /-- A matrix is positive semidefinite if and only if it has the form `Bᴴ * B` for some `B`. -/
lemma posSemidef_iff_eq_transpose_mul_self {A : Matrix n n 𝕜} :
    PosSemidef A ↔ ∃ (B : Matrix n n 𝕜), A = Bᴴ * B 
goal: A.PosSemidef ↔ ∃ B, A = B.conjTranspose * B

full_name: Matrix.IsHermitian.posSemidef_of_eigenvalues_nonneg
code: lemma IsHermitian.posSemidef_of_eigenvalues_nonneg [DecidableEq n] {A : Matrix n n 𝕜}
    (hA : IsHermitian A) (h : ∀ i : n, 0 ≤ hA.eigenvalues i) : PosSemidef A 
goal: A.PosSemidef

full_name: Matrix.PosSemidef.dotProduct_mulVec_zero_iff
code: /-- For `A` positive semidefinite, we have `x⋆ A x = 0` iff `A x = 0`. -/
theorem PosSemidef.dotProduct_mulVec_zero_iff
    {A : Matrix n n 𝕜} (hA : PosSemidef A) (x : n → 𝕜) :
    star x ⬝ᵥ A *ᵥ x = 0 ↔ A *ᵥ x = 0 
goal: Matrix.dotProduct (star x) (A.mulVec x) = 0 ↔ A.mulVec x = 0

full_name: Matrix.PosSemidef.toLinearMap₂'_zero_iff
code: /-- For `A` positive semidefinite, we have `x⋆ A x = 0` iff `A x = 0` (linear maps version). -/
theorem PosSemidef.toLinearMap₂'_zero_iff [DecidableEq n]
    {A : Matrix n n 𝕜} (hA : PosSemidef A) (x : n → 𝕜) :
    Matrix.toLinearMap₂' 𝕜 A (star x) x = 0 ↔ Matrix.toLin' A x = 0 
goal: (((Matrix.toLinearMap₂' 𝕜) A) (star x)) x = 0 ↔ (Matrix.toLin' A) x = 0

full_name: Matrix.PosDef
code: /-- A matrix `M : Matrix n n R` is positive definite if it is hermitian
   and `xᴴMx` is greater than zero for all nonzero `x`. -/
def PosDef (M : Matrix n n R) 
goal: Prop

full_name: Matrix.PosDef.isHermitian
code: theorem isHermitian {M : Matrix n n R} (hM : M.PosDef) : M.IsHermitian 
goal: M.IsHermitian

full_name: Matrix.PosDef.re_dotProduct_pos
code: theorem re_dotProduct_pos {M : Matrix n n 𝕜} (hM : M.PosDef) {x : n → 𝕜} (hx : x ≠ 0) :
    0 < RCLike.re (dotProduct (star x) (M *ᵥ x)) 
goal: 0 < RCLike.re (Matrix.dotProduct (star x) (M.mulVec x))

full_name: Matrix.PosDef.posSemidef
code: theorem posSemidef {M : Matrix n n R} (hM : M.PosDef) : M.PosSemidef 
goal: M.PosSemidef

full_name: Matrix.PosDef.transpose
code: theorem transpose {M : Matrix n n R} (hM : M.PosDef) : Mᵀ.PosDef 
goal: M.transpose.PosDef

full_name: Matrix.PosDef.add_posSemidef
code: protected lemma add_posSemidef {A : Matrix m m R} {B : Matrix m m R}
    (hA : A.PosDef) (hB : B.PosSemidef) : (A + B).PosDef 
goal: (A + B).PosDef

full_name: Matrix.PosDef.posSemidef_add
code: protected lemma posSemidef_add {A : Matrix m m R} {B : Matrix m m R}
    (hA : A.PosSemidef) (hB : B.PosDef) : (A + B).PosDef 
goal: (A + B).PosDef

full_name: Matrix.PosDef.add
code: protected lemma add {A : Matrix m m R} {B : Matrix m m R}
    (hA : A.PosDef) (hB : B.PosDef) : (A + B).PosDef 
goal: (A + B).PosDef

full_name: Matrix.PosDef.of_toQuadraticForm'
code: theorem of_toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.IsSymm)
    (hMq : M.toQuadraticMap'.PosDef) : M.PosDef 
goal: M.PosDef

full_name: Matrix.PosDef.toQuadraticForm'
code: theorem toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) :
    M.toQuadraticMap'.PosDef 
goal: M.toQuadraticMap'.PosDef

full_name: Matrix.PosDef.eigenvalues_pos
code: /-- The eigenvalues of a positive definite matrix are positive -/
lemma eigenvalues_pos [DecidableEq n] {A : Matrix n n 𝕜}
    (hA : Matrix.PosDef A) (i : n) : 0 < hA.1.eigenvalues i 
goal: 0 < ⋯.eigenvalues i

full_name: Matrix.PosDef.det_pos
code: theorem det_pos [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) : 0 < det M 
goal: 0 < M.det

full_name: QuadraticForm.posDef_of_toMatrix'
code: theorem posDef_of_toMatrix' [DecidableEq n] {Q : QuadraticForm ℝ (n → ℝ)}
    (hQ : Q.toMatrix'.PosDef) : Q.PosDef 
goal: QuadraticMap.PosDef Q

full_name: QuadraticForm.posDef_toMatrix'
code: theorem posDef_toMatrix' [DecidableEq n] {Q : QuadraticForm ℝ (n → ℝ)} (hQ : Q.PosDef) :
    Q.toMatrix'.PosDef 
goal: (QuadraticMap.toMatrix' Q).PosDef

full_name: Matrix.NormedAddCommGroup.ofMatrix
code: /-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
noncomputable abbrev NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) 
goal: NormedAddCommGroup (n → 𝕜)

full_name: Matrix.InnerProductSpace.ofMatrix
code: /-- A positive definite matrix `M` induces an inner product `⟪x, y⟫ = xᴴMy`. -/
def InnerProductSpace.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    @InnerProductSpace 𝕜 (n → 𝕜) _ (NormedAddCommGroup.ofMatrix hM) 
goal: InnerProductSpace 𝕜 (n → 𝕜)