/-- Let `K` a subfield of `ℂ` and let `ψ : K →+* ℂ` a ring homomorphism. Assume that `ψ` is uniform
continuous, then `ψ` is either the inclusion map or the composition of the inclusion map with the
complex conjugation. -/
theorem Complex.uniformContinuous_ringHom_eq_id_or_conj (K : Subfield ℂ) {ψ : K →+* ℂ}
    (hc : UniformContinuous ψ) : ψ.toFun = K.subtype ∨ ψ.toFun = conj ∘ K.subtype := by
  letI : TopologicalDivisionRing ℂ := TopologicalDivisionRing.mk
  letI : TopologicalRing K.topologicalClosure :=
    Subring.instTopologicalRing K.topologicalClosure.toSubring
  set ι : K → K.topologicalClosure := ⇑(Subfield.inclusion K.le_topologicalClosure)
  have ui : UniformInducing ι :=
    ⟨by
      erw [uniformity_subtype, uniformity_subtype, Filter.comap_comap]
      congr ⟩
  let di := ui.denseInducing (?_ : DenseRange ι)
  · -- extψ : closure(K) →+* ℂ is the extension of ψ : K →+* ℂ
    let extψ := DenseInducing.extendRingHom ui di.dense hc
    haveI hψ := (uniformContinuous_uniformly_extend ui di.dense hc).continuous
    cases' Complex.subfield_eq_of_closed (Subfield.isClosed_topologicalClosure K) with h h
    · left
      let j := RingEquiv.subfieldCongr h
      -- ψ₁ is the continuous ring hom `ℝ →+* ℂ` constructed from `j : closure (K) ≃+* ℝ`
      -- and `extψ : closure (K) →+* ℂ`
      let ψ₁ := RingHom.comp extψ (RingHom.comp j.symm.toRingHom ofReal.rangeRestrict)
      -- porting note: was `by continuity!` and was used inline
      have hψ₁ : Continuous ψ₁ := by
        simpa only [RingHom.coe_comp] using hψ.comp ((continuous_algebraMap ℝ ℂ).subtype_mk _)
      ext1 x
      rsuffices ⟨r, hr⟩ : ∃ r : ℝ, ofReal.rangeRestrict r = j (ι x)
      · have :=
          RingHom.congr_fun (ringHom_eq_ofReal_of_continuous hψ₁) r
        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
        erw [RingHom.comp_apply, RingHom.comp_apply, hr, RingEquiv.toRingHom_eq_coe] at this
        convert this using 1
        · exact (DenseInducing.extend_eq di hc.continuous _).symm
        · rw [← ofReal.coe_rangeRestrict, hr]
          rfl
      obtain ⟨r, hr⟩ := SetLike.coe_mem (j (ι x))
      exact ⟨r, Subtype.ext hr⟩
    · -- ψ₁ is the continuous ring hom `ℂ →+* ℂ` constructed from `closure (K) ≃+* ℂ`
      -- and `extψ : closure (K) →+* ℂ`
      let ψ₁ :=
        RingHom.comp extψ
          (RingHom.comp (RingEquiv.subfieldCongr h).symm.toRingHom
            (@Subfield.topEquiv ℂ _).symm.toRingHom)
      -- porting note: was `by continuity!` and was used inline
      have hψ₁ : Continuous ψ₁ := by
        simpa only [RingHom.coe_comp] using hψ.comp (continuous_id.subtype_mk _)
      cases' ringHom_eq_id_or_conj_of_continuous hψ₁ with h h
      · left
        ext1 z
        

Proof state:
case refine_2.inr.inl.h.h
K : Subfield ℂ
ψ : ↥K →+* ℂ
hc : UniformContinuous ⇑ψ
this✝ : TopologicalDivisionRing ℂ := TopologicalDivisionRing.mk
this : TopologicalRing ↥(Subfield.topologicalClosure K) :=
  Subring.instTopologicalRing (Subfield.topologicalClosure K).toSubring
ι : ↥K → ↥(Subfield.topologicalClosure K) := ⇑(Subfield.inclusion (_ : K ≤ Subfield.topologicalClosure K))
ui : UniformInducing ι
di : DenseInducing ι := UniformInducing.denseInducing ui ?refine_1
extψ : ↥(Subfield.topologicalClosure K) →+* ℂ := DenseInducing.extendRingHom ui (_ : DenseRange ι) hc
hψ : Continuous (DenseInducing.extend (_ : DenseInducing ι) ⇑ψ)
h✝ : Subfield.topologicalClosure K = ⊤
ψ₁ : ℂ →+* ℂ :=
  RingHom.comp extψ
    (RingHom.comp (RingEquiv.toRingHom (RingEquiv.symm (RingEquiv.subfieldCongr h✝)))
      (RingEquiv.toRingHom (RingEquiv.symm Subfield.topEquiv)))
hψ₁ : Continuous ⇑ψ₁
h : ψ₁ = RingHom.id ℂ
z : ↥K
⊢ OneHom.toFun (↑↑ψ) z = (Subfield.subtype K) z

Next tactic:
convert RingHom.congr_fun h z using 1