l3lab/ntp-mathlib huggingface dataset:
theorem WeakDual.CharacterSpace.mem_spectrum_iff_exists {a : A} {z : ℂ} :
    z ∈ spectrum ℂ a ↔ ∃ f : characterSpace ℂ A, f a = z := by
  refine' ⟨fun hz => _, _⟩
  · obtain ⟨f, hf⟩ := WeakDual.CharacterSpace.exists_apply_eq_zero hz
    simp only [map_sub, sub_eq_zero, AlgHomClass.commutes, Algebra.id.map_eq_id,
      RingHom.id_apply] at hf
    refine ⟨f, ?_⟩
    

Proof state:
case refine'_1.intro
A : Type u_1
inst✝³ : NormedCommRing A
inst✝² : NormedAlgebra ℂ A
inst✝¹ : CompleteSpace A
I : Ideal A
inst✝ : IsMaximal I
a : A
z : ℂ
hz : z ∈ spectrum ℂ a
f : ↑(characterSpace ℂ A)
hf : f ((algebraMap ℂ A) z) = f a
⊢ f a = z

Next tactic:
rw [AlgHomClass.commutes, Algebra.id.map_eq_id, RingHom.id_apply] at hf
theorem WeakDual.CharacterSpace.mem_spectrum_iff_exists {a : A} {z : ℂ} :
    z ∈ spectrum ℂ a ↔ ∃ f : characterSpace ℂ A, f a = z := by
  refine' ⟨fun hz => _, _⟩
  · obtain ⟨f, hf⟩ := WeakDual.CharacterSpace.exists_apply_eq_zero hz
    simp only [map_sub, sub_eq_zero, AlgHomClass.commutes, Algebra.id.map_eq_id,
      RingHom.id_apply] at hf
    refine ⟨f, ?_⟩
    rw [AlgHomClass.commutes, Algebra.id.map_eq_id, RingHom.id_apply] at hf
    

Proof state:
case refine'_1.intro
A : Type u_1
inst✝³ : NormedCommRing A
inst✝² : NormedAlgebra ℂ A
inst✝¹ : CompleteSpace A
I : Ideal A
inst✝ : IsMaximal I
a : A
z : ℂ
hz : z ∈ spectrum ℂ a
f : ↑(characterSpace ℂ A)
hf : z = f a
⊢ f a = z

Next tactic:
exact hf.symm
theorem WeakDual.CharacterSpace.mem_spectrum_iff_exists {a : A} {z : ℂ} :
    z ∈ spectrum ℂ a ↔ ∃ f : characterSpace ℂ A, f a = z := by
  refine' ⟨fun hz => _, _⟩
  · obtain ⟨f, hf⟩ := WeakDual.CharacterSpace.exists_apply_eq_zero hz
    simp only [map_sub, sub_eq_zero, AlgHomClass.commutes, Algebra.id.map_eq_id,
      RingHom.id_apply] at hf
    refine ⟨f, ?_⟩
    rw [AlgHomClass.commutes, Algebra.id.map_eq_id, RingHom.id_apply] at hf
    exact hf.symm
  · 

Proof state:
case refine'_2
A : Type u_1
inst✝³ : NormedCommRing A
inst✝² : NormedAlgebra ℂ A
inst✝¹ : CompleteSpace A
I : Ideal A
inst✝ : IsMaximal I
a : A
z : ℂ
⊢ (∃ f, f a = z) → z ∈ spectrum ℂ a

Next tactic:
rintro ⟨f, rfl⟩
theorem WeakDual.CharacterSpace.mem_spectrum_iff_exists {a : A} {z : ℂ} :
    z ∈ spectrum ℂ a ↔ ∃ f : characterSpace ℂ A, f a = z := by
  refine' ⟨fun hz => _, _⟩
  · obtain ⟨f, hf⟩ := WeakDual.CharacterSpace.exists_apply_eq_zero hz
    simp only [map_sub, sub_eq_zero, AlgHomClass.commutes, Algebra.id.map_eq_id,
      RingHom.id_apply] at hf
    refine ⟨f, ?_⟩
    rw [AlgHomClass.commutes, Algebra.id.map_eq_id, RingHom.id_apply] at hf
    exact hf.symm
  · rintro ⟨f, rfl⟩
    

