l3lab/ntp-mathlib huggingface dataset:
theorem posSemidef {M : Matrix n n R} (hM : M.PosDef) : M.PosSemidef := by
  refine' ⟨hM.1, _⟩
  intro x
  by_cases hx : x = 0
  · 

Proof state:
case pos
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁵ : Fintype m
inst✝⁴ : Fintype n
inst✝³ : CommRing R
inst✝² : PartialOrder R
inst✝¹ : StarOrderedRing R
inst✝ : IsROrC 𝕜
M : Matrix n n R
hM : PosDef M
x : n → R
hx : x = 0
⊢ 0 ≤ star x ⬝ᵥ mulVec M x

Next tactic:
simp only [hx, zero_dotProduct, star_zero, IsROrC.zero_re']
theorem posSemidef {M : Matrix n n R} (hM : M.PosDef) : M.PosSemidef := by
  refine' ⟨hM.1, _⟩
  intro x
  by_cases hx : x = 0
  · simp only [hx, zero_dotProduct, star_zero, IsROrC.zero_re']
    

Proof state:
case pos
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁵ : Fintype m
inst✝⁴ : Fintype n
inst✝³ : CommRing R
inst✝² : PartialOrder R
inst✝¹ : StarOrderedRing R
inst✝ : IsROrC 𝕜
M : Matrix n n R
hM : PosDef M
x : n → R
hx : x = 0
⊢ 0 ≤ 0

Next tactic:
exact le_rfl
theorem posSemidef {M : Matrix n n R} (hM : M.PosDef) : M.PosSemidef := by
  refine' ⟨hM.1, _⟩
  intro x
  by_cases hx : x = 0
  · simp only [hx, zero_dotProduct, star_zero, IsROrC.zero_re']
    exact le_rfl
  · 

Proof state:
case neg
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁵ : Fintype m
inst✝⁴ : Fintype n
inst✝³ : CommRing R
inst✝² : PartialOrder R
inst✝¹ : StarOrderedRing R
inst✝ : IsROrC 𝕜
M : Matrix n n R
hM : PosDef M
x : n → R
hx : ¬x = 0
⊢ 0 ≤ star x ⬝ᵥ mulVec M x

Next tactic:
exact le_of_lt (hM.2 x hx)
theorem transpose {M : Matrix n n R} (hM : M.PosDef) : Mᵀ.PosDef := by
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁵ : Fintype m
inst✝⁴ : Fintype n
inst✝³ : CommRing R
inst✝² : PartialOrder R
inst✝¹ : StarOrderedRing R
inst✝ : IsROrC 𝕜
M : Matrix n n R
hM : PosDef M
⊢ PosDef Mᵀ

Next tactic:
refine ⟨IsHermitian.transpose hM.1, fun x hx => ?_⟩
theorem transpose {M : Matrix n n R} (hM : M.PosDef) : Mᵀ.PosDef := by
  refine ⟨IsHermitian.transpose hM.1, fun x hx => ?_⟩
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁵ : Fintype m
inst✝⁴ : Fintype n
inst✝³ : CommRing R
inst✝² : PartialOrder R
inst✝¹ : StarOrderedRing R
inst✝ : IsROrC 𝕜
M : Matrix n n R
hM : PosDef M
x : n → R
hx : x ≠ 0
⊢ 0 < star x ⬝ᵥ mulVec Mᵀ x

Next tactic:
convert hM.2 (star x) (star_ne_zero.2 hx) using 1
theorem transpose {M : Matrix n n R} (hM : M.PosDef) : Mᵀ.PosDef := by
  refine ⟨IsHermitian.transpose hM.1, fun x hx => ?_⟩
  convert hM.2 (star x) (star_ne_zero.2 hx) using 1
  

Proof state:
case h.e'_4
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁵ : Fintype m
inst✝⁴ : Fintype n
inst✝³ : CommRing R
inst✝² : PartialOrder R
inst✝¹ : StarOrderedRing R
inst✝ : IsROrC 𝕜
M : Matrix n n R
hM : PosDef M
x : n → R
hx : x ≠ 0
⊢ star x ⬝ᵥ mulVec Mᵀ x = star (star x) ⬝ᵥ mulVec M (star x)

Next tactic:
rw [mulVec_transpose, Matrix.dotProduct_mulVec, star_star, dotProduct_comm]
theorem of_toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.IsSymm)
    (hMq : M.toQuadraticForm'.PosDef) : M.PosDef := by
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : IsSymm M
hMq : QuadraticForm.PosDef (toQuadraticForm' M)
⊢ PosDef M

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

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : IsSymm M
hMq : QuadraticForm.PosDef (toQuadraticForm' M)
x : n → ℝ
hx : x ≠ 0
⊢ 0 < star x ⬝ᵥ mulVec M x

Next tactic:
simp only [toQuadraticForm', QuadraticForm.PosDef, BilinForm.toQuadraticForm_apply,
    Matrix.toBilin'_apply'] at hMq
theorem of_toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.IsSymm)
    (hMq : M.toQuadraticForm'.PosDef) : M.PosDef := by
  refine' ⟨hM, fun x hx => _⟩
  simp only [toQuadraticForm', QuadraticForm.PosDef, BilinForm.toQuadraticForm_apply,
    Matrix.toBilin'_apply'] at hMq
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : IsSymm M
x : n → ℝ
hx : x ≠ 0
hMq : ∀ (x : n → ℝ), x ≠ 0 → 0 < x ⬝ᵥ mulVec M x
⊢ 0 < star x ⬝ᵥ mulVec M x

Next tactic:
apply hMq x hx
theorem toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) :
    M.toQuadraticForm'.PosDef := by
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
⊢ QuadraticForm.PosDef (Matrix.toQuadraticForm' M)

Next tactic:
intro x hx
theorem toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) :
    M.toQuadraticForm'.PosDef := by
  intro x hx
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
x : n → ℝ
hx : x ≠ 0
⊢ 0 < (Matrix.toQuadraticForm' M) x

Next tactic:
simp only [Matrix.toQuadraticForm', BilinForm.toQuadraticForm_apply, Matrix.toBilin'_apply']
theorem toQuadraticForm' [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) :
    M.toQuadraticForm'.PosDef := by
  intro x hx
  simp only [Matrix.toQuadraticForm', BilinForm.toQuadraticForm_apply, Matrix.toBilin'_apply']
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
x : n → ℝ
hx : x ≠ 0
⊢ 0 < x ⬝ᵥ mulVec M x

Next tactic:
apply hM.2 x hx
/-- 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 := by
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
A : Matrix n n 𝕜
hA : PosDef A
i : n
⊢ 0 < IsHermitian.eigenvalues (_ : IsHermitian A) i

Next tactic:
rw [hA.1.eigenvalues_eq, hA.1.transpose_eigenvectorMatrix_apply]
/-- 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 := by
  rw [hA.1.eigenvalues_eq, hA.1.transpose_eigenvectorMatrix_apply]
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
A : Matrix n n 𝕜
hA : PosDef A
i : n
⊢ 0 <
    IsROrC.re
      (star ((IsHermitian.eigenvectorBasis (_ : IsHermitian A)) i) ⬝ᵥ
        mulVec A ((IsHermitian.eigenvectorBasis (_ : IsHermitian A)) i))

Next tactic:
exact hA.re_dotProduct_pos <| hA.1.eigenvectorBasis.orthonormal.ne_zero i
theorem det_pos [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : 0 < det M := by
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
⊢ 0 < det M

Next tactic:
rw [hM.isHermitian.det_eq_prod_eigenvalues]
theorem det_pos [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : 0 < det M := by
  rw [hM.isHermitian.det_eq_prod_eigenvalues]
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
⊢ 0 < Finset.prod Finset.univ fun i => ↑(IsHermitian.eigenvalues (_ : IsHermitian M) i)

Next tactic:
apply Finset.prod_pos
theorem det_pos [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : 0 < det M := by
  rw [hM.isHermitian.det_eq_prod_eigenvalues]
  apply Finset.prod_pos
  

Proof state:
case h0
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
⊢ ∀ i ∈ Finset.univ, 0 < ↑(IsHermitian.eigenvalues (_ : IsHermitian M) i)

Next tactic:
intro i _
theorem det_pos [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : 0 < det M := by
  rw [hM.isHermitian.det_eq_prod_eigenvalues]
  apply Finset.prod_pos
  intro i _
  

Proof state:
case h0
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
i : n
a✝ : i ∈ Finset.univ
⊢ 0 < ↑(IsHermitian.eigenvalues (_ : IsHermitian M) i)

Next tactic:
rw [hM.isHermitian.eigenvalues_eq]
theorem det_pos [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : 0 < det M := by
  rw [hM.isHermitian.det_eq_prod_eigenvalues]
  apply Finset.prod_pos
  intro i _
  rw [hM.isHermitian.eigenvalues_eq]
  

Proof state:
case h0
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
i : n
a✝ : i ∈ Finset.univ
⊢ 0 <
    ↑(IsROrC.re
        (star ((IsHermitian.eigenvectorMatrix (_ : IsHermitian M))ᵀ i) ⬝ᵥ
          mulVec M ((IsHermitian.eigenvectorMatrix (_ : IsHermitian M))ᵀ i)))

Next tactic:
refine hM.2 _ fun h => ?_
theorem det_pos [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : 0 < det M := by
  rw [hM.isHermitian.det_eq_prod_eigenvalues]
  apply Finset.prod_pos
  intro i _
  rw [hM.isHermitian.eigenvalues_eq]
  refine hM.2 _ fun h => ?_
  

Proof state:
case h0
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
i : n
a✝ : i ∈ Finset.univ
h : (IsHermitian.eigenvectorMatrix (_ : IsHermitian M))ᵀ i = 0
⊢ False

Next tactic:
have h_det : hM.isHermitian.eigenvectorMatrixᵀ.det = 0 :=
    Matrix.det_eq_zero_of_row_eq_zero i fun j => congr_fun h j
theorem det_pos [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : 0 < det M := by
  rw [hM.isHermitian.det_eq_prod_eigenvalues]
  apply Finset.prod_pos
  intro i _
  rw [hM.isHermitian.eigenvalues_eq]
  refine hM.2 _ fun h => ?_
  have h_det : hM.isHermitian.eigenvectorMatrixᵀ.det = 0 :=
    Matrix.det_eq_zero_of_row_eq_zero i fun j => congr_fun h j
  

Proof state:
case h0
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
M : Matrix n n ℝ
hM : PosDef M
i : n
a✝ : i ∈ Finset.univ
h : (IsHermitian.eigenvectorMatrix (_ : IsHermitian M))ᵀ i = 0
h_det : det (IsHermitian.eigenvectorMatrix (_ : IsHermitian M))ᵀ = 0
⊢ False

Next tactic:
simpa only [h_det, not_isUnit_zero] using
    isUnit_det_of_invertible hM.isHermitian.eigenvectorMatrixᵀ
theorem posDef_of_toMatrix' [DecidableEq n] {Q : QuadraticForm ℝ (n → ℝ)}
    (hQ : Q.toMatrix'.PosDef) : Q.PosDef := by
  

Proof state:
n : Type u_1
inst✝¹ : Fintype n
inst✝ : DecidableEq n
Q : QuadraticForm ℝ (n → ℝ)
hQ : Matrix.PosDef (toMatrix' Q)
⊢ PosDef Q

Next tactic:
rw [← toQuadraticForm_associated ℝ Q,
    ← BilinForm.toMatrix'.left_inv ((associatedHom (R := ℝ) ℝ) Q)]
theorem posDef_of_toMatrix' [DecidableEq n] {Q : QuadraticForm ℝ (n → ℝ)}
    (hQ : Q.toMatrix'.PosDef) : Q.PosDef := by
  rw [← toQuadraticForm_associated ℝ Q,
    ← BilinForm.toMatrix'.left_inv ((associatedHom (R := ℝ) ℝ) Q)]
  

Proof state:
n : Type u_1
inst✝¹ : Fintype n
inst✝ : DecidableEq n
Q : QuadraticForm ℝ (n → ℝ)
hQ : Matrix.PosDef (toMatrix' Q)
⊢ PosDef
    (BilinForm.toQuadraticForm
      (LinearEquiv.invFun BilinForm.toMatrix' (AddHom.toFun (↑BilinForm.toMatrix').toAddHom ((associatedHom ℝ) Q))))

Next tactic:
exact hQ.toQuadraticForm'
theorem posDef_toMatrix' [DecidableEq n] {Q : QuadraticForm ℝ (n → ℝ)} (hQ : Q.PosDef) :
    Q.toMatrix'.PosDef := by
  

Proof state:
n : Type u_1
inst✝¹ : Fintype n
inst✝ : DecidableEq n
Q : QuadraticForm ℝ (n → ℝ)
hQ : PosDef Q
⊢ Matrix.PosDef (toMatrix' Q)

Next tactic:
rw [← toQuadraticForm_associated ℝ Q, ←
    BilinForm.toMatrix'.left_inv ((associatedHom (R := ℝ) ℝ) Q)] at hQ
theorem posDef_toMatrix' [DecidableEq n] {Q : QuadraticForm ℝ (n → ℝ)} (hQ : Q.PosDef) :
    Q.toMatrix'.PosDef := by
  rw [← toQuadraticForm_associated ℝ Q, ←
    BilinForm.toMatrix'.left_inv ((associatedHom (R := ℝ) ℝ) Q)] at hQ
  

Proof state:
n : Type u_1
inst✝¹ : Fintype n
inst✝ : DecidableEq n
Q : QuadraticForm ℝ (n → ℝ)
hQ :
  PosDef
    (BilinForm.toQuadraticForm
      (LinearEquiv.invFun BilinForm.toMatrix' (AddHom.toFun (↑BilinForm.toMatrix').toAddHom ((associatedHom ℝ) Q))))
⊢ Matrix.PosDef (toMatrix' Q)

Next tactic:
exact .of_toQuadraticForm' (isSymm_toMatrix' Q) hQ
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x y : n → 𝕜
⊢ (starRingEnd 𝕜) (inner y x) = inner x y

Next tactic:
dsimp only [Inner.inner]
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x y : n → 𝕜
⊢ (starRingEnd 𝕜) (star y ⬝ᵥ mulVec M x) = star x ⬝ᵥ mulVec M y

Next tactic:
rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x : n → 𝕜
⊢ 0 ≤ IsROrC.re (inner x x)

Next tactic:
by_cases h : x = 0
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        by_cases h : x = 0
        · 

Proof state:
case pos
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x : n → 𝕜
h : x = 0
⊢ 0 ≤ IsROrC.re (inner x x)

Next tactic:
simp [h]
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        by_cases h : x = 0
        · simp [h]
        · 

Proof state:
case neg
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x : n → 𝕜
h : ¬x = 0
⊢ 0 ≤ IsROrC.re (inner x x)

Next tactic:
exact le_of_lt (hM.re_dotProduct_pos h)
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        by_cases h : x = 0
        · simp [h]
        · exact le_of_lt (hM.re_dotProduct_pos h)
      definite := fun x (hx : dotProduct _ _ = 0) => by
        

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x : n → 𝕜
hx : star x ⬝ᵥ mulVec M x = 0
⊢ x = 0

Next tactic:
by_contra! h
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        by_cases h : x = 0
        · simp [h]
        · exact le_of_lt (hM.re_dotProduct_pos h)
      definite := fun x (hx : dotProduct _ _ = 0) => by
        by_contra! h
        

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x : n → 𝕜
hx : star x ⬝ᵥ mulVec M x = 0
h : x ≠ 0
⊢ False

Next tactic:
simpa [hx, lt_irrefl] using hM.re_dotProduct_pos h
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        by_cases h : x = 0
        · simp [h]
        · exact le_of_lt (hM.re_dotProduct_pos h)
      definite := fun x (hx : dotProduct _ _ = 0) => by
        by_contra! h
        simpa [hx, lt_irrefl] using hM.re_dotProduct_pos h
      add_left := by 

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
⊢ ∀ (x y z : n → 𝕜), inner (x + y) z = inner x z + inner y z

Next tactic:
simp only [star_add, add_dotProduct, eq_self_iff_true, forall_const]
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        by_cases h : x = 0
        · simp [h]
        · exact le_of_lt (hM.re_dotProduct_pos h)
      definite := fun x (hx : dotProduct _ _ = 0) => by
        by_contra! h
        simpa [hx, lt_irrefl] using hM.re_dotProduct_pos h
      add_left := by simp only [star_add, add_dotProduct, eq_self_iff_true, forall_const]
      smul_left := fun x y r => by
        

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x y : n → 𝕜
r : 𝕜
⊢ inner (r • x) y = (starRingEnd 𝕜) r * inner x y

Next tactic:
simp only
/-- A positive definite matrix `M` induces a norm `‖x‖ = sqrt (re xᴴMx)`. -/
@[reducible]
noncomputable def NormedAddCommGroup.ofMatrix {M : Matrix n n 𝕜} (hM : M.PosDef) :
    NormedAddCommGroup (n → 𝕜) :=
  @InnerProductSpace.Core.toNormedAddCommGroup _ _ _ _ _
    { inner := fun x y => dotProduct (star x) (M.mulVec y)
      conj_symm := fun x y => by
        dsimp only [Inner.inner]
        rw [star_dotProduct, starRingEnd_apply, star_star, star_mulVec, dotProduct_mulVec,
          hM.isHermitian.eq]
      nonneg_re := fun x => by
        by_cases h : x = 0
        · simp [h]
        · exact le_of_lt (hM.re_dotProduct_pos h)
      definite := fun x (hx : dotProduct _ _ = 0) => by
        by_contra! h
        simpa [hx, lt_irrefl] using hM.re_dotProduct_pos h
      add_left := by simp only [star_add, add_dotProduct, eq_self_iff_true, forall_const]
      smul_left := fun x y r => by
        simp only
        

Proof state:
𝕜 : Type u_1
inst✝¹ : IsROrC 𝕜
n : Type u_2
inst✝ : Fintype n
M : Matrix n n 𝕜
hM : PosDef M
x y : n → 𝕜
r : 𝕜
⊢ star (r • x) ⬝ᵥ mulVec M y = (starRingEnd 𝕜) r * star x ⬝ᵥ mulVec M y

Next tactic:
rw [← smul_eq_mul, ← smul_dotProduct, starRingEnd_apply, ← star_smul]
/-- Baire theorems asserts that various topological spaces have the Baire property.
Two versions of these theorems are given.
The first states that complete `PseudoEMetricSpace`s are Baire. -/
instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace α]
    [CompleteSpace α] : BaireSpace α := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝¹ : PseudoEMetricSpace α
inst✝ : CompleteSpace α
⊢ BaireSpace α

Next tactic:
refine' ⟨fun f ho hd => _⟩
/-- Baire theorems asserts that various topological spaces have the Baire property.
Two versions of these theorems are given.
The first states that complete `PseudoEMetricSpace`s are Baire. -/
instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace α]
    [CompleteSpace α] : BaireSpace α := by
  refine' ⟨fun f ho hd => _⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝¹ : PseudoEMetricSpace α
inst✝ : CompleteSpace α
f : ℕ → Set α
ho : ∀ (n : ℕ), IsOpen (f n)
hd : ∀ (n : ℕ), Dense (f n)
⊢ Dense (⋂ n, f n)

Next tactic:
let B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n
/-- Baire theorems asserts that various topological spaces have the Baire property.
Two versions of these theorems are given.
The first states that complete `PseudoEMetricSpace`s are Baire. -/
instance (priority := 100) BaireSpace.of_pseudoEMetricSpace_completeSpace [PseudoEMetricSpace α]
    [CompleteSpace α] : BaireSpace α := by
  refine' ⟨fun f ho hd => _⟩
  let B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
inst✝¹ : PseudoEMetricSpace α
inst✝ : CompleteSpace α
f : ℕ → Set α
ho : ∀ (n : ℕ), IsOpen (f n)
hd : ∀ (n : ℕ), Dense (f n)
B : ℕ → ℝ≥0∞ := fun n => 1 / 2 ^ n
⊢ Dense (⋂ n, f n)

Next tactic:
have Bpos : ∀ n, 0 < B n := by
    intro n
    simp only [one_div, one_mul, ENNReal.inv_pos]
    exact pow_ne_top two_ne_top