l3lab/ntp-mathlib huggingface dataset:
theorem orthogonalProjectionFn_norm_sq (v : E) :
    ‖v‖ * ‖v‖ =
      ‖v - orthogonalProjectionFn K v‖ * ‖v - orthogonalProjectionFn K v‖ +
        ‖orthogonalProjectionFn K v‖ * ‖orthogonalProjectionFn K v‖ := by
  set p := orthogonalProjectionFn K v
  have h' : ⟪v - p, p⟫ = 0 :=
    orthogonalProjectionFn_inner_eq_zero _ _ (orthogonalProjectionFn_mem v)
  

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
v : E
p : E := orthogonalProjectionFn K v
h' : inner (v - p) p = 0
⊢ ‖v‖ * ‖v‖ = ‖v - p‖ * ‖v - p‖ + ‖p‖ * ‖p‖

Next tactic:
convert norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero (v - p) p h' using 2
theorem orthogonalProjectionFn_norm_sq (v : E) :
    ‖v‖ * ‖v‖ =
      ‖v - orthogonalProjectionFn K v‖ * ‖v - orthogonalProjectionFn K v‖ +
        ‖orthogonalProjectionFn K v‖ * ‖orthogonalProjectionFn K v‖ := by
  set p := orthogonalProjectionFn K v
  have h' : ⟪v - p, p⟫ = 0 :=
    orthogonalProjectionFn_inner_eq_zero _ _ (orthogonalProjectionFn_mem v)
  convert norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero (v - p) p h' using 2 <;> 

Proof state:
case h.e'_2.h.e'_5
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
v : E
p : E := orthogonalProjectionFn K v
h' : inner (v - p) p = 0
⊢ ‖v‖ = ‖v - p + p‖

Next tactic:
simp
theorem orthogonalProjectionFn_norm_sq (v : E) :
    ‖v‖ * ‖v‖ =
      ‖v - orthogonalProjectionFn K v‖ * ‖v - orthogonalProjectionFn K v‖ +
        ‖orthogonalProjectionFn K v‖ * ‖orthogonalProjectionFn K v‖ := by
  set p := orthogonalProjectionFn K v
  have h' : ⟪v - p, p⟫ = 0 :=
    orthogonalProjectionFn_inner_eq_zero _ _ (orthogonalProjectionFn_mem v)
  convert norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero (v - p) p h' using 2 <;> 

Proof state:
case h.e'_2.h.e'_6
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
v : E
p : E := orthogonalProjectionFn K v
h' : inner (v - p) p = 0
⊢ ‖v‖ = ‖v - p + p‖

Next tactic:
simp
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
x y : E
⊢ (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) (x + y) =
    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
      (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) y

Next tactic:
have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
x y : E
hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K
⊢ (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) (x + y) =
    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
      (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) y

Next tactic:
have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
x y : E
hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K
⊢ ∀ w ∈ K, inner (x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y)) w = 0

Next tactic:
intro w hw
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
x y : E
hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K
w : E
hw : w ∈ K
⊢ inner (x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y)) w = 0

Next tactic:
rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
x y : E
hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K
ho : ∀ w ∈ K, inner (x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y)) w = 0
⊢ (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) (x + y) =
    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
      (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) y

Next tactic:
ext
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        ext
        

