Theorem: Complex.subfield_eq_of_closed
File: Mathlib/Topology/Instances/Complex.lean

tactic: suffices range (ofReal' : ℝ → ℂ) ⊆ K by
  rw [range_subset_iff, ← coe_algebraMap] at this
  have :=
    (Subalgebra.isSimpleOrder_of_finrank finrank_real_complex).eq_bot_or_eq_top
      (Subfield.toIntermediateField K this).toSubalgebra
  simp_rw [← SetLike.coe_set_eq] at this⊢
  convert this using 2
  simp only [RingHom.coe_fieldRange, Algebra.coe_bot, coe_algebraMap]
  rfl
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ K = RingHom.fieldRange ofReal ∨ K = ⊤

tactic: suffices range (ofReal' : ℝ → ℂ) ⊆ closure (Set.range ((ofReal' : ℝ → ℂ) ∘ ((↑) : ℚ → ℝ))) by
  refine' subset_trans this _
  rw [← IsClosed.closure_eq hc]
  apply closure_mono
  rintro _ ⟨_, rfl⟩
  simp only [Function.comp_apply, ofReal_rat_cast, SetLike.mem_coe, SubfieldClass.coe_rat_mem]
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ ↑K

tactic: nth_rw 1 [range_comp]
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))

tactic: refine' subset_trans _ (image_closure_subset_closure_image continuous_ofReal)
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ closure (ofReal' '' range Rat.cast)

tactic: rw [DenseRange.closure_range Rat.denseEmbedding_coe_real.dense]
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ ofReal' '' closure (range Rat.cast)

tactic: simp only [image_univ]
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ ofReal' '' univ

tactic: rfl
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ range ofReal'

tactic: rw [range_subset_iff, ← coe_algebraMap] at this
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ ↑K
⊢ K = RingHom.fieldRange ofReal ∨ K = ⊤

tactic: have :=
  (Subalgebra.isSimpleOrder_of_finrank finrank_real_complex).eq_bot_or_eq_top
    (Subfield.toIntermediateField K this).toSubalgebra
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this : ∀ (y : ℝ), ↑(algebraMap ℝ ℂ) y ∈ ↑K
⊢ K = RingHom.fieldRange ofReal ∨ K = ⊤

tactic: simp_rw [← SetLike.coe_set_eq] at this⊢
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this✝ : ∀ (y : ℝ), ↑(algebraMap ℝ ℂ) y ∈ ↑K
this : (Subfield.toIntermediateField K this✝).toSubalgebra = ⊥ ∨ (Subfield.toIntermediateField K this✝).toSubalgebra = ⊤
⊢ K = RingHom.fieldRange ofReal ∨ K = ⊤

tactic: convert this using 2
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this✝ : ∀ (y : ℝ), ↑(algebraMap ℝ ℂ) y ∈ ↑K
this :
  ↑(Subfield.toIntermediateField K this✝).toSubalgebra = ↑⊥ ∨ ↑(Subfield.toIntermediateField K this✝).toSubalgebra = ↑⊤
⊢ ↑K = ↑(RingHom.fieldRange ofReal) ∨ ↑K = ↑⊤

tactic: simp only [RingHom.coe_fieldRange, Algebra.coe_bot, coe_algebraMap]
state_before: case h.e'_1.h.e'_3
K : Subfield ℂ
hc : IsClosed ↑K
this✝ : ∀ (y : ℝ), ↑(algebraMap ℝ ℂ) y ∈ ↑K
this :
  ↑(Subfield.toIntermediateField K this✝).toSubalgebra = ↑⊥ ∨ ↑(Subfield.toIntermediateField K this✝).toSubalgebra = ↑⊤
⊢ ↑(RingHom.fieldRange ofReal) = ↑⊥

tactic: rfl
state_before: case h.e'_1.h.e'_3
K : Subfield ℂ
hc : IsClosed ↑K
this✝ : ∀ (y : ℝ), ↑(algebraMap ℝ ℂ) y ∈ ↑K
this :
  ↑(Subfield.toIntermediateField K this✝).toSubalgebra = ↑⊥ ∨ ↑(Subfield.toIntermediateField K this✝).toSubalgebra = ↑⊤
⊢ range ↑ofReal = range ofReal'

tactic: refine' subset_trans this _
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ range ofReal' ⊆ ↑K

tactic: rw [← IsClosed.closure_eq hc]
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ closure (range (ofReal' ∘ Rat.cast)) ⊆ ↑K

tactic: apply closure_mono
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ closure (range (ofReal' ∘ Rat.cast)) ⊆ closure ↑K

tactic: rintro _ ⟨_, rfl⟩
state_before: case h
K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ range (ofReal' ∘ Rat.cast) ⊆ ↑K

tactic: simp only [Function.comp_apply, ofReal_rat_cast, SetLike.mem_coe, SubfieldClass.coe_rat_mem]
state_before: case h.intro
K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
w✝ : ℚ
⊢ (ofReal' ∘ Rat.cast) w✝ ∈ ↑K