AFTD Auto-Formalizing Theoretical Domains

CodingTheory.Johnson.coord_mul_pmOne

theoremverifiedimported Lean

Coordinatewise product of $\pm 1$ embeddings. Let $x, y$ be binary words of length $n$, and encode each as a $\pm 1$ vector in $\bbr^n$ by sending its $i$-th bit to $-1$ when that bit is true and to $+1$ when it is false. Then for every coordinate $i$, the product of the $i$-th entries of these two embeddings equals $1$ if $x_i = y_i$ and $-1$ if $x_i \ne y_i$.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open scoped BigOperators RealInnerProductSpace in
open Finset in
lemma CodingTheory.Johnson.coord_mul_pmOne {n : ℕ} (x y : BitVec n) (i : Fin n) :
    (pmOne x i) * (pmOne y i) = if x i = y i then (1 : ℝ) else (-1 : ℝ)
Source
TCSlib, `CodingTheory.Johnson.coord_mul_pmOne`
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.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • CodingTheory.Johnson.BitVecThe type of binary words of length $n$, namely functions $\mathrm{Fin}\,n \to \mathrm{Bool}$.
  • CodingTheory.Johnson.pmOneThe map sending a binary word $x$ to the real vector in $\mathbb{R}^n$ whose $i$-th coordinate is $-1$ if $x_i = \texttt{true}$ and $+1$…
Used by 1

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen scoped BigOperators RealInnerProductSpace inopen Finset inlemma CodingTheory.Johnson.coord_mul_pmOne {n : ℕ} (x y : BitVec n) (i : Fin n) :    (pmOne x i) * (pmOne y i) = if x i = y i then (1 : ℝ) else (-1 : ℝ) := by  by_cases hx : x i <;> by_cases hy : y i <;> simp [pmOne, hx, hy]
See it in the graphDiscuss this resultChallenge it