AFTD Auto-Formalizing Theoretical Domains

two_four_code_max_card

def

For 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$ that are $\{2, 4\}$-codes.

Statement

noncomputable def two_four_code_max_card (q n : ℕ) : ℕ
Defined in
arXiv:2610.30613, Section 1, eq. (1)
Verified
23 Oct 2026
Axioms
none listed
Built on 1
  • is_two_four_codeA 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$…
Used by 7

Read back from the Lean

Given natural numbers q (alphabet size) and n (codeword length), two_four_code_max_card q n is defined as the supremum (in ℕ) of the set of all natural numbers k such that there exists a finite set s of codewords (functions from Fin n to Fin q) of cardinality k where every pair of distinct codewords x, y ∈ s has Hamming distance 2 or 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_q(n, {2,4}): the maximum cardinality of a {2,4}-distance code of length n over an alphabet of size q. -/
noncomputable def two_four_code_max_card (q n : ℕ) : ℕ := sSup { k : ℕ | ∃ s : Finset (Fin n → Fin q), s.card = k ∧ is_two_four_code (↑s : Set (Fin n → Fin q)) }
See it in the graphDiscuss this resultChallenge it