Theorem: CompletelyRegularSpace.exists_BCNN
File: Mathlib/MeasureTheory/Measure/DiracProba.lean

Proof steps:
state_before: X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
state_after: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
tactic: obtain ⟨g, g_cont, gx_zero, g_one_on_K⟩ :=
    CompletelyRegularSpace.completely_regular x K K_closed x_notin_K
state_before: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
state_after: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
g_bdd : ∀ (x y : X), dist (↑(g x)).toNNReal (↑(g y)).toNNReal ≤ 1
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
tactic: have g_bdd : ∀ x y, dist (Real.toNNReal (g x)) (Real.toNNReal (g y)) ≤ 1 := by
    refine fun x y ↦ ((Real.lipschitzWith_toNNReal).dist_le_mul (g x) (g y)).trans ?_
    simpa using Real.dist_le_of_mem_Icc_01 (g x).prop (g y).prop
state_before: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
g_bdd : ∀ (x y : X), dist (↑(g x)).toNNReal (↑(g y)).toNNReal ≤ 1
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
state_after: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
g_bdd : ∀ (x y : X), dist (↑(g x)).toNNReal (↑(g y)).toNNReal ≤ 1
g' : X →ᵇ ℝ≥0 := mkOfBound { toFun := fun x => (↑(g x)).toNNReal, continuous_toFun := ⋯ } 1 g_bdd
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
tactic: set g' := BoundedContinuousFunction.mkOfBound
      ⟨fun x ↦ Real.toNNReal (g x), continuous_real_toNNReal.comp g_cont.subtype_val⟩ 1 g_bdd
state_before: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
g_bdd : ∀ (x y : X), dist (↑(g x)).toNNReal (↑(g y)).toNNReal ≤ 1
g' : X →ᵇ ℝ≥0 := mkOfBound { toFun := fun x => (↑(g x)).toNNReal, continuous_toFun := ⋯ } 1 g_bdd
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
state_after: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
g_bdd : ∀ (x y : X), dist (↑(g x)).toNNReal (↑(g y)).toNNReal ≤ 1
g' : X →ᵇ ℝ≥0 := mkOfBound { toFun := fun x => (↑(g x)).toNNReal, continuous_toFun := ⋯ } 1 g_bdd
f : X →ᵇ ℝ≥0 := 1 - g'
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
tactic: set f := 1 - g'
state_before: case intro.intro.intro
X : Type u_1
inst✝¹ : TopologicalSpace X
inst✝ : CompletelyRegularSpace X
K : Set X
K_closed : IsClosed K
x : X
x_notin_K : x ∉ K
g : X → ↑unitInterval
g_cont : Continuous g
gx_zero : g x = 0
g_one_on_K : EqOn g 1 K
g_bdd : ∀ (x y : X), dist (↑(g x)).toNNReal (↑(g y)).toNNReal ≤ 1
g' : X →ᵇ ℝ≥0 := mkOfBound { toFun := fun x => (↑(g x)).toNNReal, continuous_toFun := ⋯ } 1 g_bdd
f : X →ᵇ ℝ≥0 := 1 - g'
⊢ ∃ f, f x = 1 ∧ ∀ y ∈ K, f y = 0
state_after: no goals
tactic: refine ⟨f, by simp [f, g', gx_zero], fun y y_in_K ↦ by simp [f, g', g_one_on_K y_in_K]⟩