Documentation

CommunicationComplexity.Hamming

Hamming balls and volume #

Definitions and cardinality results for Hamming balls and spheres over finite alphabets. Used in distributional lower bounds (e.g., the randomized indexing lower bound via Roughgarden's counting argument).

Ported from CS 294 lecture exercises (lec-294/lec6.lean).

Main definitions #

Main results #

@[reducible, inline]
abbrev CommunicationComplexity.Word (n : ) (α : Type u_2) :
Type u_2

A codeword of length n over alphabet α.

Equations
Instances For
    def CommunicationComplexity.hammingBall {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (u : Word n α) (r : ) :
    Finset (Word n α)

    The Hamming ball of radius r centered at u: all words within distance r.

    Equations
    Instances For
      def CommunicationComplexity.hammingSphere {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (u : Word n α) (r : ) :
      Finset (Word n α)

      The Hamming sphere of radius r centered at u: all words at exactly distance r.

      Equations
      Instances For

        The volume of a Hamming ball: Σ_{i=0}^{t} C(n, i) · (q-1)^i.

        Equations
        Instances For

          Sphere and ball decomposition #

          theorem CommunicationComplexity.hammingSpheres_disjoint {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (u : Word n α) (r t : ) (hrt : r t) :
          theorem CommunicationComplexity.hammingBall_eq_hammingSpheres {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (u : Word n α) (r : ) :
          hammingBall u r = (Finset.range (r + 1)).disjiUnion (fun (k : ) => hammingSphere u k)

          Support fibers and sphere cardinality #

          theorem CommunicationComplexity.hammingSphere_card {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (u : Word n α) (k : ) :
          (hammingSphere u k).card = n.choose k * (Fintype.card α - 1) ^ k
          theorem CommunicationComplexity.hammingBall_card {α : Type u_1} [Fintype α] [DecidableEq α] {n : } (u : Word n α) (r : ) :
          theorem CommunicationComplexity.ballVol_binary (n t : ) :
          ballVol n t 2 = iFinset.range (t + 1), n.choose i

          Binary Hamming ball volume: Σ_{i=0}^{t} C(n, i).