A binary Hamming mask dictionary has exact size and covers within one edit
ProvedPvsNP.binary_hamming_mask_cover_countcombinatoricscomplexity-theory
Use all nonzero binary d-vectors as the columns of a parity-check matrix. The zero-syndrome length-(2^d−1) words form a dictionary of cardinality 2^(2^d−1−d), and every binary word is at Hamming distance at most one from the dictionary.
Preamble
import Mathlib set_option autoImplicit false
Formal statement
theorem PvsNP.binary_hamming_mask_cover_count (d : ℕ) :
let columns := {v : Fin d → ZMod 2 // v ≠ 0}
let synd (x : columns → ZMod 2) : Fin d → ZMod 2 :=
Finset.univ.sum (fun i : columns => x i • i.val)
Fintype.card {x : columns → ZMod 2 // synd x = 0} = 2 ^ (2 ^ d - 1 - d) ∧
(∀ word : columns → ZMod 2, ∃ x : columns → ZMod 2, synd x = 0 ∧
(Finset.univ.filter fun i => word i ≠ x i).card ≤ 1) := by sorrySource
Hamming (1950), Error Detecting and Error Correcting Codes. Used for grouped approximate circuit synthesis.