is_two_four_code
def
A set of codewords $C \subseteq (\mathrm{Fin}\, n \to \mathrm{Fin}\, q)$ is a $\{2, 4\}$-code if any two distinct codewords $x, y \in C$ have Hamming distance $\mathrm{hammingDist}(x, y) \in \{2, 4\}$.
Statement
def is_two_four_code {n q : ℕ} (C : Set (Fin n → Fin q)) : Prop
- Defined in
- arXiv:2610.30613, Section 1
- Verified
- 23 Oct 2026
- Axioms
- none listed
- Used by 4
- is_two_four_code_singletonAny singleton set $\{x\} \subseteq (\mathrm{Fin}\, n \to \mathrm{Fin}\, q)$ is a $\{2, 4\}$-code.
- two_four_code_card_achievableFor every alphabet size $q \ge 2$ and every length $n$, there is a $\{2,4\}$-code $C \subseteq (\mathrm{Fin}\, n \to \mathrm{Fin}\, q)$ of…
- two_four_code_max_cardFor integers $q$ and $n$, $A_q(n, \{2,4\})$ is the supremum of cardinalities of finite subsets of $\mathrm{Fin}\, n \to \mathrm{Fin}\, q$…
- two_four_code_max_card_geFor every $q \ge 2$ and every $n$, $1 + \binom{n}{2} \le A_q(n,\{2,4\})$, i.e. the extremal code of the previous lemma is counted by the…
Read back from the Lean
For natural numbers $n$ and $q$ (implicit), and a set $C \subseteq (\mathrm{Fin}\ n \to \mathrm{Fin}\ q)$, is_two_four_code C is defined to hold if and only if for all $x \in C$ and all $y \in C$, if $x \neq y$, then the Hamming distance between $x$ and $y$ is equal to 2 or equal to 4.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- A subset C of (Fin n → Fin q) is a {2,4}-code if every pair of distinct codewords has Hamming distance 2 or 4. -/ def is_two_four_code {n q : ℕ} (C : Set (Fin n → Fin q)) : Prop := ∀ x ∈ C, ∀ y ∈ C, x ≠ y → hammingDist x y = 2 ∨ hammingDist x y = 4