Theorem: polynomialFunctions_closure_eq_top
File: Mathlib/Topology/ContinuousFunction/Weierstrass.lean

tactic: by_cases h : a < b
state_before: a b : ℝ
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: let W : C(Set.Icc a b, ℝ) →ₐ[ℝ] C(I, ℝ) :=
  compRightAlgHom ℝ ℝ (iccHomeoI a b h).symm.toContinuousMap
state_before: case pos
a b : ℝ
h : a < b
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: let W' : C(Set.Icc a b, ℝ) ≃ₜ C(I, ℝ) := compRightHomeomorph ℝ (iccHomeoI a b h).symm
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: have w : (W : C(Set.Icc a b, ℝ) → C(I, ℝ)) = W' := rfl
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
W' : C(↑(Set.Icc a b), ℝ) ≃ₜ C(↑I, ℝ) := compRightHomeomorph ℝ (Homeomorph.symm (iccHomeoI a b h))
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: have p := polynomialFunctions_closure_eq_top'
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
W' : C(↑(Set.Icc a b), ℝ) ≃ₜ C(↑I, ℝ) := compRightHomeomorph ℝ (Homeomorph.symm (iccHomeoI a b h))
w : ↑W = ↑W'
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: apply_fun fun s => s.comap W at p
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
W' : C(↑(Set.Icc a b), ℝ) ≃ₜ C(↑I, ℝ) := compRightHomeomorph ℝ (Homeomorph.symm (iccHomeoI a b h))
w : ↑W = ↑W'
p : Subalgebra.topologicalClosure (polynomialFunctions I) = ⊤
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: simp only [Algebra.comap_top] at p
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
W' : C(↑(Set.Icc a b), ℝ) ≃ₜ C(↑I, ℝ) := compRightHomeomorph ℝ (Homeomorph.symm (iccHomeoI a b h))
w : ↑W = ↑W'
p : Subalgebra.comap W (Subalgebra.topologicalClosure (polynomialFunctions I)) = Subalgebra.comap W ⊤
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: rw [Subalgebra.topologicalClosure_comap_homeomorph _ W W' w] at p
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
W' : C(↑(Set.Icc a b), ℝ) ≃ₜ C(↑I, ℝ) := compRightHomeomorph ℝ (Homeomorph.symm (iccHomeoI a b h))
w : ↑W = ↑W'
p :
  Subalgebra.comap (compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h))))
      (Subalgebra.topologicalClosure (polynomialFunctions I)) =
    ⊤
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: rw [polynomialFunctions.comap_compRightAlgHom_iccHomeoI] at p
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
W' : C(↑(Set.Icc a b), ℝ) ≃ₜ C(↑I, ℝ) := compRightHomeomorph ℝ (Homeomorph.symm (iccHomeoI a b h))
w : ↑W = ↑W'
p : Subalgebra.topologicalClosure (Subalgebra.comap W (polynomialFunctions I)) = ⊤
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: exact p
state_before: case pos
a b : ℝ
h : a < b
W : C(↑(Set.Icc a b), ℝ) →ₐ[ℝ] C(↑I, ℝ) :=
  compRightAlgHom ℝ ℝ (Homeomorph.toContinuousMap (Homeomorph.symm (iccHomeoI a b h)))
W' : C(↑(Set.Icc a b), ℝ) ≃ₜ C(↑I, ℝ) := compRightHomeomorph ℝ (Homeomorph.symm (iccHomeoI a b h))
w : ↑W = ↑W'
p : Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: haveI : Subsingleton (Set.Icc a b) :=
  ⟨fun x y =>
    le_antisymm ((x.2.2.trans (not_lt.mp h)).trans y.2.1)
      ((y.2.2.trans (not_lt.mp h)).trans x.2.1)⟩
state_before: case neg
a b : ℝ
h : ¬a < b
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤

tactic: apply Subsingleton.elim
state_before: case neg
a b : ℝ
h : ¬a < b
this : Subsingleton ↑(Set.Icc a b)
⊢ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc a b)) = ⊤