l3lab/ntp-mathlib huggingface dataset:
theorem isLocalization : IsLocalization (Submonoid.closure ({X} : Set R[X])) R[T;T⁻¹] :=
  { map_units' := fun t => by
      cases' t with t ht
      rcases Submonoid.mem_closure_singleton.mp ht with ⟨n, rfl⟩
      simp only [isUnit_T n, algebraMap_eq_toLaurent, Polynomial.toLaurent_X_pow]
    surj' := fun f => by
      induction' f using LaurentPolynomial.induction_on_mul_T with f n
      have := (Submonoid.closure ({X} : Set R[X])).pow_mem Submonoid.mem_closure_singleton_self n
      refine' ⟨(f, ⟨_, this⟩), _⟩
      simp only [algebraMap_eq_toLaurent, Polynomial.toLaurent_X_pow, mul_T_assoc,
        add_left_neg, T_zero, mul_one]
    exists_of_eq := fun {f g} => by
      rw [algebraMap_eq_toLaurent, algebraMap_eq_toLaurent, Polynomial.toLaurent_inj]
      rintro rfl
      

Proof state:
R : Type u_1
inst✝ : CommSemiring R
f : R[X]
⊢ ∃ c, ↑c * f = ↑c * f

Next tactic:
exact ⟨1, rfl⟩
@[simp] lemma invert_comp_C : invert ∘ (@C R _) = C := by 

Proof state:
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
⊢ ⇑invert ∘ ⇑C = ⇑C

Next tactic:
ext
@[simp] lemma invert_comp_C : invert ∘ (@C R _) = C := by ext; 

Proof state:
case h.h
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
x✝ : R
a✝ : ℤ
⊢ ((⇑invert ∘ ⇑C) x✝) a✝ = (C x✝) a✝

Next tactic:
simp
@[simp] lemma invert_C (t : R) : invert (C t) = C t := by 

Proof state:
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
t : R
⊢ invert (C t) = C t

Next tactic:
ext
@[simp] lemma invert_C (t : R) : invert (C t) = C t := by ext; 

Proof state:
case h
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
t : R
a✝ : ℤ
⊢ (invert (C t)) a✝ = (C t) a✝

Next tactic:
simp
lemma involutive_invert : Involutive (invert (R := R)) := fun _ ↦ by 

Proof state:
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
x✝ : R[T;T⁻¹]
⊢ invert (invert x✝) = x✝

Next tactic:
ext
lemma involutive_invert : Involutive (invert (R := R)) := fun _ ↦ by ext; 

Proof state:
case h
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
x✝ : R[T;T⁻¹]
a✝ : ℤ
⊢ (invert (invert x✝)) a✝ = x✝ a✝

Next tactic:
simp
lemma toLaurent_reverse (p : R[X]) :
    toLaurent p.reverse = invert (toLaurent p) * (T p.natDegree) := by
  

Proof state:
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
p : R[X]
⊢ toLaurent (reverse p) = invert (toLaurent p) * T ↑(natDegree p)

Next tactic:
nontriviality R
lemma toLaurent_reverse (p : R[X]) :
    toLaurent p.reverse = invert (toLaurent p) * (T p.natDegree) := by
  nontriviality R
  

Proof state:
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
p : R[X]
✝ : Nontrivial R
⊢ toLaurent (reverse p) = invert (toLaurent p) * T ↑(natDegree p)

Next tactic:
induction' p using Polynomial.recOnHorner with p t _ _ ih p hp ih
lemma toLaurent_reverse (p : R[X]) :
    toLaurent p.reverse = invert (toLaurent p) * (T p.natDegree) := by
  nontriviality R
  induction' p using Polynomial.recOnHorner with p t _ _ ih p hp ih
  · 

Proof state:
case M0
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
✝ : Nontrivial R
⊢ toLaurent (reverse 0) = invert (toLaurent 0) * T ↑(natDegree 0)

Next tactic:
simp
lemma toLaurent_reverse (p : R[X]) :
    toLaurent p.reverse = invert (toLaurent p) * (T p.natDegree) := by
  nontriviality R
  induction' p using Polynomial.recOnHorner with p t _ _ ih p hp ih
  · simp
  · 

Proof state:
case MC
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
✝ : Nontrivial R
p : R[X]
t : R
a✝¹ : coeff p 0 = 0
a✝ : t ≠ 0
ih : toLaurent (reverse p) = invert (toLaurent p) * T ↑(natDegree p)
⊢ toLaurent (reverse (p + Polynomial.C t)) =
    invert (toLaurent (p + Polynomial.C t)) * T ↑(natDegree (p + Polynomial.C t))

Next tactic:
simp [add_mul, ← ih]
lemma toLaurent_reverse (p : R[X]) :
    toLaurent p.reverse = invert (toLaurent p) * (T p.natDegree) := by
  nontriviality R
  induction' p using Polynomial.recOnHorner with p t _ _ ih p hp ih
  · simp
  · simp [add_mul, ← ih]
  · 

Proof state:
case MX
R✝ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
✝ : Nontrivial R
p : R[X]
hp : p ≠ 0
ih : toLaurent (reverse p) = invert (toLaurent p) * T ↑(natDegree p)
⊢ toLaurent (reverse (p * X)) = invert (toLaurent (p * X)) * T ↑(natDegree (p * X))

Next tactic:
simpa [natDegree_mul_X hp]
theorem mul_neg {R} [Ring R] (a b : R) : a * -b = -(a * b) := by 

Proof state:
R✝ : Type ?u.74560
inst✝¹ : CommSemiring R✝
R : Type u_1
inst✝ : Ring R
a b : R
⊢ a * -b = -(a * b)

Next tactic:
simp
theorem nat_rawCast_0 : (Nat.rawCast 0 : R) = 0 := by 

Proof state:
R : Type u_1
inst✝ : CommSemiring R
⊢ Nat.rawCast 0 = 0

Next tactic:
simp
theorem nat_rawCast_1 : (Nat.rawCast 1 : R) = 1 := by 

Proof state:
R : Type u_1
inst✝ : CommSemiring R
⊢ Nat.rawCast 1 = 1

Next tactic:
simp
theorem int_rawCast_neg {R} [Ring R] : (Int.rawCast (.negOfNat n) : R) = -Nat.rawCast n := by 

Proof state:
R✝ : Type ?u.77404
inst✝¹ : CommSemiring R✝
n : ℕ
R : Type u_1
inst✝ : Ring R
⊢ Int.rawCast (Int.negOfNat n) = -Nat.rawCast n

Next tactic:
simp
theorem rat_rawCast_pos {R} [DivisionRing R] :
    (Rat.rawCast (.ofNat n) d : R) = Nat.rawCast n / Nat.rawCast d := by 

Proof state:
R✝ : Type ?u.77860
inst✝¹ : CommSemiring R✝
n d : ℕ
R : Type u_1
inst✝ : DivisionRing R
⊢ Rat.rawCast (Int.ofNat n) d = Nat.rawCast n / Nat.rawCast d

Next tactic:
simp
theorem rat_rawCast_neg {R} [DivisionRing R] :
    (Rat.rawCast (.negOfNat n) d : R) = Int.rawCast (.negOfNat n) / Nat.rawCast d := by 

Proof state:
R✝ : Type ?u.79151
inst✝¹ : CommSemiring R✝
n d : ℕ
R : Type u_1
inst✝ : DivisionRing R
⊢ Rat.rawCast (Int.negOfNat n) d = Int.rawCast (Int.negOfNat n) / Nat.rawCast d

Next tactic:
simp
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
⊢ x = y

Next tactic:
apply (toDualMap 𝕜 E).map_eq_iff.mp
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
⊢ (toDualMap 𝕜 E) x = (toDualMap 𝕜 E) y

Next tactic:
refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
⊢ ∀ (i : ι), ↑((toDualMap 𝕜 E) x) (b i) = ↑((toDualMap 𝕜 E) y) (b i)

Next tactic:
intro i
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
  intro i
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
i : ι
⊢ ↑((toDualMap 𝕜 E) x) (b i) = ↑((toDualMap 𝕜 E) y) (b i)

Next tactic:
simp only [ContinuousLinearMap.coe_coe]
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
  intro i
  simp only [ContinuousLinearMap.coe_coe]
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
i : ι
⊢ ((toDualMap 𝕜 E) x) (b i) = ((toDualMap 𝕜 E) y) (b i)

Next tactic:
rw [toDualMap_apply, toDualMap_apply]
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
  intro i
  simp only [ContinuousLinearMap.coe_coe]
  rw [toDualMap_apply, toDualMap_apply]
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
i : ι
⊢ inner x (b i) = inner y (b i)

Next tactic:
rw [← inner_conj_symm]
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
  intro i
  simp only [ContinuousLinearMap.coe_coe]
  rw [toDualMap_apply, toDualMap_apply]
  rw [← inner_conj_symm]
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
i : ι
⊢ (starRingEnd 𝕜) (inner (b i) x) = inner y (b i)

Next tactic:
conv_rhs => rw [← inner_conj_symm]
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
  intro i
  simp only [ContinuousLinearMap.coe_coe]
  rw [toDualMap_apply, toDualMap_apply]
  rw [← inner_conj_symm]
  conv_rhs => 

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
i : ι
| inner y (b i)

Next tactic:
rw [← inner_conj_symm]
theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by
  apply (toDualMap 𝕜 E).map_eq_iff.mp
  refine' (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b _)
  intro i
  simp only [ContinuousLinearMap.coe_coe]
  rw [toDualMap_apply, toDualMap_apply]
  rw [← inner_conj_symm]
  conv_rhs => rw [← inner_conj_symm]
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner (b i) x = inner (b i) y
i : ι
⊢ (starRingEnd 𝕜) (inner (b i) x) = (starRingEnd 𝕜) (inner (b i) y)

Next tactic:
exact congr_arg conj (h i)
theorem ext_inner_right_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪x, b i⟫ = ⟪y, b i⟫) : x = y := by
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner x (b i) = inner y (b i)
⊢ x = y

