A binary Hamming mask dictionary has exact size and covers within one edit
OpenPvsNP.binary_hamming_dictionary_count_and_covercombinatoricscomplexity-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.
Retired because the target preamble contained local definitions that the proof comparator could not elaborate. The replacement is PvsNP.binary_hamming_mask_cover_count, with the definitions inside the statement.
Preamble
import Mathlib
set_option autoImplicit false
namespace PvsNP.HammingMaskCover
open scoped BigOperators
noncomputable section
attribute [local instance] Classical.propDecidable
/-- The positions of the binary Hamming code are the nonzero syndromes. -/
abbrev Column (d : ℕ) := {v : Fin d → ZMod 2 // v ≠ 0}
abbrev Mask (d : ℕ) := Column d → ZMod 2
def syndrome {d : ℕ} (word : Mask d) : Fin d → ZMod 2 :=
∑ i, word i • i.val
end
end PvsNP.HammingMaskCover
open PvsNP.HammingMaskCover
Formal statement
theorem PvsNP.binary_hamming_dictionary_count_and_cover (d : ℕ) :
Fintype.card {x : Mask d // syndrome x = 0} = 2 ^ (2 ^ d - 1 - d) ∧
(∀ word : Mask d, ∃ x : Mask d, syndrome 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.