Proof state:
case refine'_2.intro
A : Type u_1
inst✝³ : NormedCommRing A
inst✝² : NormedAlgebra ℂ A
inst✝¹ : CompleteSpace A
I : Ideal A
inst✝ : IsMaximal I
a : A
f : ↑(characterSpace ℂ A)
⊢ f a ∈ spectrum ℂ a

Next tactic:
exact AlgHom.apply_mem_spectrum f a
/-- The Gelfand transform is spectrum-preserving. -/
theorem spectrum.gelfandTransform_eq (a : A) :
    spectrum ℂ (gelfandTransform ℂ A a) = spectrum ℂ a := by
  

Proof state:
A : Type u_1
inst✝³ : NormedCommRing A
inst✝² : NormedAlgebra ℂ A
inst✝¹ : CompleteSpace A
I : Ideal A
inst✝ : IsMaximal I
a : A
⊢ spectrum ℂ ((gelfandTransform ℂ A) a) = spectrum ℂ a

Next tactic:
ext z
/-- The Gelfand transform is spectrum-preserving. -/
theorem spectrum.gelfandTransform_eq (a : A) :
    spectrum ℂ (gelfandTransform ℂ A a) = spectrum ℂ a := by
  ext z
  

Proof state:
case h
A : Type u_1
inst✝³ : NormedCommRing A
inst✝² : NormedAlgebra ℂ A
inst✝¹ : CompleteSpace A
I : Ideal A
inst✝ : IsMaximal I
a : A
z : ℂ
⊢ z ∈ spectrum ℂ ((gelfandTransform ℂ A) a) ↔ z ∈ spectrum ℂ a

Next tactic:
rw [ContinuousMap.spectrum_eq_range, WeakDual.CharacterSpace.mem_spectrum_iff_exists]
/-- The Gelfand transform is spectrum-preserving. -/
theorem spectrum.gelfandTransform_eq (a : A) :
    spectrum ℂ (gelfandTransform ℂ A a) = spectrum ℂ a := by
  ext z
  rw [ContinuousMap.spectrum_eq_range, WeakDual.CharacterSpace.mem_spectrum_iff_exists]
  

Proof state:
case h
A : Type u_1
inst✝³ : NormedCommRing A
inst✝² : NormedAlgebra ℂ A
inst✝¹ : CompleteSpace A
I : Ideal A
inst✝ : IsMaximal I
a : A
z : ℂ
⊢ z ∈ Set.range ⇑((gelfandTransform ℂ A) a) ↔ ∃ f, f a = z

Next tactic:
exact Iff.rfl
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
⊢ Isometry ⇑(gelfandTransform ℂ A)

Next tactic:
nontriviality A
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  nontriviality A
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
✝ : Nontrivial A
⊢ Isometry ⇑(gelfandTransform ℂ A)

Next tactic:
refine' AddMonoidHomClass.isometry_of_norm (gelfandTransform ℂ A) fun a => _
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  nontriviality A
  refine' AddMonoidHomClass.isometry_of_norm (gelfandTransform ℂ A) fun a => _
  /- By `spectrum.gelfandTransform_eq`, the spectra of `star a * a` and its
    `gelfandTransform` coincide. Therefore, so do their spectral radii, and since they are
    self-adjoint, so also do their norms. Applying the C⋆-property of the norm and taking square
    roots shows that the norm is preserved. -/
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
✝ : Nontrivial A
a : A
⊢ ‖(gelfandTransform ℂ A) a‖ = ‖a‖

