-- Mathlib/Analysis/NormedSpace/HahnBanach/Extension.lean
theorem exists_extension_norm_eq (p : Subspace 𝕜 E) (f : p →L[𝕜] 𝕜) :
    ∃ g : E →L[𝕜] 𝕜, (∀ x : p, g x = f x) ∧ ‖g‖ = ‖f‖

Proof state:
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
x : ↥p
⊢ ↑(fr x) - I * ↑(fr (I • x)) = f x

Tactic:
have :
    (fr x : 𝕜) - I * ↑(fr ((I : 𝕜) • x)) = (re (f x) : 𝕜) - (I : 𝕜) * re (f ((I : 𝕜) • x)) := by
  rfl

Result:
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝³ : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝² : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝¹ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this✝ : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
x : ↥p
this : ↑(fr x) - I * ↑(fr (I • x)) = ↑(re (f x)) - I * ↑(re (f (I • x)))
⊢ ↑(fr x) - I * ↑(fr (I • x)) = f x

Proof state:
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝¹ : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
⊢ ∃ g, (∀ (x : ↥p), g ↑x = f x) ∧ ‖g‖ = ‖f‖

Tactic:
letI : NormedSpace ℝ E := NormedSpace.restrictScalars _ 𝕜 _

Result:
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
⊢ ∃ g, (∀ (x : ↥p), g ↑x = f x) ∧ ‖g‖ = ‖f‖

Proof state:
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝ : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
⊢ ∃ g, (∀ (x : ↥p), g ↑x = f x) ∧ ‖g‖ = ‖f‖

Tactic:
letI : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower _ _ _

Result:
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝¹ : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
⊢ ∃ g, (∀ (x : ↥p), g ↑x = f x) ∧ ‖g‖ = ‖f‖

Proof state:
case intro.intro
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
⊢ ∃ g, (∀ (x : ↥p), g ↑x = f x) ∧ ‖g‖ = ‖f‖

Tactic:
refine ⟨g.extendTo𝕜, ?_⟩

Result:
case intro.intro
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
⊢ (∀ (x : ↥p), g.extendTo𝕜 ↑x = f x) ∧ ‖g.extendTo𝕜‖ = ‖f‖

Proof state:
case intro.intro.refine_2
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
h : ∀ (x : ↥p), g.extendTo𝕜 ↑x = f x
⊢ ‖f‖ ≤ ‖g.extendTo𝕜‖

Tactic:
exact f.opNorm_le_bound g.extendTo𝕜.opNorm_nonneg fun x => h x ▸ g.extendTo𝕜.le_opNorm x

Result:
no goals

Proof state:
case intro.intro
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
h : ∀ (x : ↥p), g.extendTo𝕜 ↑x = f x
⊢ (∀ (x : ↥p), g.extendTo𝕜 ↑x = f x) ∧ ‖g.extendTo𝕜‖ = ‖f‖

Tactic:
refine ⟨h, le_antisymm ?_ ?_⟩

Result:
case intro.intro.refine_1
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
h : ∀ (x : ↥p), g.extendTo𝕜 ↑x = f x
⊢ ‖g.extendTo𝕜‖ ≤ ‖f‖

case intro.intro.refine_2
𝕜 : Type u_1
inst✝³ : NontriviallyNormedField 𝕜
inst✝² : IsRCLikeNormedField 𝕜
E : Type u_2
inst✝¹ : SeminormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
p : Subspace 𝕜 E
f : ↥p →L[𝕜] 𝕜
this✝² : RCLike 𝕜 := IsRCLikeNormedField.rclike 𝕜
this✝¹ : Module ℝ E := RestrictScalars.module ℝ 𝕜 E
this✝ : IsScalarTower ℝ 𝕜 E := RestrictScalars.isScalarTower ℝ 𝕜 E
this : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
fr : ↥p →L[ℝ] ℝ := reCLM.comp (ContinuousLinearMap.restrictScalars ℝ f)
g : E →L[ℝ] ℝ
hextends : ∀ (x : ↥(Submodule.restrictScalars ℝ p)), g ↑x = fr x
hnormeq : ‖g‖ = ‖fr‖
h : ∀ (x : ↥p), g.extendTo𝕜 ↑x = f x
⊢ ‖f‖ ≤ ‖g.extendTo𝕜‖