Next tactic:
refine' ext_inner_left_basis b fun i => _
theorem ext_inner_right_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪x, b i⟫ = ⟪y, b i⟫) : x = y := by
  refine' ext_inner_left_basis b fun i => _
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner x (b i) = inner y (b i)
i : ι
⊢ inner (b i) x = inner (b i) y

Next tactic:
rw [← inner_conj_symm]
theorem ext_inner_right_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪x, b i⟫ = ⟪y, b i⟫) : x = y := by
  refine' ext_inner_left_basis b fun i => _
  rw [← inner_conj_symm]
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner x (b i) = inner y (b i)
i : ι
⊢ (starRingEnd 𝕜) (inner x (b i)) = inner (b i) y

Next tactic:
conv_rhs => rw [← inner_conj_symm]
theorem ext_inner_right_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪x, b i⟫ = ⟪y, b i⟫) : x = y := by
  refine' ext_inner_left_basis b fun i => _
  rw [← inner_conj_symm]
  conv_rhs => 

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner x (b i) = inner y (b i)
i : ι
| inner (b i) y

Next tactic:
rw [← inner_conj_symm]
theorem ext_inner_right_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E)
    (h : ∀ i : ι, ⟪x, b i⟫ = ⟪y, b i⟫) : x = y := by
  refine' ext_inner_left_basis b fun i => _
  rw [← inner_conj_symm]
  conv_rhs => rw [← inner_conj_symm]
  

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝² : IsROrC 𝕜
inst✝¹ : NormedAddCommGroup E
inst✝ : InnerProductSpace 𝕜 E
ι : Type u_3
x y : E
b : Basis ι 𝕜 E
h : ∀ (i : ι), inner x (b i) = inner y (b i)
i : ι
⊢ (starRingEnd 𝕜) (inner x (b i)) = (starRingEnd 𝕜) (inner y (b i))