Next tactic:
have : spectralRadius ℂ (gelfandTransform ℂ A (star a * a)) = spectralRadius ℂ (star a * a) := by
    unfold spectralRadius; rw [spectrum.gelfandTransform_eq]
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  nontriviality A
  refine' AddMonoidHomClass.isometry_of_norm (gelfandTransform ℂ A) fun a => _
  /- By `spectrum.gelfandTransform_eq`, the spectra of `star a * a` and its
    `gelfandTransform` coincide. Therefore, so do their spectral radii, and since they are
    self-adjoint, so also do their norms. Applying the C⋆-property of the norm and taking square
    roots shows that the norm is preserved. -/
  have : spectralRadius ℂ (gelfandTransform ℂ A (star a * a)) = spectralRadius ℂ (star a * a) := by
    

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
✝ : Nontrivial A
a : A
⊢ spectralRadius ℂ ((gelfandTransform ℂ A) (star a * a)) = spectralRadius ℂ (star a * a)

Next tactic:
unfold spectralRadius
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  nontriviality A
  refine' AddMonoidHomClass.isometry_of_norm (gelfandTransform ℂ A) fun a => _
  /- By `spectrum.gelfandTransform_eq`, the spectra of `star a * a` and its
    `gelfandTransform` coincide. Therefore, so do their spectral radii, and since they are
    self-adjoint, so also do their norms. Applying the C⋆-property of the norm and taking square
    roots shows that the norm is preserved. -/
  have : spectralRadius ℂ (gelfandTransform ℂ A (star a * a)) = spectralRadius ℂ (star a * a) := by
    unfold spectralRadius; 

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
✝ : Nontrivial A
a : A
⊢ ⨆ k ∈ spectrum ℂ ((gelfandTransform ℂ A) (star a * a)), ↑‖k‖₊ = ⨆ k ∈ spectrum ℂ (star a * a), ↑‖k‖₊

Next tactic:
rw [spectrum.gelfandTransform_eq]
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  nontriviality A
  refine' AddMonoidHomClass.isometry_of_norm (gelfandTransform ℂ A) fun a => _
  /- By `spectrum.gelfandTransform_eq`, the spectra of `star a * a` and its
    `gelfandTransform` coincide. Therefore, so do their spectral radii, and since they are
    self-adjoint, so also do their norms. Applying the C⋆-property of the norm and taking square
    roots shows that the norm is preserved. -/
  have : spectralRadius ℂ (gelfandTransform ℂ A (star a * a)) = spectralRadius ℂ (star a * a) := by
    unfold spectralRadius; rw [spectrum.gelfandTransform_eq]
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
✝ : Nontrivial A
a : A
this : spectralRadius ℂ ((gelfandTransform ℂ A) (star a * a)) = spectralRadius ℂ (star a * a)
⊢ ‖(gelfandTransform ℂ A) a‖ = ‖a‖

Next tactic:
rw [map_mul, (IsSelfAdjoint.star_mul_self a).spectralRadius_eq_nnnorm, gelfandTransform_map_star,
    (IsSelfAdjoint.star_mul_self (gelfandTransform ℂ A a)).spectralRadius_eq_nnnorm] at this
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  nontriviality A
  refine' AddMonoidHomClass.isometry_of_norm (gelfandTransform ℂ A) fun a => _
  /- By `spectrum.gelfandTransform_eq`, the spectra of `star a * a` and its
    `gelfandTransform` coincide. Therefore, so do their spectral radii, and since they are
    self-adjoint, so also do their norms. Applying the C⋆-property of the norm and taking square
    roots shows that the norm is preserved. -/
  have : spectralRadius ℂ (gelfandTransform ℂ A (star a * a)) = spectralRadius ℂ (star a * a) := by
    unfold spectralRadius; rw [spectrum.gelfandTransform_eq]
  rw [map_mul, (IsSelfAdjoint.star_mul_self a).spectralRadius_eq_nnnorm, gelfandTransform_map_star,
    (IsSelfAdjoint.star_mul_self (gelfandTransform ℂ A a)).spectralRadius_eq_nnnorm] at this
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
✝ : Nontrivial A
a : A
this : ↑‖star ((gelfandTransform ℂ A) a) * (gelfandTransform ℂ A) a‖₊ = ↑‖star a * a‖₊
⊢ ‖(gelfandTransform ℂ A) a‖ = ‖a‖

