card_codeword_supp
The cardinality of the support $\mathrm{codeword\_supp}(x)$ of a codeword $x : \mathrm{Fin}\, n \to \alpha$ equals its Hamming weight $\mathrm{hammingNorm}(x)$.
Statement
theorem card_codeword_supp {n : ℕ} {α : Type*} [DecidableEq α] [Zero α] (x : Fin n → α) : (codeword_supp x).card = hammingNorm x
- Source
- arXiv:2610.30613, Section 2
- Verified
- 25 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- codeword_suppThe support of a codeword $x : \mathrm{Fin}\, n \to \alpha$ over an alphabet $\alpha$ with decidable equality and zero is the finite set…
Read back from the Lean
For any natural number $n$, any type $\alpha$ with decidable equality and a zero element, and any vector $x : \text{Fin } n \to \alpha$, the cardinality of the codeword support of $x$ (codeword_supp x) equals the Hamming norm of $x$ (hammingNorm x).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
The statement holds by definitional equality. The Hamming norm of a codeword is defined as the cardinality of the set of coordinates where it is nonzero, which coincides with the definition of the cardinality of its support.
The cardinality of the support of $x$ equals its Hamming weight by definition: $(\mathrm{codeword\_supp}(x)).\mathrm{card} = \mathrm{hammingNorm}(x)$.
The Hamming norm $\mathrm{hammingNorm}(x)$ is defined as the cardinality of the finset of indices where $x(i) \neq 0$, which is syntactically identical to the definition of $\mathrm{codeword\_supp}(x)$. Because both sides expand to the same expression, the equality holds by reflexivity (`rfl`).
(codeword_supp x).card = hammingNorm x := rfl
Written by a model (gemini-3.8-flash) from the Lean source alone (no goal states were available). Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
/-- The cardinality of the support of a codeword is its Hamming weight (hammingNorm). -/theorem card_codeword_supp {n : ℕ} {α : Type*} [DecidableEq α] [Zero α] (x : Fin n → α) : (codeword_supp x).card = hammingNorm x := rfl