AFTD Auto-Formalizing Theoretical Domains

hamming_ball

def

Given implicit parameters n and q, the Hamming ball hamming_ball r x of radius r centered at x : Fin n → Fin q is the finite set (Finset) of all y : Fin n → Fin q with hammingDist x y ≤ r.

Statement

def hamming_ball {n q : ℕ} (r : ℕ) (x : Fin n → Fin q) : Finset (Fin n → Fin q)
Defined in
arXiv:2611.18156 Section II
Verified
16 Nov 2026
Axioms
none listed
Used by 6
  • is_joint_error_correcting_detectingGiven implicit parameters n and q, a code C : Finset (Fin n → Fin q) is a (c, c') joint error-correcting and detecting code if distinct…
  • binary_repetition_code_is_joint_error_correcting_detectingFor an explicit natural number n with 2 ≤ n and natural numbers c, c' such that 2 * c + c' + 1 = n, binary_repetition_code n is a (c,…
  • joint_hamming_boundLet q ≥ 2, n ≥ 1, and let c, c' be non-negative integers with c + c' ≤ n. If C ⊆ (Fin n → Fin q) is a (c, c') joint error-correcting and…
  • card_hamming_ballFor natural numbers n, q, r with 2 ≤ q and r ≤ n, and any x : Fin n → Fin q, the cardinality of the Hamming ball of radius r centered at x…
  • hamming_ring_subset_ballGiven implicit parameters n and q, for any x : Fin n → Fin q, the (c, c') Hamming ring centered at x is a subset of the Hamming ball of…
  • disjoint_hamming_ball_hamming_ring_sameGiven implicit parameters n and q, for any point x : Fin n → Fin q, the Hamming ball of radius c centered at x and the (c, c') Hamming…

Read back from the Lean

Given implicit natural numbers $n$ and $q$, a natural number $r$, and a function $x : \mathrm{Fin}\ n \to \mathrm{Fin}\ q$, hamming_ball r x is the finite set of all functions $y : \mathrm{Fin}\ n \to \mathrm{Fin}\ q$ such that the Hamming distance between $x$ and $y$ (hammingDist x y) is less than or equal to $r$.

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

/-- The Hamming ball of radius r centered at x in (Fin n → Fin q), as a Finset. -/
def hamming_ball {n q : ℕ} (r : ℕ) (x : Fin n → Fin q) : Finset (Fin n → Fin q) :=
  Finset.filter (fun y => hammingDist x y ≤ r) Finset.univ
See it in the graphDiscuss this resultChallenge it