Next tactic:
exact congr_arg conj (h i)
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
⊢ Function.Surjective ⇑(toDualMap 𝕜 E)

Next tactic:
intro ℓ
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
set Y := LinearMap.ker ℓ
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
by_cases htriv : Y = ⊤
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · 

Proof state:
case pos
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Y = ⊤
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          exact h'
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Y = ⊤
⊢ ℓ = 0

Next tactic:
have h' := LinearMap.ker_eq_top.mp htriv
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Y = ⊤
h' : ↑ℓ = 0
⊢ ℓ = 0

Next tactic:
rw [← coe_zero] at h'
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Y = ⊤
h' : ↑ℓ = ↑0
⊢ ℓ = 0

Next tactic:
apply coe_injective
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          

Proof state:
case a
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Y = ⊤
h' : ↑ℓ = ↑0
⊢ ↑ℓ = ↑0

Next tactic:
exact h'
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          exact h'
        

Proof state:
case pos
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Y = ⊤
hℓ : ℓ = 0
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
exact ⟨0, by simp [hℓ]⟩
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          exact h'
        exact ⟨0, by 

Proof state:
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Y = ⊤
hℓ : ℓ = 0
⊢ (toDualMap 𝕜 E) 0 = ℓ

Next tactic:
simp [hℓ]
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          exact h'
        exact ⟨0, by simp [hℓ]⟩
      · 

