[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
g : ℝ[X]
⊢ comp (Polynomial.toContinuousMapOn g (Set.Icc (-‖f‖) ‖f‖)) (attachBound ↑f) = ↑(↑(Polynomial.aeval f) g)
[PROOFSTEP]
ext
[GOAL]
case h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
g : ℝ[X]
a✝ : X
⊢ ↑(comp (Polynomial.toContinuousMapOn g (Set.Icc (-‖f‖) ‖f‖)) (attachBound ↑f)) a✝ = ↑↑(↑(Polynomial.aeval f) g) a✝
[PROOFSTEP]
simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe,
  Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply,
  Polynomial.toContinuousMap_apply]
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
g : ℝ[X]
⊢ comp (Polynomial.toContinuousMapOn g (Set.Icc (-‖f‖) ‖f‖)) (attachBound ↑f) ∈ A
[PROOFSTEP]
rw [polynomial_comp_attachBound]
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
g : ℝ[X]
⊢ ↑(↑(Polynomial.aeval f) g) ∈ A
[PROOFSTEP]
apply SetLike.coe_mem
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)
⊢ comp p (attachBound ↑f) ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure :=
  continuousMap_mem_polynomialFunctions_closure _ _ p
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)
mem_closure : p ∈ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
⊢ comp p (attachBound ↑f) ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)
mem_closure : p ∈ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
frequently_mem_polynomials :
  ∃ᶠ (x : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)) in nhds p, x ∈ ↑(polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
⊢ comp p (attachBound ↑f) ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
apply mem_closure_iff_frequently.mpr
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)
mem_closure : p ∈ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
frequently_mem_polynomials :
  ∃ᶠ (x : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)) in nhds p, x ∈ ↑(polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
⊢ ∃ᶠ (x : C(X, ℝ)) in nhds (comp p (attachBound ↑f)), x ∈ ↑A
[PROOFSTEP]
refine'
  ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ _
    frequently_mem_polynomials
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)
mem_closure : p ∈ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
frequently_mem_polynomials :
  ∃ᶠ (x : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)) in nhds p, x ∈ ↑(polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
⊢ ∀ (x : C(↑(Set.Icc (-‖↑f‖) ‖↑f‖), ℝ)),
    x ∈ ↑(polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)) → ↑(compRightContinuousMap ℝ (attachBound ↑f)) x ∈ ↑A
[PROOFSTEP]
rintro _ ⟨g, ⟨-, rfl⟩⟩
[GOAL]
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)
mem_closure : p ∈ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
frequently_mem_polynomials :
  ∃ᶠ (x : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)) in nhds p, x ∈ ↑(polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
g : ℝ[X]
⊢ ↑(compRightContinuousMap ℝ (attachBound ↑f)) (↑↑(Polynomial.toContinuousMapOnAlgHom (Set.Icc (-‖f‖) ‖f‖)) g) ∈ ↑A
[PROOFSTEP]
simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply,
  Polynomial.toContinuousMapOnAlgHom_apply]
[GOAL]
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)
mem_closure : p ∈ Subalgebra.topologicalClosure (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
frequently_mem_polynomials :
  ∃ᶠ (x : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ)) in nhds p, x ∈ ↑(polynomialFunctions (Set.Icc (-‖f‖) ‖f‖))
