l3lab/ntp-mathlib huggingface dataset:
/-- 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
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho] }
    1 fun x => by
    simp only [one_mul, LinearMap.coe_mk]
    

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 : E
⊢ ‖{ 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‖ ≤
    ‖x‖

Next tactic:
refine' le_of_pow_le_pow_left two_ne_zero (norm_nonneg _) _
/-- 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
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho] }
    1 fun x => by
    simp only [one_mul, LinearMap.coe_mk]
    refine' le_of_pow_le_pow_left two_ne_zero (norm_nonneg _) _
    

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 : E
⊢ ‖{ 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‖ ^
      2 ≤
    ‖x‖ ^ 2

Next tactic:
change ‖orthogonalProjectionFn K x‖ ^ 2 ≤ ‖x‖ ^ 2
/-- 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
        simp [eq_orthogonalProjectionFn_of_mem_of_inner_eq_zero hm ho] }
    1 fun x => by
    simp only [one_mul, LinearMap.coe_mk]
    refine' le_of_pow_le_pow_left two_ne_zero (norm_nonneg _) _
    change ‖orthogonalProjectionFn K x‖ ^ 2 ≤ ‖x‖ ^ 2
    

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 : E
⊢ ‖orthogonalProjectionFn K x‖ ^ 2 ≤ ‖x‖ ^ 2

Next tactic:
nlinarith [orthogonalProjectionFn_norm_sq K x]
/-- The difference of `v` from its orthogonal projection onto `K` is in `Kᗮ`.  -/
@[simp]
theorem sub_orthogonalProjection_mem_orthogonal (v : E) : v - orthogonalProjection K v ∈ Kᗮ := 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
v : E
⊢ v - ↑((orthogonalProjection K) v) ∈ Kᗮ

Next tactic:
intro w hw
/-- The difference of `v` from its orthogonal projection onto `K` is in `Kᗮ`.  -/
@[simp]
theorem sub_orthogonalProjection_mem_orthogonal (v : E) : v - orthogonalProjection K v ∈ Kᗮ := 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
v w : E
hw : w ∈ K
⊢ inner w (v - ↑((orthogonalProjection K) v)) = 0

Next tactic:
rw [inner_eq_zero_symm]
/-- The difference of `v` from its orthogonal projection onto `K` is in `Kᗮ`.  -/
@[simp]
theorem sub_orthogonalProjection_mem_orthogonal (v : E) : v - orthogonalProjection K v ∈ Kᗮ := by
  intro w hw
  rw [inner_eq_zero_symm]
  

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 w : E
hw : w ∈ K
⊢ inner (v - ↑((orthogonalProjection K) v)) w = 0

