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, IntermediateField.coe_toSubalgebra] at this ⊢
  exact this
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ K = ofReal.fieldRange ∨ K = ⊤
state_after: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range 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_ratCast, SetLike.mem_coe, SubfieldClass.ratCast_mem]
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ ↑K
state_after: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))

tactic: nth_rw 1 [range_comp]
state_before: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
state_after: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ closure (ofReal' '' range 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)
state_after: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ ofReal' '' closure (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)
state_after: K : Subfield ℂ
hc : IsClosed ↑K
⊢ range ofReal' ⊆ ofReal' '' univ

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

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

tactic: rw [range_subset_iff, ← coe_algebraMap] at this
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ ↑K
⊢ K = ofReal.fieldRange ∨ K = ⊤
state_after: K : Subfield ℂ
hc : IsClosed ↑K
this : ∀ (y : ℝ), (algebraMap ℝ ℂ) y ∈ ↑K
⊢ K = ofReal.fieldRange ∨ 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 = ofReal.fieldRange ∨ K = ⊤
state_after: K : Subfield ℂ
hc : IsClosed ↑K
this✝ : ∀ (y : ℝ), (algebraMap ℝ ℂ) y ∈ ↑K
this : (K.toIntermediateField this✝).toSubalgebra = ⊥ ∨ (K.toIntermediateField this✝).toSubalgebra = ⊤
⊢ K = ofReal.fieldRange ∨ K = ⊤

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

tactic: exact this
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this✝ : ∀ (y : ℝ), (algebraMap ℝ ℂ) y ∈ ↑K
this : ↑(K.toIntermediateField this✝) = ↑⊥ ∨ ↑(K.toIntermediateField this✝) = ↑⊤
⊢ ↑K = ↑ofReal.fieldRange ∨ ↑K = ↑⊤
state_after: no goals

tactic: refine subset_trans this ?_
state_before: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ range ofReal' ⊆ ↑K
state_after: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ closure (range (ofReal' ∘ Rat.cast)) ⊆ ↑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
state_after: K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ closure (range (ofReal' ∘ Rat.cast)) ⊆ closure ↑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
state_after: case h
K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
⊢ range (ofReal' ∘ Rat.cast) ⊆ ↑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
state_after: case h.intro
K : Subfield ℂ
hc : IsClosed ↑K
this : range ofReal' ⊆ closure (range (ofReal' ∘ Rat.cast))
w✝ : ℚ
⊢ (ofReal' ∘ Rat.cast) w✝ ∈ ↑K

tactic: simp only [Function.comp_apply, ofReal_ratCast, SetLike.mem_coe, SubfieldClass.ratCast_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
state_after: no goals