g : ℝ[X]
⊢ comp (Polynomial.toContinuousMapOn g (Set.Icc (-‖f‖) ‖f‖)) (attachBound ↑f) ∈ A
[PROOFSTEP]
apply polynomial_comp_attachBound_mem
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
⊢ abs ↑f ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
let f' := attachBound (f : C(X, ℝ))
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
f' : C(X, ↑(Set.Icc (-‖↑f‖) ‖↑f‖)) := attachBound ↑f
⊢ abs ↑f ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| }
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
f' : C(X, ↑(Set.Icc (-‖↑f‖) ‖↑f‖)) := attachBound ↑f
abs : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ) := mk fun x => |↑x|
⊢ ContinuousMap.abs ↑f ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
change abs.comp f' ∈ A.topologicalClosure
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f : { x // x ∈ A }
f' : C(X, ↑(Set.Icc (-‖↑f‖) ‖↑f‖)) := attachBound ↑f
abs : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ) := mk fun x => |↑x|
⊢ comp abs f' ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
apply comp_attachBound_mem_closure
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f g : { x // x ∈ A }
⊢ ↑f ⊓ ↑g ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
rw [inf_eq_half_smul_add_sub_abs_sub' ℝ]
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f g : { x // x ∈ A }
⊢ 2⁻¹ • (↑f + ↑g - |↑g - ↑f|) ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
refine'
  A.topologicalClosure.smul_mem
    (A.topologicalClosure.sub_mem
      (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) _)
    _
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f g : { x // x ∈ A }
⊢ |↑g - ↑f| ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
exact_mod_cast abs_mem_subalgebra_closure A _
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ ↑f ⊓ ↑g ∈ A
[PROOFSTEP]
convert inf_mem_subalgebra_closure A f g
[GOAL]
case h.e'_5
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ A = Subalgebra.topologicalClosure A
[PROOFSTEP]
apply SetLike.ext'
[GOAL]
case h.e'_5.h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ ↑A = ↑(Subalgebra.topologicalClosure A)
[PROOFSTEP]
symm
[GOAL]
case h.e'_5.h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ ↑(Subalgebra.topologicalClosure A) = ↑A
[PROOFSTEP]
erw [closure_eq_iff_isClosed]
[GOAL]
case h.e'_5.h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ IsClosed ↑A
[PROOFSTEP]
exact h
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f g : { x // x ∈ A }
⊢ ↑f ⊔ ↑g ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
rw [sup_eq_half_smul_add_add_abs_sub' ℝ]
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f g : { x // x ∈ A }
⊢ 2⁻¹ • (↑f + ↑g + |↑g - ↑f|) ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
refine'
  A.topologicalClosure.smul_mem
    (A.topologicalClosure.add_mem
      (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) _)
    _
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
f g : { x // x ∈ A }
⊢ |↑g - ↑f| ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
exact_mod_cast abs_mem_subalgebra_closure A _
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ ↑f ⊔ ↑g ∈ A
[PROOFSTEP]
convert sup_mem_subalgebra_closure A f g
[GOAL]
case h.e'_5
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ A = Subalgebra.topologicalClosure A
[PROOFSTEP]
apply SetLike.ext'
[GOAL]
case h.e'_5.h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ ↑A = ↑(Subalgebra.topologicalClosure A)
[PROOFSTEP]
symm
[GOAL]
case h.e'_5.h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ ↑(Subalgebra.topologicalClosure A) = ↑A
[PROOFSTEP]
erw [closure_eq_iff_isClosed]
[GOAL]
case h.e'_5.h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
h : IsClosed ↑A
f g : { x // x ∈ A }
⊢ IsClosed ↑A
[PROOFSTEP]
exact h
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
⊢ closure L = ⊤
[PROOFSTEP]
apply eq_top_iff.mpr
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
⊢ ⊤ ≤ closure L
[PROOFSTEP]
rintro f -
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
⊢ f ∈ closure L
[PROOFSTEP]
refine' Filter.Frequently.mem_closure ((Filter.HasBasis.frequently_iff Metric.nhds_basis_ball).mpr fun ε pos => _)
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
⊢ ∃ x, x ∈ Metric.ball f ε ∧ x ∈ L
[PROOFSTEP]
simp only [exists_prop, Metric.mem_ball]
  -- It will be helpful to assume `X` is nonempty later,
    -- so we get that out of the way here.
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
by_cases nX : Nonempty X
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
⊢ ∃ x, dist x f < ε ∧ x ∈ L
case neg
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : ¬Nonempty X
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
swap
[GOAL]
case neg
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : ¬Nonempty X
⊢ ∃ x, dist x f < ε ∧ x ∈ L
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
exact
  ⟨nA.some, (dist_lt_iff pos).mpr fun x => False.elim (nX ⟨x⟩), nA.choose_spec⟩
    /-
        The strategy now is to pick a family of continuous functions `g x y` in `A`
        with the property that `g x y x = f x` and `g x y y = f y`
        (this is immediate from `h : SeparatesPointsStrongly`)
        then use continuity to see that `g x y` is close to `f` near both `x` and `y`,
        and finally using compactness to produce the desired function `h`
        as a maximum over finitely many `x` of a minimum over finitely many `y` of the `g x y`.
        -/
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : Set.SeparatesPointsStrongly L
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
dsimp only [Set.SeparatesPointsStrongly] at sep 
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
choose g hg w₁ w₂ using sep f
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let U : X → X → Set X := fun x y => {z | f z - ε < g x y z}
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
have U_nhd_y : ∀ x y, U x y ∈ 𝓝 y := by
  intro x y
  refine' IsOpen.mem_nhds _ _
  · apply isOpen_lt <;> continuity
  · rw [Set.mem_setOf_eq, w₂]
    exact sub_lt_self _ pos
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
⊢ ∀ (x y : X), U x y ∈ 𝓝 y
[PROOFSTEP]
intro x y
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
x y : X
⊢ U x y ∈ 𝓝 y
[PROOFSTEP]
refine' IsOpen.mem_nhds _ _
[GOAL]
case refine'_1
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
x y : X
⊢ IsOpen (U x y)
[PROOFSTEP]
apply isOpen_lt
[GOAL]
case refine'_1.hf
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
x y : X
⊢ Continuous fun b => ↑f b - ε
[PROOFSTEP]
continuity
[GOAL]
case refine'_1.hg
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
x y : X
⊢ Continuous fun b => ↑(g x y) b
[PROOFSTEP]
continuity
[GOAL]
case refine'_2
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
x y : X
⊢ y ∈ U x y
[PROOFSTEP]
rw [Set.mem_setOf_eq, w₂]
[GOAL]
case refine'_2
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
x y : X
⊢ ↑f y - ε < ↑f y
[PROOFSTEP]
exact sub_lt_self _ pos
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let ys : ∀ _, Finset X := fun x => (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x)).choose
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let ys_w : ∀ x, ⋃ y ∈ ys x, U x y = ⊤ := fun x => (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x)).choose_spec
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
have ys_nonempty : ∀ x, (ys x).Nonempty := fun x =>
  Set.nonempty_of_union_eq_top_of_nonempty _ _ nX
    (ys_w x)
      -- Thus for each `x` we have the desired `h x : A` so `f z - ε < h x z` everywhere
        -- and `h x x = f x`.
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let h : ∀ _, L := fun x =>
  ⟨(ys x).sup' (ys_nonempty x) fun y => (g x y : C(X, ℝ)), Finset.sup'_mem _ sup_mem _ _ _ fun y _ => hg x y⟩
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
have lt_h : ∀ x z, f z - ε < (h x : X → ℝ) z := by
  intro x z
  obtain ⟨y, ym, zm⟩ := Set.exists_set_mem_of_union_eq_top _ _ (ys_w x) z
  dsimp
  simp only [Subtype.coe_mk, sup'_coe, Finset.sup'_apply, Finset.lt_sup'_iff]
  exact ⟨y, ym, zm⟩
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
⊢ ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
[PROOFSTEP]
intro x z
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
x z : X
⊢ ↑f z - ε < ↑↑(h x) z
[PROOFSTEP]
obtain ⟨y, ym, zm⟩ := Set.exists_set_mem_of_union_eq_top _ _ (ys_w x) z
[GOAL]
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
x z y : X
ym : y ∈ fun i => i ∈ (ys x).val
zm : z ∈ U x y
⊢ ↑f z - ε < ↑↑(h x) z
[PROOFSTEP]
dsimp
[GOAL]
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
x z y : X
ym : y ∈ fun i => i ∈ (ys x).val
zm : z ∈ U x y
⊢ ↑f z - ε <
    ↑(Finset.sup' (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
          (_ : Finset.Nonempty (ys x)) fun y => g x y)
      z
[PROOFSTEP]
simp only [Subtype.coe_mk, sup'_coe, Finset.sup'_apply, Finset.lt_sup'_iff]
[GOAL]
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
x z y : X
ym : y ∈ fun i => i ∈ (ys x).val
zm : z ∈ U x y
⊢ ∃ b, b ∈ Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤) ∧ ↑f z - ε < ↑(g x b) z
[PROOFSTEP]
exact ⟨y, ym, zm⟩
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
have h_eq : ∀ x, (h x : X → ℝ) x = f x := by intro x;
  simp [w₁]
    -- For each `x`, we define `W x` to be `{z | h x z < f z + ε}`,
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
⊢ ∀ (x : X), ↑↑(h x) x = ↑f x
[PROOFSTEP]
intro x
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
x : X
⊢ ↑↑(h x) x = ↑f x
[PROOFSTEP]
simp [w₁]
  -- For each `x`, we define `W x` to be `{z | h x z < f z + ε}`,
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let W : ∀ _, Set X := fun x =>
  {z | (h x : X → ℝ) z < f z + ε}
    -- This is still a neighbourhood of `x`.
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
have W_nhd : ∀ x, W x ∈ 𝓝 x := by
  intro x
  refine' IsOpen.mem_nhds _ _
  ·
    -- Porting note: mathlib3 `continuity` found `continuous_set_coe`
    apply isOpen_lt (continuous_set_coe _ _)
    continuity
  · dsimp only [Set.mem_setOf_eq]
    rw [h_eq]
    exact lt_add_of_pos_right _ pos
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
⊢ ∀ (x : X), W x ∈ 𝓝 x
[PROOFSTEP]
intro x
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
x : X
⊢ W x ∈ 𝓝 x
[PROOFSTEP]
refine' IsOpen.mem_nhds _ _
[GOAL]
case refine'_1
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
x : X
⊢ IsOpen (W x)
[PROOFSTEP]
apply isOpen_lt (continuous_set_coe _ _)
[GOAL]
case refine'_1
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
x : X
⊢ Continuous fun b => ↑f b + ε
[PROOFSTEP]
continuity
[GOAL]
case refine'_2
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
x : X
⊢ x ∈ W x
[PROOFSTEP]
dsimp only [Set.mem_setOf_eq]
[GOAL]
case refine'_2
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
x : X
⊢ ↑(Finset.sup' (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
          (_ : Finset.Nonempty (ys x)) fun y => g x y)
      x <
    ↑f x + ε
[PROOFSTEP]
rw [h_eq]
[GOAL]
case refine'_2
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
x : X
⊢ ↑f x < ↑f x + ε
[PROOFSTEP]
exact lt_add_of_pos_right _ pos
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let xs : Finset X := (CompactSpace.elim_nhds_subcover W W_nhd).choose
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let xs_w : ⋃ x ∈ xs, W x = ⊤ := (CompactSpace.elim_nhds_subcover W W_nhd).choose_spec
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
have xs_nonempty : xs.Nonempty := Set.nonempty_of_union_eq_top_of_nonempty _ _ nX xs_w
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
let k : (L : Type _) :=
  ⟨xs.inf' xs_nonempty fun x => (h x : C(X, ℝ)), Finset.inf'_mem _ inf_mem _ _ _ fun x _ => (h x).2⟩
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
⊢ ∃ x, dist x f < ε ∧ x ∈ L
[PROOFSTEP]
refine'
  ⟨k.1, _, k.2⟩
    -- We just need to verify the bound, which we do pointwise.
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
⊢ dist (↑k) f < ε
[PROOFSTEP]
rw [dist_lt_iff pos]
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
⊢ ∀ (x : X), dist (↑↑k x) (↑f x) < ε
[PROOFSTEP]
intro z
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ dist (↑↑k z) (↑f z) < ε
[PROOFSTEP]
rw [show ∀ a b ε : ℝ, dist a b < ε ↔ a < b + ε ∧ b - ε < a by intros;
    simp only [← Metric.mem_ball, Real.ball_eq_Ioo, Set.mem_Ioo, and_comm]]
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ∀ (a b ε : ℝ), dist a b < ε ↔ a < b + ε ∧ b - ε < a
[PROOFSTEP]
intros
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
a✝ b✝ ε✝ : ℝ
⊢ dist a✝ b✝ < ε✝ ↔ a✝ < b✝ + ε✝ ∧ b✝ - ε✝ < a✝
[PROOFSTEP]
simp only [← Metric.mem_ball, Real.ball_eq_Ioo, Set.mem_Ioo, and_comm]
[GOAL]
case pos
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ↑↑k z < ↑f z + ε ∧ ↑f z - ε < ↑↑k z
[PROOFSTEP]
fconstructor
[GOAL]
case pos.left
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ↑↑k z < ↑f z + ε
[PROOFSTEP]
dsimp
[GOAL]
case pos.left
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ↑(Finset.inf'
          (Exists.choose
            (_ :
              ∃ t,
                ⋃ (x : X) (_ : x ∈ t),
                    {z |
                      ↑(Finset.sup'
                              (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
                              (_ : Finset.Nonempty (ys x)) fun y => g x y)
                          z <
                        ↑f z + ε} =
                  ⊤))
          xs_nonempty fun x =>
          Finset.sup' (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
            (_ : Finset.Nonempty (ys x)) fun y => g x y)
      z <
    ↑f z + ε
[PROOFSTEP]
simp only [Finset.inf'_lt_iff, ContinuousMap.inf'_apply]
[GOAL]
case pos.left
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ∃ i,
    i ∈
        Exists.choose
          (_ :
            ∃ t,
              ⋃ (x : X) (_ : x ∈ t),
                  {z |
                    ↑(Finset.sup'
                            (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
                            (_ : Finset.Nonempty (ys x)) fun y => g x y)
                        z <
                      ↑f z + ε} =
                ⊤) ∧
      ↑(Finset.sup' (Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), {z | ↑f z - ε < ↑(g i x) z} = ⊤))
              (_ : Finset.Nonempty (ys i)) fun y => g i y)
          z <
        ↑f z + ε
[PROOFSTEP]
exact Set.exists_set_mem_of_union_eq_top _ _ xs_w z
[GOAL]
case pos.right
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ↑f z - ε < ↑↑k z
[PROOFSTEP]
dsimp
[GOAL]
case pos.right
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ↑f z - ε <
    ↑(Finset.inf'
          (Exists.choose
            (_ :
              ∃ t,
                ⋃ (x : X) (_ : x ∈ t),
                    {z |
                      ↑(Finset.sup'
                              (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
                              (_ : Finset.Nonempty (ys x)) fun y => g x y)
                          z <
                        ↑f z + ε} =
                  ⊤))
          xs_nonempty fun x =>
          Finset.sup' (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
            (_ : Finset.Nonempty (ys x)) fun y => g x y)
      z
[PROOFSTEP]
simp only [Finset.lt_inf'_iff, ContinuousMap.inf'_apply]
[GOAL]
case pos.right
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z : X
⊢ ∀ (i : X),
    i ∈
        Exists.choose
          (_ :
            ∃ t,
              ⋃ (x : X) (_ : x ∈ t),
                  {z |
                    ↑(Finset.sup'
                            (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
                            (_ : Finset.Nonempty (ys x)) fun y => g x y)
                        z <
                      ↑f z + ε} =
                ⊤) →
      ↑f z - ε <
        ↑(Finset.sup' (Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), {z | ↑f z - ε < ↑(g i x) z} = ⊤))
              (_ : Finset.Nonempty (ys i)) fun y => g i y)
          z
[PROOFSTEP]
rintro x -
[GOAL]
case pos.right
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
L : Set C(X, ℝ)
nA : Set.Nonempty L
inf_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊓ g ∈ L
sup_mem : ∀ (f : C(X, ℝ)), f ∈ L → ∀ (g : C(X, ℝ)), g ∈ L → f ⊔ g ∈ L
sep : ∀ (v : X → ℝ) (x y : X), ∃ f, f ∈ L ∧ ↑f x = v x ∧ ↑f y = v y
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
nX : Nonempty X
g : X → X → C(X, ℝ)
hg : ∀ (x y : X), g x y ∈ L
w₁ : ∀ (x y : X), ↑(g x y) x = ↑f x
w₂ : ∀ (x y : X), ↑(g x y) y = ↑f y
U : X → X → Set X := fun x y => {z | ↑f z - ε < ↑(g x y) z}
U_nhd_y : ∀ (x y : X), U x y ∈ 𝓝 y
ys : X → Finset X := fun x => Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), U x x_1 = ⊤)
ys_w : ∀ (x : X), ⋃ (y : X) (_ : y ∈ ys x), U x y = ⊤ :=
  fun x => Exists.choose_spec (CompactSpace.elim_nhds_subcover (U x) (U_nhd_y x))
ys_nonempty : ∀ (x : X), Finset.Nonempty (ys x)
h : X → ↑L :=
  fun x =>
    { val := Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y,
      property := (_ : (Finset.sup' (ys x) (_ : Finset.Nonempty (ys x)) fun y => g x y) ∈ L) }
lt_h : ∀ (x z : X), ↑f z - ε < ↑↑(h x) z
h_eq : ∀ (x : X), ↑↑(h x) x = ↑f x
W : X → Set X := fun x => {z | ↑↑(h x) z < ↑f z + ε}
W_nhd : ∀ (x : X), W x ∈ 𝓝 x
xs : Finset X := Exists.choose (_ : ∃ t, ⋃ (x : X) (_ : x ∈ t), W x = ⊤)
xs_w : ⋃ (x : X) (_ : x ∈ xs), W x = ⊤ := Exists.choose_spec (CompactSpace.elim_nhds_subcover W W_nhd)
xs_nonempty : Finset.Nonempty xs
k : ↑L :=
  { val := Finset.inf' xs xs_nonempty fun x => ↑(h x),
    property := (_ : (Finset.inf' xs xs_nonempty fun x => ↑(h x)) ∈ L) }
z x : X
⊢ ↑f z - ε <
    ↑(Finset.sup' (Exists.choose (_ : ∃ t, ⋃ (x_1 : X) (_ : x_1 ∈ t), {z | ↑f z - ε < ↑(g x x_1) z} = ⊤))
          (_ : Finset.Nonempty (ys x)) fun y => g x y)
      z
[PROOFSTEP]
apply lt_h
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
⊢ Subalgebra.topologicalClosure A = ⊤
[PROOFSTEP]
apply SetLike.ext'
[GOAL]
case h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
⊢ ↑(Subalgebra.topologicalClosure A) = ↑⊤
[PROOFSTEP]
let L := A.topologicalClosure
[GOAL]
case h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
L : Subalgebra ℝ C(X, ℝ) := Subalgebra.topologicalClosure A
⊢ ↑(Subalgebra.topologicalClosure A) = ↑⊤
[PROOFSTEP]
have n : Set.Nonempty (L : Set C(X, ℝ)) := ⟨(1 : C(X, ℝ)), A.le_topologicalClosure A.one_mem⟩
[GOAL]
case h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
L : Subalgebra ℝ C(X, ℝ) := Subalgebra.topologicalClosure A
n : Set.Nonempty ↑L
⊢ ↑(Subalgebra.topologicalClosure A) = ↑⊤
[PROOFSTEP]
convert
  sublattice_closure_eq_top (L : Set C(X, ℝ)) n
    (fun f fm g gm => inf_mem_closed_subalgebra L A.isClosed_topologicalClosure ⟨f, fm⟩ ⟨g, gm⟩)
    (fun f fm g gm => sup_mem_closed_subalgebra L A.isClosed_topologicalClosure ⟨f, fm⟩ ⟨g, gm⟩)
    (Subalgebra.SeparatesPoints.strongly (Subalgebra.separatesPoints_monotone A.le_topologicalClosure w))
[GOAL]
case h.e'_2
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
L : Subalgebra ℝ C(X, ℝ) := Subalgebra.topologicalClosure A
n : Set.Nonempty ↑L
⊢ ↑(Subalgebra.topologicalClosure A) = closure ↑L
[PROOFSTEP]
simp
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
f : C(X, ℝ)
⊢ f ∈ Subalgebra.topologicalClosure A
[PROOFSTEP]
rw [subalgebra_topologicalClosure_eq_top_of_separatesPoints A w]
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
f : C(X, ℝ)
⊢ f ∈ ⊤
[PROOFSTEP]
simp
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
⊢ ∃ g, ‖↑g - f‖ < ε
[PROOFSTEP]
have w := mem_closure_iff_frequently.mp (continuousMap_mem_subalgebra_closure_of_separatesPoints A w f)
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w✝ : Subalgebra.SeparatesPoints A
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
w : ∃ᶠ (x : C(X, ℝ)) in 𝓝 f, x ∈ ↑A
⊢ ∃ g, ‖↑g - f‖ < ε
[PROOFSTEP]
rw [Metric.nhds_basis_ball.frequently_iff] at w 
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w✝ : Subalgebra.SeparatesPoints A
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
w : ∀ (i : ℝ), 0 < i → ∃ x, x ∈ Metric.ball f i ∧ x ∈ ↑A
⊢ ∃ g, ‖↑g - f‖ < ε
[PROOFSTEP]
obtain ⟨g, H, m⟩ := w ε pos
[GOAL]
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w✝ : Subalgebra.SeparatesPoints A
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
w : ∀ (i : ℝ), 0 < i → ∃ x, x ∈ Metric.ball f i ∧ x ∈ ↑A
g : C(X, ℝ)
H : g ∈ Metric.ball f ε
m : g ∈ ↑A
⊢ ∃ g, ‖↑g - f‖ < ε
[PROOFSTEP]
rw [Metric.mem_ball, dist_eq_norm] at H 
[GOAL]
case intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w✝ : Subalgebra.SeparatesPoints A
f : C(X, ℝ)
ε : ℝ
pos : 0 < ε
w : ∀ (i : ℝ), 0 < i → ∃ x, x ∈ Metric.ball f i ∧ x ∈ ↑A
g : C(X, ℝ)
H : ‖g - f‖ < ε
m : g ∈ ↑A
⊢ ∃ g, ‖↑g - f‖ < ε
[PROOFSTEP]
exact ⟨⟨g, m⟩, H⟩
[GOAL]
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
f : X → ℝ
c : Continuous f
ε : ℝ
pos : 0 < ε
⊢ ∃ g, ∀ (x : X), ‖↑↑g x - f x‖ < ε
[PROOFSTEP]
obtain ⟨g, b⟩ := exists_mem_subalgebra_near_continuousMap_of_separatesPoints A w ⟨f, c⟩ ε pos
[GOAL]
case intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
f : X → ℝ
c : Continuous f
ε : ℝ
pos : 0 < ε
g : { x // x ∈ A }
b : ‖↑g - mk f‖ < ε
⊢ ∃ g, ∀ (x : X), ‖↑↑g x - f x‖ < ε
[PROOFSTEP]
use g
[GOAL]
case h
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : Subalgebra ℝ C(X, ℝ)
w : Subalgebra.SeparatesPoints A
f : X → ℝ
c : Continuous f
ε : ℝ
pos : 0 < ε
g : { x // x ∈ A }
b : ‖↑g - mk f‖ < ε
⊢ ∀ (x : X), ‖↑↑g x - f x‖ < ε
[PROOFSTEP]
rwa [norm_lt_iff _ pos] at b 
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
⊢ SeparatesPoints
    (comap (AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (restrictScalars ℝ A.toSubalgebra))
[PROOFSTEP]
intro x₁ x₂ hx
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
⊢ ∃ f,
    f ∈
        (fun f => ↑f) ''
          ↑(comap (AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (restrictScalars ℝ A.toSubalgebra)) ∧
      f x₁ ≠ f x₂
[PROOFSTEP]
obtain ⟨_, ⟨f, hfA, rfl⟩, hf⟩ := hA hx
[GOAL]
case intro.intro.intro.intro
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
⊢ ∃ f,
    f ∈
        (fun f => ↑f) ''
          ↑(comap (AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (restrictScalars ℝ A.toSubalgebra)) ∧
      f x₁ ≠ f x₂
[PROOFSTEP]
let F : C(X, 𝕜) :=
  f -
    const _
      (f x₂)
        -- Subtract the constant `f x₂` from `f`; this is still an element of the subalgebra
[GOAL]
case intro.intro.intro.intro
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
⊢ ∃ f,
    f ∈
        (fun f => ↑f) ''
          ↑(comap (AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (restrictScalars ℝ A.toSubalgebra)) ∧
      f x₁ ≠ f x₂
[PROOFSTEP]
have hFA : F ∈ A :=
  by
  refine' A.sub_mem hfA (@Eq.subst _ (· ∈ A) _ _ _ <| A.smul_mem A.one_mem <| f x₂)
  ext1
  simp only [coe_smul, coe_one, smul_apply, one_apply, Algebra.id.smul_eq_mul, mul_one, const_apply]
    -- Consider now the function `fun x ↦ |f x - f x₂| ^ 2`
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
⊢ F ∈ A
[PROOFSTEP]
refine' A.sub_mem hfA (@Eq.subst _ (· ∈ A) _ _ _ <| A.smul_mem A.one_mem <| f x₂)
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
⊢ ↑f x₂ • 1 = const X (↑f x₂)
[PROOFSTEP]
ext1
[GOAL]
case h
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
a✝ : X
⊢ ↑(↑f x₂ • 1) a✝ = ↑(const X (↑f x₂)) a✝
[PROOFSTEP]
simp only [coe_smul, coe_one, smul_apply, one_apply, Algebra.id.smul_eq_mul, mul_one, const_apply]
  -- Consider now the function `fun x ↦ |f x - f x₂| ^ 2`
[GOAL]
case intro.intro.intro.intro
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
hFA : F ∈ A
⊢ ∃ f,
    f ∈
        (fun f => ↑f) ''
          ↑(comap (AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (restrictScalars ℝ A.toSubalgebra)) ∧
      f x₁ ≠ f x₂
[PROOFSTEP]
refine' ⟨_, ⟨(⟨IsROrC.normSq, continuous_normSq⟩ : C(𝕜, ℝ)).comp F, _, rfl⟩, _⟩
[GOAL]
case intro.intro.intro.intro.refine'_1
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
hFA : F ∈ A
⊢ comp (ContinuousMap.mk ↑normSq) F ∈
    ↑(comap (AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (restrictScalars ℝ A.toSubalgebra))
[PROOFSTEP]
rw [SetLike.mem_coe, Subalgebra.mem_comap]
[GOAL]
case intro.intro.intro.intro.refine'_1
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
hFA : F ∈ A
⊢ ↑(AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (comp (ContinuousMap.mk ↑normSq) F) ∈
    restrictScalars ℝ A.toSubalgebra
[PROOFSTEP]
convert (A.restrictScalars ℝ).mul_mem hFA (star_mem hFA : star F ∈ A)
[GOAL]
case h.e'_4
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
hFA : F ∈ A
⊢ ↑(AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (comp (ContinuousMap.mk ↑normSq) F) = F * star F
[PROOFSTEP]
ext1
[GOAL]
case h.e'_4.h
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
hFA : F ∈ A
a✝ : X
⊢ ↑(↑(AlgHom.compLeftContinuous ℝ ofRealAm (_ : Continuous ofReal)) (comp (ContinuousMap.mk ↑normSq) F)) a✝ =
    ↑(F * star F) a✝
[PROOFSTEP]
exact (IsROrC.mul_conj (K := 𝕜) _).symm
[GOAL]
case intro.intro.intro.intro.refine'_2
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
hFA : F ∈ A
⊢ (fun f => ↑f) (comp (ContinuousMap.mk ↑normSq) F) x₁ ≠ (fun f => ↑f) (comp (ContinuousMap.mk ↑normSq) F) x₂
[PROOFSTEP]
have : f x₁ - f x₂ ≠ 0 := sub_ne_zero.mpr hf
[GOAL]
case intro.intro.intro.intro.refine'_2
𝕜 : Type u_2
X : Type u_1
inst✝¹ : IsROrC 𝕜
inst✝ : TopologicalSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : SeparatesPoints A.toSubalgebra
x₁ x₂ : X
hx : x₁ ≠ x₂
f : C(X, 𝕜)
hfA : f ∈ ↑A.toSubalgebra
hf : (fun f => ↑f) f x₁ ≠ (fun f => ↑f) f x₂
F : C(X, 𝕜) := f - const X (↑f x₂)
hFA : F ∈ A
this : ↑f x₁ - ↑f x₂ ≠ 0
⊢ (fun f => ↑f) (comp (ContinuousMap.mk ↑normSq) F) x₁ ≠ (fun f => ↑f) (comp (ContinuousMap.mk ↑normSq) F) x₂
[PROOFSTEP]
simpa only [comp_apply, coe_sub, coe_const, sub_apply, coe_mk, sub_self, map_zero, Ne.def, normSq_eq_zero,
  const_apply] using this
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
⊢ StarSubalgebra.topologicalClosure A = ⊤
[PROOFSTEP]
rw [StarSubalgebra.eq_top_iff]
  -- Let `I` be the natural inclusion of `C(X, ℝ)` into `C(X, 𝕜)`
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
⊢ ∀ (x : C(X, 𝕜)), x ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
let I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ofRealClm.compLeftContinuous ℝ X
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
⊢ ∀ (x : C(X, 𝕜)), x ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
have key : LinearMap.range I ≤ (A.toSubmodule.restrictScalars ℝ).topologicalClosure := by
  -- Let `A₀` be the subalgebra of `C(X, ℝ)` consisting of `A`'s purely real elements; it is the
      -- preimage of `A` under `I`.  In this argument we only need its submodule structure.
  let A₀ : Submodule ℝ C(X, ℝ) := (A.toSubmodule.restrictScalars ℝ).comap I
  have SW : A₀.topologicalClosure = ⊤ :=
    haveI := subalgebra_topologicalClosure_eq_top_of_separatesPoints _ hA.isROrC_to_real
    congr_arg Subalgebra.toSubmodule this
  rw [← Submodule.map_top, ← SW]
    -- So it suffices to prove that the image under `I` of the closure of `A₀` is contained in the
        -- closure of `A`, which follows by abstract nonsense
  have h₁ := A₀.topologicalClosure_map ((@ofRealClm 𝕜 _).compLeftContinuousCompact X)
  have h₂ := (A.toSubmodule.restrictScalars ℝ).map_comap_le I
  exact
    h₁.trans
      (Submodule.topologicalClosure_mono h₂)
        -- In particular, for a function `f` in `C(X, 𝕜)`, the real and imaginary parts of `f` are in the
          -- closure of `A`
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
⊢ LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
[PROOFSTEP]
let A₀ : Submodule ℝ C(X, ℝ) := (A.toSubmodule.restrictScalars ℝ).comap I
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
A₀ : Submodule ℝ C(X, ℝ) := Submodule.comap I (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
⊢ LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
[PROOFSTEP]
have SW : A₀.topologicalClosure = ⊤ :=
  haveI := subalgebra_topologicalClosure_eq_top_of_separatesPoints _ hA.isROrC_to_real
  congr_arg Subalgebra.toSubmodule this
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
A₀ : Submodule ℝ C(X, ℝ) := Submodule.comap I (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
SW : Submodule.topologicalClosure A₀ = ⊤
⊢ LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
[PROOFSTEP]
rw [← Submodule.map_top, ← SW]
  -- So it suffices to prove that the image under `I` of the closure of `A₀` is contained in the
      -- closure of `A`, which follows by abstract nonsense
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
A₀ : Submodule ℝ C(X, ℝ) := Submodule.comap I (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
SW : Submodule.topologicalClosure A₀ = ⊤
⊢ Submodule.map I (Submodule.topologicalClosure A₀) ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
[PROOFSTEP]
have h₁ := A₀.topologicalClosure_map ((@ofRealClm 𝕜 _).compLeftContinuousCompact X)
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
A₀ : Submodule ℝ C(X, ℝ) := Submodule.comap I (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
SW : Submodule.topologicalClosure A₀ = ⊤
h₁ :
  Submodule.map (↑(ContinuousLinearMap.compLeftContinuousCompact X ofRealClm)) (Submodule.topologicalClosure A₀) ≤
    Submodule.topologicalClosure (Submodule.map (↑(ContinuousLinearMap.compLeftContinuousCompact X ofRealClm)) A₀)
⊢ Submodule.map I (Submodule.topologicalClosure A₀) ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
[PROOFSTEP]
have h₂ := (A.toSubmodule.restrictScalars ℝ).map_comap_le I
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
A₀ : Submodule ℝ C(X, ℝ) := Submodule.comap I (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
SW : Submodule.topologicalClosure A₀ = ⊤
h₁ :
  Submodule.map (↑(ContinuousLinearMap.compLeftContinuousCompact X ofRealClm)) (Submodule.topologicalClosure A₀) ≤
    Submodule.topologicalClosure (Submodule.map (↑(ContinuousLinearMap.compLeftContinuousCompact X ofRealClm)) A₀)
h₂ :
  Submodule.map I (Submodule.comap I (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))) ≤
    Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra)
⊢ Submodule.map I (Submodule.topologicalClosure A₀) ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
[PROOFSTEP]
exact
  h₁.trans
    (Submodule.topologicalClosure_mono h₂)
      -- In particular, for a function `f` in `C(X, 𝕜)`, the real and imaginary parts of `f` are in the
        -- closure of `A`
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
⊢ ∀ (x : C(X, 𝕜)), x ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
intro f
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
⊢ f ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
let f_re : C(X, ℝ) := (⟨IsROrC.re, IsROrC.reClm.continuous⟩ : C(𝕜, ℝ)).comp f
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
⊢ f ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
let f_im : C(X, ℝ) := (⟨IsROrC.im, IsROrC.imClm.continuous⟩ : C(𝕜, ℝ)).comp f
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
⊢ f ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
have h_f_re : I f_re ∈ A.topologicalClosure := key ⟨f_re, rfl⟩
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
h_f_re : ↑I f_re ∈ StarSubalgebra.topologicalClosure A
⊢ f ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
have h_f_im : I f_im ∈ A.topologicalClosure :=
  key
    ⟨f_im, rfl⟩
      -- So `f_re + I • f_im` is in the closure of `A`
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
h_f_re : ↑I f_re ∈ StarSubalgebra.topologicalClosure A
h_f_im : ↑I f_im ∈ StarSubalgebra.topologicalClosure A
⊢ f ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
have := A.topologicalClosure.add_mem h_f_re (A.topologicalClosure.smul_mem h_f_im IsROrC.I)
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
h_f_re : ↑I f_re ∈ StarSubalgebra.topologicalClosure A
h_f_im : ↑I f_im ∈ StarSubalgebra.topologicalClosure A
this : ↑I f_re + IsROrC.I • ↑I f_im ∈ (StarSubalgebra.topologicalClosure A).toSubalgebra
⊢ f ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
rw [StarSubalgebra.mem_toSubalgebra] at this 
[GOAL]
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
h_f_re : ↑I f_re ∈ StarSubalgebra.topologicalClosure A
h_f_im : ↑I f_im ∈ StarSubalgebra.topologicalClosure A
this : ↑I f_re + IsROrC.I • ↑I f_im ∈ StarSubalgebra.topologicalClosure A
⊢ f ∈ StarSubalgebra.topologicalClosure A
[PROOFSTEP]
convert this
[GOAL]
case h.e'_4
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
h_f_re : ↑I f_re ∈ StarSubalgebra.topologicalClosure A
h_f_im : ↑I f_im ∈ StarSubalgebra.topologicalClosure A
this : ↑I f_re + IsROrC.I • ↑I f_im ∈ StarSubalgebra.topologicalClosure A
⊢ f = ↑I f_re + IsROrC.I • ↑I f_im
[PROOFSTEP]
ext
[GOAL]
case h.e'_4.h
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
h_f_re : ↑I f_re ∈ StarSubalgebra.topologicalClosure A
h_f_im : ↑I f_im ∈ StarSubalgebra.topologicalClosure A
this : ↑I f_re + IsROrC.I • ↑I f_im ∈ StarSubalgebra.topologicalClosure A
a✝ : X
⊢ ↑f a✝ = ↑(↑I f_re + IsROrC.I • ↑I f_im) a✝
[PROOFSTEP]
apply Eq.symm
[GOAL]
case h.e'_4.h.h
𝕜 : Type u_2
X : Type u_1
inst✝² : IsROrC 𝕜
inst✝¹ : TopologicalSpace X
inst✝ : CompactSpace X
A : StarSubalgebra 𝕜 C(X, 𝕜)
hA : Subalgebra.SeparatesPoints A.toSubalgebra
I : C(X, ℝ) →ₗ[ℝ] C(X, 𝕜) := ContinuousLinearMap.compLeftContinuous ℝ X ofRealClm
key :
  LinearMap.range I ≤
    Submodule.topologicalClosure (Submodule.restrictScalars ℝ (↑Subalgebra.toSubmodule A.toSubalgebra))
f : C(X, 𝕜)
f_re : C(X, ℝ) := comp (mk ↑re) f
f_im : C(X, ℝ) := comp (mk ↑im) f
h_f_re : ↑I f_re ∈ StarSubalgebra.topologicalClosure A
h_f_im : ↑I f_im ∈ StarSubalgebra.topologicalClosure A
this : ↑I f_re + IsROrC.I • ↑I f_im ∈ StarSubalgebra.topologicalClosure A
a✝ : X
⊢ ↑(↑I f_re + IsROrC.I • ↑I f_im) a✝ = ↑f a✝
[PROOFSTEP]
simp [mul_comm IsROrC.I _]
[GOAL]
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ↑φ
hψ : Continuous ↑ψ
h : ↑φ (↑(toContinuousMapOnAlgHom s) X) = ↑ψ (↑(toContinuousMapOnAlgHom s) X)
⊢ φ = ψ
[PROOFSTEP]
suffices (⊤ : Subalgebra ℝ C(s, ℝ)) ≤ AlgHom.equalizer φ ψ from AlgHom.ext fun x => this (by trivial)
[GOAL]
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ↑φ
hψ : Continuous ↑ψ
h : ↑φ (↑(toContinuousMapOnAlgHom s) X) = ↑ψ (↑(toContinuousMapOnAlgHom s) X)
this : ⊤ ≤ AlgHom.equalizer φ ψ
x : C(↑s, ℝ)
⊢ x ∈ ⊤
[PROOFSTEP]
trivial
[GOAL]
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ↑φ
hψ : Continuous ↑ψ
h : ↑φ (↑(toContinuousMapOnAlgHom s) X) = ↑ψ (↑(toContinuousMapOnAlgHom s) X)
⊢ ⊤ ≤ AlgHom.equalizer φ ψ
[PROOFSTEP]
rw [← polynomialFunctions.topologicalClosure s]
[GOAL]
A : Type u_1
inst✝⁴ : Ring A
inst✝³ : Algebra ℝ A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set ℝ
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, ℝ) →ₐ[ℝ] A
hφ : Continuous ↑φ
hψ : Continuous ↑ψ
h : ↑φ (↑(toContinuousMapOnAlgHom s) X) = ↑ψ (↑(toContinuousMapOnAlgHom s) X)
⊢ Subalgebra.topologicalClosure (polynomialFunctions s) ≤ AlgHom.equalizer φ ψ
[PROOFSTEP]
exact
  Subalgebra.topologicalClosure_minimal (polynomialFunctions s) (polynomialFunctions.le_equalizer s φ ψ h)
    (isClosed_eq hφ hψ)
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁶ : IsROrC 𝕜
inst✝⁵ : Ring A
inst✝⁴ : StarRing A
inst✝³ : Algebra 𝕜 A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set 𝕜
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, 𝕜) →⋆ₐ[𝕜] A
hφ : Continuous ↑φ
hψ : Continuous ↑ψ
h : ↑φ (↑(toContinuousMapOnAlgHom s) X) = ↑ψ (↑(toContinuousMapOnAlgHom s) X)
⊢ φ = ψ
[PROOFSTEP]
suffices (⊤ : StarSubalgebra 𝕜 C(s, 𝕜)) ≤ StarAlgHom.equalizer φ ψ from StarAlgHom.ext fun x => this mem_top
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁶ : IsROrC 𝕜
inst✝⁵ : Ring A
inst✝⁴ : StarRing A
inst✝³ : Algebra 𝕜 A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set 𝕜
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, 𝕜) →⋆ₐ[𝕜] A
hφ : Continuous ↑φ
hψ : Continuous ↑ψ
h : ↑φ (↑(toContinuousMapOnAlgHom s) X) = ↑ψ (↑(toContinuousMapOnAlgHom s) X)
⊢ ⊤ ≤ StarAlgHom.equalizer φ ψ
[PROOFSTEP]
rw [← polynomialFunctions.starClosure_topologicalClosure s]
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁶ : IsROrC 𝕜
inst✝⁵ : Ring A
inst✝⁴ : StarRing A
inst✝³ : Algebra 𝕜 A
inst✝² : TopologicalSpace A
inst✝¹ : T2Space A
s : Set 𝕜
inst✝ : CompactSpace ↑s
φ ψ : C(↑s, 𝕜) →⋆ₐ[𝕜] A
hφ : Continuous ↑φ
hψ : Continuous ↑ψ
h : ↑φ (↑(toContinuousMapOnAlgHom s) X) = ↑ψ (↑(toContinuousMapOnAlgHom s) X)
⊢ topologicalClosure (Subalgebra.starClosure (polynomialFunctions s)) ≤ StarAlgHom.equalizer φ ψ
[PROOFSTEP]
exact
  StarSubalgebra.topologicalClosure_minimal (polynomialFunctions.starClosure_le_equalizer s φ ψ h) (isClosed_eq hφ hψ)
