-- Mathlib/Topology/TietzeExtension.lean
theorem tietze_extension_step (f : X →ᵇ ℝ) (e : C(X, Y)) (he : IsClosedEmbedding e) :
    ∃ g : Y →ᵇ ℝ, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖

Proof state:
case inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : f ≠ 0
⊢ ∃ g, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖

Tactic:
replace hf : 0 < ‖f‖ := norm_pos_iff.2 hf

Result:
case inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
⊢ ∃ g, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖

Proof state:
case inl
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
⊢ ∃ g, ‖g‖ ≤ ‖0‖ / 3 ∧ dist (g.compContinuous e) 0 ≤ 2 / 3 * ‖0‖

Tactic:
use 0

Result:
case h
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
⊢ ‖0‖ ≤ ‖0‖ / 3 ∧ dist (compContinuous 0 e) 0 ≤ 2 / 3 * ‖0‖

Proof state:
case inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
⊢ ∃ g, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖

Tactic:
have hc₁ : IsClosed (e '' (f ⁻¹' Iic (-‖f‖ / 3))) :=
  he.isClosedMap _ (isClosed_Iic.preimage f.continuous)

Result:
case inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
⊢ ∃ g, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖

Proof state:
case h
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
⊢ ‖0‖ ≤ ‖0‖ / 3 ∧ dist (compContinuous 0 e) 0 ≤ 2 / 3 * ‖0‖

Tactic:
simp

Result:
no goals

Proof state:
case inr.intro.intro.intro.refine_2.inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hc₂ : IsClosed (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
hd : Disjoint (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3))) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
g : Y →ᵇ ℝ
hg₁ : EqOn (⇑g) (Function.const Y (-‖f‖ / 3)) (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hg₂ : EqOn (⇑g) (Function.const Y (‖f‖ / 3)) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
hgf : ∀ (x : Y), g x ∈ Icc (-‖f‖ / 3) (‖f‖ / 3)
x : X
hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖
hle₁ : -‖f‖ / 3 ≤ f x
⊢ dist ((g.compContinuous e) x) (f x) ≤ 2 / 3 * ‖f‖

Tactic:
rcases le_total (f x) (‖f‖ / 3) with hle₂ | hle₂

Result:
case inr.intro.intro.intro.refine_2.inr.inl
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hc₂ : IsClosed (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
hd : Disjoint (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3))) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
g : Y →ᵇ ℝ
hg₁ : EqOn (⇑g) (Function.const Y (-‖f‖ / 3)) (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hg₂ : EqOn (⇑g) (Function.const Y (‖f‖ / 3)) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
hgf : ∀ (x : Y), g x ∈ Icc (-‖f‖ / 3) (‖f‖ / 3)
x : X
hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖
hle₁ : -‖f‖ / 3 ≤ f x
hle₂ : f x ≤ ‖f‖ / 3
⊢ dist ((g.compContinuous e) x) (f x) ≤ 2 / 3 * ‖f‖

case inr.intro.intro.intro.refine_2.inr.inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hc₂ : IsClosed (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
hd : Disjoint (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3))) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
g : Y →ᵇ ℝ
hg₁ : EqOn (⇑g) (Function.const Y (-‖f‖ / 3)) (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hg₂ : EqOn (⇑g) (Function.const Y (‖f‖ / 3)) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
hgf : ∀ (x : Y), g x ∈ Icc (-‖f‖ / 3) (‖f‖ / 3)
x : X
hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖
hle₁ : -‖f‖ / 3 ≤ f x
hle₂ : ‖f‖ / 3 ≤ f x
⊢ dist ((g.compContinuous e) x) (f x) ≤ 2 / 3 * ‖f‖

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
⊢ 0 < 2 / 3

Tactic:
norm_num1

Result:
no goals

Proof state:
case inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
⊢ ∃ g, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖

Tactic:
have hc₂ : IsClosed (e '' (f ⁻¹' Ici (‖f‖ / 3))) :=
  he.isClosedMap _ (isClosed_Ici.preimage f.continuous)

Result:
case inr
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hc₂ : IsClosed (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
⊢ ∃ g, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hf3 : -‖f‖ / 3 < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-‖f‖ / 3)))
hc₂ : IsClosed (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
⊢ Disjoint (Iic (-‖f‖ / 3)) (Ici (‖f‖ / 3))

Tactic:
rwa [Iic_disjoint_Ici, not_le]

Result:
no goals

Proof state:
case inr.intro.intro.intro.refine_2.inr.inl
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : NormalSpace Y
f : X →ᵇ ℝ
e : C(X, Y)
he : IsClosedEmbedding ⇑e
h3 : 0 < 3
h23 : 0 < 2 / 3
hf : 0 < ‖f‖
hc₂ : IsClosed (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
g : Y →ᵇ ℝ
hg₂ : EqOn (⇑g) (Function.const Y (‖f‖ / 3)) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
x : X
hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖
hle₂ : f x ≤ ‖f‖ / 3
hf3 : -(‖f‖ / 3) < ‖f‖ / 3
hc₁ : IsClosed (⇑e '' (⇑f ⁻¹' Iic (-(‖f‖ / 3))))
hd : Disjoint (⇑e '' (⇑f ⁻¹' Iic (-(‖f‖ / 3)))) (⇑e '' (⇑f ⁻¹' Ici (‖f‖ / 3)))
hg₁ : EqOn (⇑g) (Function.const Y (-(‖f‖ / 3))) (⇑e '' (⇑f ⁻¹' Iic (-(‖f‖ / 3))))
hgf : ∀ (x : Y), g x ∈ Icc (-(‖f‖ / 3)) (‖f‖ / 3)
hle₁ : -(‖f‖ / 3) ≤ f x
⊢ dist ((g.compContinuous e) x) (f x) ≤ 2 / 3 * ‖f‖

Tactic:
calc
  dist (g (e x)) (f x) ≤ |g (e x)| + |f x| := dist_le_norm_add_norm _ _
  _ ≤ ‖f‖ / 3 + ‖f‖ / 3 := (add_le_add (abs_le.2 <| hgf _) (abs_le.2 ⟨hle₁, hle₂⟩))
  _ = 2 / 3 * ‖f‖ := by linarith

Result:
no goals