Proof state:
case neg
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : ¬Y = ⊤
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
rw [← Submodule.orthogonal_eq_bot_iff] at htriv
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          exact h'
        exact ⟨0, by simp [hℓ]⟩
      · rw [← Submodule.orthogonal_eq_bot_iff] at htriv
        

Proof state:
case neg
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : ¬Yᗮ = ⊥
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
change Yᗮ ≠ ⊥ at htriv
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          exact h'
        exact ⟨0, by simp [hℓ]⟩
      · rw [← Submodule.orthogonal_eq_bot_iff] at htriv
        change Yᗮ ≠ ⊥ at htriv
        

Proof state:
case neg
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : Yᗮ ≠ ⊥
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
rw [Submodule.ne_bot_iff] at htriv
/-- Fréchet-Riesz representation: any `ℓ` in the dual of a Hilbert space `E` is of the form
`fun u => ⟪y, u⟫` for some `y : E`, i.e. `toDualMap` is surjective.
-/
def toDual : E ≃ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E :=
  LinearIsometryEquiv.ofSurjective (toDualMap 𝕜 E)
    (by
      intro ℓ
      set Y := LinearMap.ker ℓ
      by_cases htriv : Y = ⊤
      · have hℓ : ℓ = 0 := by
          have h' := LinearMap.ker_eq_top.mp htriv
          rw [← coe_zero] at h'
          apply coe_injective
          exact h'
        exact ⟨0, by simp [hℓ]⟩
      · rw [← Submodule.orthogonal_eq_bot_iff] at htriv
        change Yᗮ ≠ ⊥ at htriv
        rw [Submodule.ne_bot_iff] at htriv
        

Proof state:
case neg
𝕜 : Type u_1
E : Type u_2
inst✝³ : IsROrC 𝕜
inst✝² : NormedAddCommGroup E
inst✝¹ : InnerProductSpace 𝕜 E
inst✝ : CompleteSpace E
ℓ : NormedSpace.Dual 𝕜 E
Y : Submodule 𝕜 E := LinearMap.ker ℓ
htriv : ∃ x ∈ Yᗮ, x ≠ 0
⊢ ∃ a, (toDualMap 𝕜 E) a = ℓ

Next tactic:
obtain ⟨z : E, hz : z ∈ Yᗮ, z_ne_0 : z ≠ 0⟩ := htriv