l3lab/ntp-mathlib huggingface dataset:
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by 

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
⊢ x ∈ sphere 0 ‖x‖

Next tactic:
simp
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  

Proof state:
case intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
⊢ HasEigenvalue T ↑(⨆ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
⊢ HasEigenvalue T ↑(⨆ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by 

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
⊢ ‖x₀‖ = ‖x‖

Next tactic:
simpa using hx₀'
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
hx₀ : ‖x₀‖ = ‖x‖
⊢ HasEigenvalue T ↑(⨆ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
  have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by 

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
hx₀ : ‖x₀‖ = ‖x‖
⊢ IsMaxOn (ContinuousLinearMap.reApplyInnerSelf ↑T') (sphere 0 ‖x₀‖) x₀

Next tactic:
simpa only [← hx₀] using hTx₀
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
  have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this✝ : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
hx₀ : ‖x₀‖ = ‖x‖
this : IsMaxOn (ContinuousLinearMap.reApplyInnerSelf ↑T') (sphere 0 ‖x₀‖) x₀
⊢ HasEigenvalue T ↑(⨆ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
have hx₀_ne : x₀ ≠ 0 := by
    have : ‖x₀‖ ≠ 0 := by simp only [hx₀, norm_eq_zero, hx, Ne.def, not_false_iff]
    simpa [← norm_eq_zero, Ne.def]
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
  have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀
  have hx₀_ne : x₀ ≠ 0 := by
    

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this✝ : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
hx₀ : ‖x₀‖ = ‖x‖
this : IsMaxOn (ContinuousLinearMap.reApplyInnerSelf ↑T') (sphere 0 ‖x₀‖) x₀
⊢ x₀ ≠ 0

Next tactic:
have : ‖x₀‖ ≠ 0 := by simp only [hx₀, norm_eq_zero, hx, Ne.def, not_false_iff]
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
  have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀
  have hx₀_ne : x₀ ≠ 0 := by
    have : ‖x₀‖ ≠ 0 := by 

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this✝ : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
hx₀ : ‖x₀‖ = ‖x‖
this : IsMaxOn (ContinuousLinearMap.reApplyInnerSelf ↑T') (sphere 0 ‖x₀‖) x₀
⊢ ‖x₀‖ ≠ 0

Next tactic:
simp only [hx₀, norm_eq_zero, hx, Ne.def, not_false_iff]
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
  have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀
  have hx₀_ne : x₀ ≠ 0 := by
    have : ‖x₀‖ ≠ 0 := by simp only [hx₀, norm_eq_zero, hx, Ne.def, not_false_iff]
    

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this✝¹ : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
hx₀ : ‖x₀‖ = ‖x‖
this✝ : IsMaxOn (ContinuousLinearMap.reApplyInnerSelf ↑T') (sphere 0 ‖x₀‖) x₀
this : ‖x₀‖ ≠ 0
⊢ x₀ ≠ 0

Next tactic:
simpa [← norm_eq_zero, Ne.def]
/-- The supremum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iSup_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨆ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a max
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_ge H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'
  have : IsMaxOn T'.val.reApplyInnerSelf (sphere 0 ‖x₀‖) x₀ := by simpa only [← hx₀] using hTx₀
  have hx₀_ne : x₀ ≠ 0 := by
    have : ‖x₀‖ ≠ 0 := by simp only [hx₀, norm_eq_zero, hx, Ne.def, not_false_iff]
    simpa [← norm_eq_zero, Ne.def]
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this✝ : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') y ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') x₀
hx₀ : ‖x₀‖ = ‖x‖
this : IsMaxOn (ContinuousLinearMap.reApplyInnerSelf ↑T') (sphere 0 ‖x₀‖) x₀
hx₀_ne : x₀ ≠ 0
⊢ HasEigenvalue T ↑(⨆ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
exact hasEigenvalue_of_hasEigenvector (T'.prop.hasEigenvector_of_isMaxOn hx₀_ne this)
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
⊢ HasEigenvalue T ↑(⨅ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
haveI := FiniteDimensional.proper_isROrC 𝕜 E
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
⊢ HasEigenvalue T ↑(⨅ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
let T' := hT.toSelfAdjoint
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
⊢ HasEigenvalue T ↑(⨅ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  

Proof state:
case intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
⊢ HasEigenvalue T ↑(⨅ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  

Proof state:
case intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
⊢ HasEigenvalue T ↑(⨅ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by 

Proof state:
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
⊢ x ∈ sphere 0 ‖x‖

Next tactic:
simp
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a min
  

Proof state:
case intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
⊢ HasEigenvalue T ↑(⨅ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_le H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
/-- The infimum of the Rayleigh quotient of a symmetric operator `T` on a nontrivial
finite-dimensional vector space is an eigenvalue for that operator. -/
theorem hasEigenvalue_iInf_of_finiteDimensional (hT : T.IsSymmetric) :
    HasEigenvalue T ↑(⨅ x : { x : E // x ≠ 0 }, IsROrC.re ⟪T x, x⟫ / ‖(x : E)‖ ^ 2 : ℝ) := by
  haveI := FiniteDimensional.proper_isROrC 𝕜 E
  let T' := hT.toSelfAdjoint
  obtain ⟨x, hx⟩ : ∃ x : E, x ≠ 0 := exists_ne 0
  have H₁ : IsCompact (sphere (0 : E) ‖x‖) := isCompact_sphere _ _
  have H₂ : (sphere (0 : E) ‖x‖).Nonempty := ⟨x, by simp⟩
  -- key point: in finite dimension, a continuous function on the sphere has a min
  obtain ⟨x₀, hx₀', hTx₀⟩ :=
    H₁.exists_forall_le H₂ T'.val.reApplyInnerSelf_continuous.continuousOn
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
inst✝³ : IsROrC 𝕜
E : Type u_2
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : FiniteDimensional 𝕜 E
_i : Nontrivial E
T : E →ₗ[𝕜] E
hT : IsSymmetric T
this : ProperSpace E
T' : ↥(selfAdjoint (E →L[𝕜] E)) := toSelfAdjoint hT
x : E
hx : x ≠ 0
H₁ : IsCompact (sphere 0 ‖x‖)
H₂ : Set.Nonempty (sphere 0 ‖x‖)
x₀ : E
hx₀' : x₀ ∈ sphere 0 ‖x‖
hTx₀ : ∀ y ∈ sphere 0 ‖x‖, ContinuousLinearMap.reApplyInnerSelf (↑T') x₀ ≤ ContinuousLinearMap.reApplyInnerSelf (↑T') y
⊢ HasEigenvalue T ↑(⨅ x, IsROrC.re (inner (T ↑x) ↑x) / ‖↑x‖ ^ 2)

Next tactic:
have hx₀ : ‖x₀‖ = ‖x‖ := by simpa using hx₀'