Proof state:
case a
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
x y : E
hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K
ho : ∀ w ∈ K, inner (x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y)) w = 0
⊢ ↑((fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) (x + y)) =
    ↑((fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
        (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) y)

Next tactic:
simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        ext
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]
      map_smul' := fun c x => by
        

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
c : 𝕜
x : E
⊢ AddHom.toFun
      { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
        map_add' :=
          (_ :
            ∀ (x y : E),
              (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                  (x + y) =
                (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                    y) }
      (c • x) =
    (RingHom.id 𝕜) c •
      AddHom.toFun
        { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
          map_add' :=
            (_ :
              ∀ (x y : E),
                (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                    (x + y) =
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
                    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                      y) }
        x

Next tactic:
have hm : c • orthogonalProjectionFn K x ∈ K :=
          Submodule.smul_mem K _ (orthogonalProjectionFn_mem x)
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        ext
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]
      map_smul' := fun c x => by
        have hm : c • orthogonalProjectionFn K x ∈ K :=
          Submodule.smul_mem K _ (orthogonalProjectionFn_mem x)
        

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
c : 𝕜
x : E
hm : c • orthogonalProjectionFn K x ∈ K
⊢ AddHom.toFun
      { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
        map_add' :=
          (_ :
            ∀ (x y : E),
              (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                  (x + y) =
                (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                    y) }
      (c • x) =
    (RingHom.id 𝕜) c •
      AddHom.toFun
        { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
          map_add' :=
            (_ :
              ∀ (x y : E),
                (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                    (x + y) =
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
                    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                      y) }
        x

Next tactic:
have ho : ∀ w ∈ K, ⟪c • x - c • orthogonalProjectionFn K x, w⟫ = 0 := by
          intro w hw
          rw [← smul_sub, inner_smul_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            mul_zero]
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        ext
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]
      map_smul' := fun c x => by
        have hm : c • orthogonalProjectionFn K x ∈ K :=
          Submodule.smul_mem K _ (orthogonalProjectionFn_mem x)
        have ho : ∀ w ∈ K, ⟪c • x - c • orthogonalProjectionFn K x, w⟫ = 0 := by
          

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
c : 𝕜
x : E
hm : c • orthogonalProjectionFn K x ∈ K
⊢ ∀ w ∈ K, inner (c • x - c • orthogonalProjectionFn K x) w = 0

Next tactic:
intro w hw
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        ext
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]
      map_smul' := fun c x => by
        have hm : c • orthogonalProjectionFn K x ∈ K :=
          Submodule.smul_mem K _ (orthogonalProjectionFn_mem x)
        have ho : ∀ w ∈ K, ⟪c • x - c • orthogonalProjectionFn K x, w⟫ = 0 := by
          intro w hw
          

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
c : 𝕜
x : E
hm : c • orthogonalProjectionFn K x ∈ K
w : E
hw : w ∈ K
⊢ inner (c • x - c • orthogonalProjectionFn K x) w = 0

Next tactic:
rw [← smul_sub, inner_smul_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            mul_zero]
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        ext
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]
      map_smul' := fun c x => by
        have hm : c • orthogonalProjectionFn K x ∈ K :=
          Submodule.smul_mem K _ (orthogonalProjectionFn_mem x)
        have ho : ∀ w ∈ K, ⟪c • x - c • orthogonalProjectionFn K x, w⟫ = 0 := by
          intro w hw
          rw [← smul_sub, inner_smul_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            mul_zero]
        

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
c : 𝕜
x : E
hm : c • orthogonalProjectionFn K x ∈ K
ho : ∀ w ∈ K, inner (c • x - c • orthogonalProjectionFn K x) w = 0
⊢ AddHom.toFun
      { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
        map_add' :=
          (_ :
            ∀ (x y : E),
              (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                  (x + y) =
                (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                    y) }
      (c • x) =
    (RingHom.id 𝕜) c •
      AddHom.toFun
        { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
          map_add' :=
            (_ :
              ∀ (x y : E),
                (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                    (x + y) =
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
                    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                      y) }
        x

Next tactic:
ext
/-- The orthogonal projection onto a complete subspace. -/
def orthogonalProjection : E →L[𝕜] K :=
  LinearMap.mkContinuous
    { toFun := fun v => ⟨orthogonalProjectionFn K v, orthogonalProjectionFn_mem v⟩
      map_add' := fun x y => by
        have hm : orthogonalProjectionFn K x + orthogonalProjectionFn K y ∈ K :=
          Submodule.add_mem K (orthogonalProjectionFn_mem x) (orthogonalProjectionFn_mem y)
        have ho :
          ∀ w ∈ K, ⟪x + y - (orthogonalProjectionFn K x + orthogonalProjectionFn K y), w⟫ = 0 := by
          intro w hw
          rw [add_sub_add_comm, inner_add_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            orthogonalProjectionFn_inner_eq_zero _ w hw, add_zero]
        ext
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]
      map_smul' := fun c x => by
        have hm : c • orthogonalProjectionFn K x ∈ K :=
          Submodule.smul_mem K _ (orthogonalProjectionFn_mem x)
        have ho : ∀ w ∈ K, ⟪c • x - c • orthogonalProjectionFn K x, w⟫ = 0 := by
          intro w hw
          rw [← smul_sub, inner_smul_left, orthogonalProjectionFn_inner_eq_zero _ w hw,
            mul_zero]
        ext
        

Proof state:
case a
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst✝⁵ : IsROrC 𝕜
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace 𝕜 E
inst✝¹ : InnerProductSpace ℝ F
K : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K
c : 𝕜
x : E
hm : c • orthogonalProjectionFn K x ∈ K
ho : ∀ w ∈ K, inner (c • x - c • orthogonalProjectionFn K x) w = 0
⊢ ↑(AddHom.toFun
        { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
          map_add' :=
            (_ :
              ∀ (x y : E),
                (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                    (x + y) =
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) }) x +
                    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                      y) }
        (c • x)) =
    ↑((RingHom.id 𝕜) c •
        AddHom.toFun
          { toFun := fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) },
            map_add' :=
              (_ :
                ∀ (x y : E),
                  (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                      (x + y) =
                    (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                        x +
                      (fun v => { val := orthogonalProjectionFn K v, property := (_ : orthogonalProjectionFn K v ∈ K) })
                        y) }
          x)

Next tactic:
simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho]