AFTD Auto-Formalizing Theoretical Domains

CodingTheory.Johnson.orthProj_mem_orthogonal

theoremverifiedimported Lean

Projection off a unit vector lands in the orthogonal complement. Let $V$ be a real inner product space, and let $u,v \in V$ with $\norm{u} = 1$. Then the vector $v - \langle u,v\rangle\, u$ lies in the orthogonal complement $(\mathrm{span}_{\bbr}\{u\})^{\perp}$ of the line spanned by $u$.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open scoped BigOperators RealInnerProductSpace in
open Finset in
open Classical in
open scoped RealInnerProductSpace in
open scoped InnerProductSpace in
open Finset in
open Classical in
attribute [local instance] Classical.dec in
lemma CodingTheory.Johnson.orthProj_mem_orthogonal {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
    (u v : V) (hu : ‖u‖ = 1) :
    orthProj u v ∈ (Submodule.span ℝ {u})ᗮ
Source
TCSlib, `CodingTheory.Johnson.orthProj_mem_orthogonal`
Lean proof
By Allan Li, Frederick Dehmel, Hydroxyi (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
What was changed in CodingTheory.Johnson.orthProj_mem_orthogonal
--- TCSlib/ErrorCorrectingCodes/JohnsonBound.lean:252 (CodingTheory.Johnson.orthProj_mem_orthogonal)
+++ as compiled here
@@ -1,2 +1,12 @@
-lemma orthProj_mem_orthogonal {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
+set_option autoImplicit true in
+set_option relaxedAutoImplicit true in
+open scoped BigOperators RealInnerProductSpace in
+open Finset in
+open Classical in
+open scoped RealInnerProductSpace in
+open scoped InnerProductSpace in
+open Finset in
+open Classical in
+attribute [local instance] Classical.dec in
+lemma CodingTheory.Johnson.orthProj_mem_orthogonal {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
     (u v : V) (hu : ‖u‖ = 1) :
@@ -8,3 +18,3 @@
       simp +decide [ inner_sub_right, inner_smul_left, inner_smul_right ];
-      rw [real_inner_self_eq_norm_sq, hu]; ring
+      rw [hu]; ring
 /-
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • CodingTheory.Johnson.orthProjFor $u,v$ in a real inner product space, $\mathrm{orthProj}(u,v) = v - \langle u,v\rangle u$, the projection of $v$ onto the orthogonal…
Used by 1
  • CodingTheory.Johnson.mkProjGiven a unit vector $u$, this packages the normalized projection $\norm{\mathrm{orthProj}(u,v)}^{-1}\mathrm{orthProj}(u,v)$ together with…

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen scoped BigOperators RealInnerProductSpace inopen Finset inopen Classical inopen scoped RealInnerProductSpace inopen scoped InnerProductSpace inopen Finset inopen Classical inattribute [local instance] Classical.dec inlemma CodingTheory.Johnson.orthProj_mem_orthogonal {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]    (u v : V) (hu : ‖u‖ = 1) :    orthProj u v ∈ (Submodule.span ℝ {u})ᗮ := by      intro x hx      obtain ⟨k, rfl⟩ : ∃ k : ℝ, x = k • u := by        exact Submodule.mem_span_singleton.mp hx |> Exists.imp fun k hk => hk.symm      simp [orthProj] at *;      simp +decide [ inner_sub_right, inner_smul_left, inner_smul_right ];      rw [hu]; ring/-PROVIDED SOLUTIONIf v - ⟪u,v⟫•u = 0, then v = ⟪u,v⟫•u. Taking norms: 1 = |⟪u,v⟫|·1, so |⟪u,v⟫| = 1, meaning v = u or v = -u, contradiction.-/
See it in the graphDiscuss this resultChallenge it