Next tactic:
exact orthogonalProjection_inner_eq_zero _ _ hw
/-- A point in `K` with the orthogonality property (here characterized in terms of `Kᗮ`) must be the
orthogonal projection. -/
theorem eq_orthogonalProjection_of_mem_orthogonal' [HasOrthogonalProjection K] {u v z : E}
    (hv : v ∈ K) (hz : z ∈ Kᗮ) (hu : u = v + z) : (orthogonalProjection K u : E) = v :=
  eq_orthogonalProjection_of_mem_orthogonal hv (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✝¹ inst✝ : HasOrthogonalProjection K
u v z : E
hv : v ∈ K
hz : z ∈ Kᗮ
hu : u = v + z
⊢ u - v ∈ Kᗮ

Next tactic:
simpa [hu]
@[simp]
theorem orthogonalProjection_orthogonal_val [HasOrthogonalProjection K] (u : E) :
    (orthogonalProjection Kᗮ u : E) = u - orthogonalProjection K u :=
  eq_orthogonalProjection_of_mem_orthogonal' (sub_orthogonalProjection_mem_orthogonal _)
    (K.le_orthogonal_orthogonal (orthogonalProjection K u).2) <| 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✝¹ inst✝ : HasOrthogonalProjection K
u : E
⊢ u = u - ↑((orthogonalProjection K) u) + ↑((orthogonalProjection K) u)

Next tactic:
simp
/-- The orthogonal projection of `y` on `U` minimizes the distance `‖y - x‖` for `x ∈ U`. -/
theorem orthogonalProjection_minimal {U : Submodule 𝕜 E} [HasOrthogonalProjection U] (y : E) :
    ‖y - orthogonalProjection U y‖ = ⨅ x : U, ‖y - 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
U : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection U
y : E
⊢ ‖y - ↑((orthogonalProjection U) y)‖ = ⨅ x, ‖y - ↑x‖

Next tactic:
rw [norm_eq_iInf_iff_inner_eq_zero _ (Submodule.coe_mem _)]
/-- The orthogonal projection of `y` on `U` minimizes the distance `‖y - x‖` for `x ∈ U`. -/
theorem orthogonalProjection_minimal {U : Submodule 𝕜 E} [HasOrthogonalProjection U] (y : E) :
    ‖y - orthogonalProjection U y‖ = ⨅ x : U, ‖y - x‖ := by
  rw [norm_eq_iInf_iff_inner_eq_zero _ (Submodule.coe_mem _)]
  

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
U : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection U
y : E
⊢ ∀ w ∈ U, inner (y - ↑((orthogonalProjection U) y)) w = 0

Next tactic:
exact orthogonalProjection_inner_eq_zero _
/-- The orthogonal projections onto equal subspaces are coerced back to the same point in `E`. -/
theorem eq_orthogonalProjection_of_eq_submodule {K' : Submodule 𝕜 E} [HasOrthogonalProjection K']
    (h : K = K') (u : E) : (orthogonalProjection K u : E) = (orthogonalProjection K' u : E) := 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
K' : Submodule 𝕜 E
inst✝ : HasOrthogonalProjection K'
h : K = K'
u : E
⊢ ↑((orthogonalProjection K) u) = ↑((orthogonalProjection K') u)

Next tactic:
subst h
/-- The orthogonal projections onto equal subspaces are coerced back to the same point in `E`. -/
theorem eq_orthogonalProjection_of_eq_submodule {K' : Submodule 𝕜 E} [HasOrthogonalProjection K']
    (h : K = K') (u : E) : (orthogonalProjection K u : E) = (orthogonalProjection K' u : E) := by
  subst h; 

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
u : E
inst✝ : HasOrthogonalProjection K
⊢ ↑((orthogonalProjection K) u) = ↑((orthogonalProjection K) u)

Next tactic:
rfl
/-- The orthogonal projection sends elements of `K` to themselves. -/
@[simp]
theorem orthogonalProjection_mem_subspace_eq_self (v : K) : orthogonalProjection K v = v := 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
v : ↥K
⊢ (orthogonalProjection K) ↑v = v

Next tactic:
ext
/-- The orthogonal projection sends elements of `K` to themselves. -/
@[simp]
theorem orthogonalProjection_mem_subspace_eq_self (v : K) : orthogonalProjection K v = v := by
  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
v : ↥K
⊢ ↑((orthogonalProjection K) ↑v) = ↑v

Next tactic:
apply eq_orthogonalProjection_of_mem_of_inner_eq_zero
/-- The orthogonal projection sends elements of `K` to themselves. -/
@[simp]
theorem orthogonalProjection_mem_subspace_eq_self (v : K) : orthogonalProjection K v = v := by
  ext
  apply eq_orthogonalProjection_of_mem_of_inner_eq_zero <;> 

Proof state:
case a.hvm
𝕜 : 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 : ↥K
⊢ ↑v ∈ K

Next tactic:
simp
/-- The orthogonal projection sends elements of `K` to themselves. -/
@[simp]
theorem orthogonalProjection_mem_subspace_eq_self (v : K) : orthogonalProjection K v = v := by
  ext
  apply eq_orthogonalProjection_of_mem_of_inner_eq_zero <;> 

Proof state:
case a.hvo
𝕜 : 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 : ↥K
⊢ ∀ w ∈ K, inner (↑v - ↑v) w = 0

Next tactic:
simp
/-- A point equals its orthogonal projection if and only if it lies in the subspace. -/
theorem orthogonalProjection_eq_self_iff {v : E} : (orthogonalProjection K v : E) = v ↔ v ∈ K := 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
v : E
⊢ ↑((orthogonalProjection K) v) = v ↔ v ∈ K

Next tactic:
refine' ⟨fun h => _, fun h => eq_orthogonalProjection_of_mem_of_inner_eq_zero h _⟩
/-- A point equals its orthogonal projection if and only if it lies in the subspace. -/
theorem orthogonalProjection_eq_self_iff {v : E} : (orthogonalProjection K v : E) = v ↔ v ∈ K := by
  refine' ⟨fun h => _, fun h => eq_orthogonalProjection_of_mem_of_inner_eq_zero h _⟩
  · 

Proof state:
case refine'_1
𝕜 : 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
h : ↑((orthogonalProjection K) v) = v
⊢ v ∈ K

Next tactic:
rw [← h]
/-- A point equals its orthogonal projection if and only if it lies in the subspace. -/
theorem orthogonalProjection_eq_self_iff {v : E} : (orthogonalProjection K v : E) = v ↔ v ∈ K := by
  refine' ⟨fun h => _, fun h => eq_orthogonalProjection_of_mem_of_inner_eq_zero h _⟩
  · rw [← h]
    

Proof state:
case refine'_1
𝕜 : 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
h : ↑((orthogonalProjection K) v) = v
⊢ ↑((orthogonalProjection K) v) ∈ K

Next tactic:
simp
/-- A point equals its orthogonal projection if and only if it lies in the subspace. -/
theorem orthogonalProjection_eq_self_iff {v : E} : (orthogonalProjection K v : E) = v ↔ v ∈ K := by
  refine' ⟨fun h => _, fun h => eq_orthogonalProjection_of_mem_of_inner_eq_zero h _⟩
  · rw [← h]
    simp
  · 

Proof state:
case refine'_2
𝕜 : 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
h : v ∈ K
⊢ ∀ w ∈ K, inner (v - v) w = 0

Next tactic:
simp
@[simp]
theorem orthogonalProjection_eq_zero_iff {v : E} : orthogonalProjection K v = 0 ↔ v ∈ Kᗮ := 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
v : E
⊢ (orthogonalProjection K) v = 0 ↔ v ∈ Kᗮ

Next tactic:
refine ⟨fun h ↦ ?_, fun h ↦ Subtype.eq <| eq_orthogonalProjection_of_mem_orthogonal
    (zero_mem _) ?_⟩
@[simp]
theorem orthogonalProjection_eq_zero_iff {v : E} : orthogonalProjection K v = 0 ↔ v ∈ Kᗮ := by
  refine ⟨fun h ↦ ?_, fun h ↦ Subtype.eq <| eq_orthogonalProjection_of_mem_orthogonal
    (zero_mem _) ?_⟩
  · 

Proof state:
case refine_1
𝕜 : 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
h : (orthogonalProjection K) v = 0
⊢ v ∈ Kᗮ

Next tactic:
simpa [h] using sub_orthogonalProjection_mem_orthogonal (K := K) v
@[simp]
theorem orthogonalProjection_eq_zero_iff {v : E} : orthogonalProjection K v = 0 ↔ v ∈ Kᗮ := by
  refine ⟨fun h ↦ ?_, fun h ↦ Subtype.eq <| eq_orthogonalProjection_of_mem_orthogonal
    (zero_mem _) ?_⟩
  · simpa [h] using sub_orthogonalProjection_mem_orthogonal (K := K) v
  · 

Proof state:
case refine_2
𝕜 : 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
h : v ∈ Kᗮ
⊢ v - ↑0 ∈ Kᗮ

Next tactic:
simpa
@[simp]
theorem ker_orthogonalProjection : LinearMap.ker (orthogonalProjection K) = Kᗮ := 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
⊢ LinearMap.ker (orthogonalProjection K) = Kᗮ

Next tactic:
ext
@[simp]
theorem ker_orthogonalProjection : LinearMap.ker (orthogonalProjection K) = Kᗮ := by
  ext; 

Proof state:
case h
𝕜 : 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✝ : E
⊢ x✝ ∈ LinearMap.ker (orthogonalProjection K) ↔ x✝ ∈ Kᗮ

Next tactic:
exact orthogonalProjection_eq_zero_iff
theorem LinearIsometry.map_orthogonalProjection {E E' : Type*} [NormedAddCommGroup E]
    [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E →ₗᵢ[𝕜] E')
    (p : Submodule 𝕜 E) [HasOrthogonalProjection p] [HasOrthogonalProjection (p.map f.toLinearMap)]
    (x : E) : f (orthogonalProjection p x) = orthogonalProjection (p.map f.toLinearMap) (f 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
E : Type u_4
E' : Type u_5
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup E'
inst✝³ : InnerProductSpace 𝕜 E
inst✝² : InnerProductSpace 𝕜 E'
f : E →ₗᵢ[𝕜] E'
p : Submodule 𝕜 E
inst✝¹ : HasOrthogonalProjection p
inst✝ : HasOrthogonalProjection (Submodule.map f.toLinearMap p)
x : E
⊢ f ↑((orthogonalProjection p) x) = ↑((orthogonalProjection (Submodule.map f.toLinearMap p)) (f x))

Next tactic:
refine' (eq_orthogonalProjection_of_mem_of_inner_eq_zero _ fun y hy => _).symm
theorem LinearIsometry.map_orthogonalProjection {E E' : Type*} [NormedAddCommGroup E]
    [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E →ₗᵢ[𝕜] E')
    (p : Submodule 𝕜 E) [HasOrthogonalProjection p] [HasOrthogonalProjection (p.map f.toLinearMap)]
    (x : E) : f (orthogonalProjection p x) = orthogonalProjection (p.map f.toLinearMap) (f x) := by
  refine' (eq_orthogonalProjection_of_mem_of_inner_eq_zero _ fun y hy => _).symm
  

Proof state:
case refine'_1
𝕜 : 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
E : Type u_4
E' : Type u_5
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup E'
inst✝³ : InnerProductSpace 𝕜 E
inst✝² : InnerProductSpace 𝕜 E'
f : E →ₗᵢ[𝕜] E'
p : Submodule 𝕜 E
inst✝¹ : HasOrthogonalProjection p
inst✝ : HasOrthogonalProjection (Submodule.map f.toLinearMap p)
x : E
⊢ f ↑((orthogonalProjection p) x) ∈ Submodule.map f.toLinearMap p
case refine'_2
𝕜 : 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
E : Type u_4
E' : Type u_5
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup E'
inst✝³ : InnerProductSpace 𝕜 E
inst✝² : InnerProductSpace 𝕜 E'
f : E →ₗᵢ[𝕜] E'
p : Submodule 𝕜 E
inst✝¹ : HasOrthogonalProjection p
inst✝ : HasOrthogonalProjection (Submodule.map f.toLinearMap p)
x : E
y : E'
hy : y ∈ Submodule.map f.toLinearMap p
⊢ inner (f x - f ↑((orthogonalProjection p) x)) y = 0

Next tactic:
refine' Submodule.apply_coe_mem_map _ _
theorem LinearIsometry.map_orthogonalProjection {E E' : Type*} [NormedAddCommGroup E]
    [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 E'] (f : E →ₗᵢ[𝕜] E')
    (p : Submodule 𝕜 E) [HasOrthogonalProjection p] [HasOrthogonalProjection (p.map f.toLinearMap)]
    (x : E) : f (orthogonalProjection p x) = orthogonalProjection (p.map f.toLinearMap) (f x) := by
  refine' (eq_orthogonalProjection_of_mem_of_inner_eq_zero _ fun y hy => _).symm
  refine' Submodule.apply_coe_mem_map _ _
  

Proof state:
case refine'_2
𝕜 : 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
E : Type u_4
E' : Type u_5
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup E'
inst✝³ : InnerProductSpace 𝕜 E
inst✝² : InnerProductSpace 𝕜 E'
f : E →ₗᵢ[𝕜] E'
p : Submodule 𝕜 E
inst✝¹ : HasOrthogonalProjection p
inst✝ : HasOrthogonalProjection (Submodule.map f.toLinearMap p)
x : E
y : E'
hy : y ∈ Submodule.map f.toLinearMap p
⊢ inner (f x - f ↑((orthogonalProjection p) x)) y = 0

Next tactic:
rcases hy with ⟨x', hx', rfl : f x' = y⟩