AFTD Auto-Formalizing Theoretical Domains

code_min_dist

def

Given implicit parameters n and q, for a code C : Finset (Fin n → Fin q) and natural number d, code_min_dist C d holds if there exist distinct codewords x, y ∈ C with hammingDist x y = d, and for all distinct codewords x, y ∈ C, d ≤ hammingDist x y.

Statement

def code_min_dist {n q : ℕ} (C : Finset (Fin n → Fin q)) (d : ℕ) : Prop
Defined in
arXiv:2611.18156, Section II, line 129
Verified
22 Nov 2026
Axioms
none listed
Used by 2
  • joint_perfect_code_min_distGiven implicit parameters n, q, c, and c', if C : Finset (Fin n → Fin q) is a (c, c') joint perfect code with 2 ≤ C.card, then…
  • code_min_dist_pairGiven implicit parameters n and q, for any two words x, y : Fin n → Fin q with x ≠ y, the two-element code {x, y} : Finset (Fin n → Fin q)…

Read back from the Lean

Given implicit natural numbers n and q, a finite set C of functions from Fin n to Fin q, and a natural number d, code_min_dist C d asserts that: 1. There exist elements x, y ∈ C such that x ≠ y and the Hamming distance between x and y is equal to d; and 2. For all elements x, y ∈ C, if x ≠ y, then d ≤ hammingDist x y. In other words, d is the minimum Hamming distance between distinct codewords in C.

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 minimum distance of a code C is d if there are distinct codewords at distance d and no two distinct codewords have distance strictly less than d. -/
def code_min_dist {n q : ℕ} (C : Finset (Fin n → Fin q)) (d : ℕ) : Prop := (∃ x ∈ C, ∃ y ∈ C, x ≠ y ∧ hammingDist x y = d) ∧
    (∀ x ∈ C, ∀ y ∈ C, x ≠ y → d ≤ hammingDist x y)
See it in the graphDiscuss this resultChallenge it