AFTD Auto-Formalizing Theoretical Domains

codeProj_eq_self_of_mem

theoremverifiedimported Lean

Projection onto a code fixes its own vectors. Let $C$ be a subspace of the $n$-qubit Hilbert space $\mathcal{H}_n$, and let $P_C : \mathcal{H}_n \to \mathcal{H}_n$ be the orthogonal projection onto $C$. If $x \in C$, then $P_C x = x$.

Statement

set_option linter.mathlibStandardSet false in
open scoped BigOperators in
open scoped Real in
open scoped Nat in
open scoped Classical in
open scoped Pointwise in
set_option maxRecDepth 4000 in
set_option synthInstance.maxHeartbeats 20000 in
set_option synthInstance.maxSize 128 in
set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open Complex Matrix in
lemma codeProj_eq_self_of_mem {n : ℕ} {C : Submodule ℂ (Hn n)} {x : Hn n} (hx : x ∈ C) :
    codeProj C x = x
Source
TCSlib, `codeProj_eq_self_of_mem`
Lean proof
By Allan Li, 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.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • HnThe $n$-qubit Hilbert space $\mathcal{H}_n = \ell^2\!\bigl(\{0,1\}^n,\mathbb{C}\bigr)$, implemented as \texttt{EuclideanSpace ℂ (Fin n →…
  • codeProjThe orthogonal projection of $\mathcal{H}_n$ onto a subspace $C$, viewed as an endomorphism $P_C : \mathcal{H}_n \to \mathcal{H}_n$.
Used by 1
  • error_subspaces_orthogonalOrthogonality of distinct error subspaces. Let $C \le \mathcal{H}_n$ be a code that is non-degenerate for $t$-error correction, and let…

Lean source view module on GitHub

set_option linter.mathlibStandardSet false inopen scoped BigOperators inopen scoped Real inopen scoped Nat inopen scoped Classical inopen scoped Pointwise inset_option maxRecDepth 4000 inset_option synthInstance.maxHeartbeats 20000 inset_option synthInstance.maxSize 128 inset_option relaxedAutoImplicit false inset_option autoImplicit false inopen Complex Matrix inlemma codeProj_eq_self_of_mem {n : ℕ} {C : Submodule ℂ (Hn n)} {x : Hn n} (hx : x ∈ C) :    codeProj C x = x := by  have h_proj : ∀ x : Hn n, x ∈ C → Submodule.orthogonalProjection C x = x := by    intros x hx    apply Submodule.starProjection_eq_self_iff.mpr hx;  apply h_proj; assumption
See it in the graphDiscuss this resultChallenge it