Next tactic:
simp only [ENNReal.coe_eq_coe, CstarRing.nnnorm_star_mul_self, ← sq] at this
/-- The Gelfand transform is an isometry when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_isometry : Isometry (gelfandTransform ℂ A) := by
  nontriviality A
  refine' AddMonoidHomClass.isometry_of_norm (gelfandTransform ℂ A) fun a => _
  /- By `spectrum.gelfandTransform_eq`, the spectra of `star a * a` and its
    `gelfandTransform` coincide. Therefore, so do their spectral radii, and since they are
    self-adjoint, so also do their norms. Applying the C⋆-property of the norm and taking square
    roots shows that the norm is preserved. -/
  have : spectralRadius ℂ (gelfandTransform ℂ A (star a * a)) = spectralRadius ℂ (star a * a) := by
    unfold spectralRadius; rw [spectrum.gelfandTransform_eq]
  rw [map_mul, (IsSelfAdjoint.star_mul_self a).spectralRadius_eq_nnnorm, gelfandTransform_map_star,
    (IsSelfAdjoint.star_mul_self (gelfandTransform ℂ A a)).spectralRadius_eq_nnnorm] at this
  simp only [ENNReal.coe_eq_coe, CstarRing.nnnorm_star_mul_self, ← sq] at this
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
✝ : Nontrivial A
a : A
this : ‖(gelfandTransform ℂ A) a‖₊ ^ 2 = ‖a‖₊ ^ 2
⊢ ‖(gelfandTransform ℂ A) a‖ = ‖a‖

Next tactic:
simpa only [Function.comp_apply, NNReal.sqrt_sq] using
    congr_arg (((↑) : ℝ≥0 → ℝ) ∘ ⇑NNReal.sqrt) this
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
⊢ Function.Bijective ⇑(gelfandTransform ℂ A)

Next tactic:
refine' ⟨(gelfandTransform_isometry A).injective, _⟩
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
⊢ Function.Surjective ⇑(gelfandTransform ℂ A)

Next tactic:
let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        rintro - ⟨a, rfl⟩
        use star a
        ext1 φ
        simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, gelfandTransform_apply_apply, map_star,
          IsROrC.star_def, ContinuousMap.star_apply] }
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
⊢ ∀ {a : C(↑(characterSpace ℂ A), ℂ)},
    a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier →
      star a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier

Next tactic:
rintro - ⟨a, rfl⟩
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        rintro - ⟨a, rfl⟩
        

Proof state:
case intro
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
a : A
⊢ star (↑(gelfandTransform ℂ A) a) ∈
    (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier

Next tactic:
use star a
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        rintro - ⟨a, rfl⟩
        use star a
        

Proof state:
case h
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
a : A
⊢ ↑(gelfandTransform ℂ A) (star a) = star (↑(gelfandTransform ℂ A) a)

Next tactic:
ext1 φ
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        rintro - ⟨a, rfl⟩
        use star a
        ext1 φ
        

Proof state:
case h.h
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
a : A
φ : ↑(characterSpace ℂ A)
⊢ (↑(gelfandTransform ℂ A) (star a)) φ = (star (↑(gelfandTransform ℂ A) a)) φ

Next tactic:
simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, gelfandTransform_apply_apply, map_star,
          IsROrC.star_def, ContinuousMap.star_apply]
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        rintro - ⟨a, rfl⟩
        use star a
        ext1 φ
        simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, gelfandTransform_apply_apply, map_star,
          IsROrC.star_def, ContinuousMap.star_apply] }
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
rng : StarSubalgebra ℂ C(↑(characterSpace ℂ A), ℂ) :=
  { toSubalgebra := AlgHom.range (gelfandTransform ℂ A),
    star_mem' :=
      (_ :
        ∀ {a : C(↑(characterSpace ℂ A), ℂ)},
          a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier →
            star a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier) }
⊢ Function.Surjective ⇑(gelfandTransform ℂ A)

