Skip to content

Commit 4fdc843

Browse files
committed
generalize more stuf
1 parent d2d606c commit 4fdc843

2 files changed

Lines changed: 29 additions & 21 deletions

File tree

Mathlib/Analysis/Matrix/Order.lean

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,6 @@ theorem posSemidef_iff_isHermitian_and_spectrum_nonneg [DecidableEq n] {A : Matr
175175
intro i
176176
simpa [h1.spectrum_eq_image_range] using @h2 (h1.eigenvalues i)
177177

178-
/-- A positive semi-definite matrix is positive definite if and only if it is invertible. -/
179-
@[grind =]
180-
theorem PosSemidef.posDef_iff_isUnit [DecidableEq n] {x : Matrix n n 𝕜}
181-
(hx : x.PosSemidef) : x.PosDef ↔ IsUnit x := by
182-
refine ⟨fun h => h.isUnit, fun h => .of_dotProduct_mulVec_pos hx.1 fun v hv => ?_⟩
183-
obtain ⟨y, rfl⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp hx.nonneg
184-
simp_rw [dotProduct_mulVec, ← vecMul_vecMul, star_eq_conjTranspose, ← star_mulVec,
185-
← dotProduct_mulVec, dotProduct_star_self_pos_iff]
186-
contrapose hv
187-
rw [← map_eq_zero_iff (f := (yᴴ * y).mulVecLin) (mulVec_injective_iff_isUnit.mpr h),
188-
mulVecLin_apply, ← mulVec_mulVec, hv, mulVec_zero]
189-
190178
theorem isStrictlyPositive_iff_posDef [DecidableEq n] {x : Matrix n n 𝕜} :
191179
IsStrictlyPositive x ↔ x.PosDef :=
192180
fun h => h.nonneg.posSemidef.posDef_iff_isUnit.mpr h.isUnit,
@@ -196,9 +184,6 @@ alias ⟨IsStrictlyPositive.posDef, PosDef.isStrictlyPositive⟩ := isStrictlyPo
196184

197185
attribute [aesop safe forward (rule_sets := [CStarAlgebra])] PosDef.isStrictlyPositive
198186

199-
lemma PosSemidef.posDef_iff_det_ne_zero [DecidableEq n] {A : Matrix n n 𝕜} (hA : A.PosSemidef) :
200-
A.PosDef ↔ A.det ≠ 0 := by
201-
simp [hA.posDef_iff_isUnit, isUnit_iff_isUnit_det]
202187

203188
section kronecker
204189

Mathlib/LinearAlgebra/Matrix/PosDef.lean

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,23 @@ theorem mul_conjTranspose_self [StarOrderedRing R] [NoZeroDivisors R] (A : Matri
496496
classical
497497
simpa using mul_mul_conjTranspose_same .one hA
498498

499+
lemma mulVec_injective {M : Matrix n n R} (hM : M.PosDef) : Function.Injective M.mulVec := by
500+
intro _ _ hxy; by_contra h
501+
simpa [mulVec_sub, hxy] using hM.dotProduct_mulVec_pos (sub_ne_zero_of_ne h)
502+
503+
lemma _root_.Matrix.posDef_iff_posSemidef_and_mulVec_injective [StarOrderedRing R']
504+
[NoZeroDivisors R'] {A : Matrix n n R'} :
505+
PosDef A ↔ A.PosSemidef ∧ Function.Injective A.mulVec := by
506+
refine ⟨fun hA ↦ ⟨hA.posSemidef, hA.mulVec_injective⟩, fun ⟨hA, hA'⟩ ↦ ?_⟩
507+
refine posDef_iff_dotProduct_mulVec.mpr ⟨hA.isHermitian, fun x hx ↦ lt_of_le_of_ne' ?_ ?_⟩
508+
· exact hA.dotProduct_mulVec_nonneg x
509+
simpa [hA.dotProduct_mulVec_zero_iff, hx] using hA'.eq_iff (a := x) (b := 0)
510+
511+
lemma _root_.Matrix.PosSemidef.posDef_iff_mulVec_injective [StarOrderedRing R']
512+
[NoZeroDivisors R'] {A : Matrix n n R'} (hA : A.PosSemidef) :
513+
PosDef A ↔ Function.Injective A.mulVec := by
514+
simp [posDef_iff_posSemidef_and_mulVec_injective, hA]
515+
499516
theorem of_toQuadraticForm' {R : Type*} [CommRing R] [PartialOrder R] [StarRing R] [TrivialStar R]
500517
[DecidableEq n] {M : Matrix n n R} (hM : M.IsSymm)
501518
(hMq : M.toQuadraticForm'.PosDef) : M.PosDef := by
@@ -554,12 +571,8 @@ theorem det_pos [DecidableEq n] [Nontrivial R'] [IsOrderedRing R'] [PosMulReflec
554571
section Field
555572
variable {K : Type*} [Field K] [PartialOrder K] [StarRing K]
556573

557-
theorem isUnit [DecidableEq n] {M : Matrix n n K} (hM : M.PosDef) : IsUnit M := by
558-
by_contra h
559-
obtain ⟨a, ha, ha2⟩ : ∃ a ≠ 0, M *ᵥ a = 0 := by
560-
obtain ⟨a, b, ha⟩ := Function.not_injective_iff.mp <| mulVec_injective_iff_isUnit.not.mpr h
561-
exact ⟨a - b, by simp [sub_eq_zero, ha, mulVec_sub]⟩
562-
simpa [ha2] using hM.dotProduct_mulVec_pos ha
574+
theorem isUnit [DecidableEq n] {M : Matrix n n K} (hM : M.PosDef) : IsUnit M :=
575+
mulVec_injective_iff_isUnit.mp (mulVec_injective hM)
563576

564577
protected theorem inv [DecidableEq n] {M : Matrix n n K} (hM : M.PosDef) : M⁻¹.PosDef := by
565578
have := hM.mul_mul_conjTranspose_same (B := M⁻¹) ?_
@@ -574,6 +587,16 @@ theorem _root_.Matrix.posDef_inv_iff [DecidableEq n] {M : Matrix n n K} :
574587
letI := (Matrix.isUnit_nonsing_inv_iff.1 <| h.isUnit).invertible
575588
Matrix.inv_inv_of_invertible M ▸ h.inv, (·.inv)⟩
576589

590+
/-- A positive semi-definite matrix is positive definite if and only if it is invertible. -/
591+
@[grind =]
592+
theorem _root_.Matrix.PosSemidef.posDef_iff_isUnit [DecidableEq n] [StarOrderedRing K]
593+
{A : Matrix n n K} (hA : A.PosSemidef) : A.PosDef ↔ IsUnit A := by
594+
simp [hA.posDef_iff_mulVec_injective, mulVec_injective_iff_isUnit]
595+
596+
lemma _root_.Matrix.PosSemidef.posDef_iff_det_ne_zero [DecidableEq n] [StarOrderedRing K]
597+
{A : Matrix n n K} (hA : A.PosSemidef) : A.PosDef ↔ A.det ≠ 0 := by
598+
simp [hA.posDef_iff_isUnit, isUnit_iff_isUnit_det]
599+
577600
end Field
578601

579602
section conjugate

0 commit comments

Comments
 (0)