Next tactic:
suffices rng = ⊤ from
    fun x => show x ∈ rng from this.symm ▸ StarSubalgebra.mem_top
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        rintro - ⟨a, rfl⟩
        use star a
        ext1 φ
        simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, gelfandTransform_apply_apply, map_star,
          IsROrC.star_def, ContinuousMap.star_apply] }
  suffices rng = ⊤ from
    fun x => show x ∈ rng from this.symm ▸ StarSubalgebra.mem_top
  /- Because the `gelfandTransform ℂ A` is an isometry, it has closed range, and so by the
    Stone-Weierstrass theorem, it suffices to show that the image of the Gelfand transform separates
    points in `C(characterSpace ℂ A, ℂ)` and is closed under `star`. -/
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
rng : StarSubalgebra ℂ C(↑(characterSpace ℂ A), ℂ) :=
  { toSubalgebra := AlgHom.range (gelfandTransform ℂ A),
    star_mem' :=
      (_ :
        ∀ {a : C(↑(characterSpace ℂ A), ℂ)},
          a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier →
            star a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier) }
⊢ rng = ⊤

Next tactic:
have h : rng.topologicalClosure = rng := le_antisymm
    (StarSubalgebra.topologicalClosure_minimal le_rfl
      (gelfandTransform_isometry A).closedEmbedding.closed_range)
    (StarSubalgebra.le_topologicalClosure _)
/-- The Gelfand transform is bijective when the algebra is a C⋆-algebra over `ℂ`. -/
theorem gelfandTransform_bijective : Function.Bijective (gelfandTransform ℂ A) := by
  refine' ⟨(gelfandTransform_isometry A).injective, _⟩
  /- The range of `gelfandTransform ℂ A` is actually a `StarSubalgebra`. The key lemma below may be
    hard to spot; it's `map_star` coming from `WeakDual.Complex.instStarHomClass`, which is a
    nontrivial result. -/
  let rng : StarSubalgebra ℂ C(characterSpace ℂ A, ℂ) :=
    { toSubalgebra := (gelfandTransform ℂ A).range
      star_mem' := by
        rintro - ⟨a, rfl⟩
        use star a
        ext1 φ
        simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, gelfandTransform_apply_apply, map_star,
          IsROrC.star_def, ContinuousMap.star_apply] }
  suffices rng = ⊤ from
    fun x => show x ∈ rng from this.symm ▸ StarSubalgebra.mem_top
  /- Because the `gelfandTransform ℂ A` is an isometry, it has closed range, and so by the
    Stone-Weierstrass theorem, it suffices to show that the image of the Gelfand transform separates
    points in `C(characterSpace ℂ A, ℂ)` and is closed under `star`. -/
  have h : rng.topologicalClosure = rng := le_antisymm
    (StarSubalgebra.topologicalClosure_minimal le_rfl
      (gelfandTransform_isometry A).closedEmbedding.closed_range)
    (StarSubalgebra.le_topologicalClosure _)
  

Proof state:
A : Type u_1
inst✝⁵ : NormedCommRing A
inst✝⁴ : NormedAlgebra ℂ A
inst✝³ : CompleteSpace A
inst✝² : StarRing A
inst✝¹ : CstarRing A
inst✝ : StarModule ℂ A
rng : StarSubalgebra ℂ C(↑(characterSpace ℂ A), ℂ) :=
  { toSubalgebra := AlgHom.range (gelfandTransform ℂ A),
    star_mem' :=
      (_ :
        ∀ {a : C(↑(characterSpace ℂ A), ℂ)},
          a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier →
            star a ∈ (AlgHom.range (gelfandTransform ℂ A)).toSubsemiring.toSubmonoid.toSubsemigroup.carrier) }
h : StarSubalgebra.topologicalClosure rng = rng
⊢ rng = ⊤

Next tactic:
refine' h ▸ ContinuousMap.starSubalgebra_topologicalClosure_eq_top_of_separatesPoints
    _ (fun _ _ => _)