TCSLib

77 Communication Complexity — Bit String

77.1 Overview

This module introduces \(n\)-bit strings as Boolean-valued functions on \(\mathrm{Fin}\, n\) and develops the signed inner product of two such strings under the standard \(\{ 0,1\} \to \{ \pm 1\} \) correspondence. The main results relate the signed inner product to the Hamming distance: it equals \(n - 2\, \mathrm{hammingDist}(x,y)\), and it is additive under concatenation and multiplicative under repetition.

77.2 Declarations

Definition 77.1 Bit string
✓
#

An \(n\)-bit string is a function \(x : \mathrm{Fin}\, n \to \mathrm{Bool}\). The type \(\texttt{CommunicationComplexity.BitString}\, n\) is an abbreviation for \(\mathrm{Fin}\, n \to \mathrm{Bool}\).

Definition 77.2 Signed inner product
✓

Given two \(n\)-bit strings \(x, y : \mathrm{Fin}\, n \to \mathrm{Bool}\), their signed inner product is the integer

\[ \mathrm{signedInner}(x, y) \; =\; \sum _{i=0}^{n-1} \begin{cases} 1 & \text{if } x_i = y_i,\\ -1 & \text{if } x_i \neq y_i.\end{cases} \]

Each coordinate where \(x\) and \(y\) agree contributes \(+1\), and each disagreeing coordinate contributes \(-1\).

Definition 77.3 Agreement count
✓

The agreement count of two \(n\)-bit strings \(x\) and \(y\) is the number of coordinates \(i \in \mathrm{Fin}\, n\) on which \(x_i = y_i\), i.e., \(\# \{ i : x_i = y_i\} \) as a natural number.

Theorem 77.4 Agreement count plus Hamming distance equals length
✓

Let \(x\) and \(y\) be \(n\)-bit strings. Then the number of coordinates on which \(x\) and \(y\) agree, together with their Hamming distance \(d(x, y)\) — the number of coordinates on which they differ — sums to the length:

\[ \# \{ i : x_i = y_i\} + d(x, y) = n. \]
Theorem 77.5 Agreement count as complement of Hamming distance
✓

Let \(x, y : \mathrm{Fin}\, n \to \mathrm{Bool}\) be two \(n\)-bit strings, with agreement count \(\mathrm{agr}(x,y)\) the number of coordinates on which they coincide and \(d_H(x,y)\) their Hamming distance (the number of coordinates on which they differ). Then, as an identity of integers,

\[ \mathrm{agr}(x,y) = n - d_H(x,y). \]
Theorem 77.6 Signed inner product via Hamming distance
✓

Let \(x, y\) be two \(n\)-bit strings, that is, functions from \(\{ 0, 1, \dots , n-1\} \) to \(\{ 0,1\} \), and let \(d(x,y)\) denote their Hamming distance, the number of coordinates on which they disagree. Then their signed inner product — the sum over all coordinates of \(+1\) where \(x\) and \(y\) agree and \(-1\) where they disagree — satisfies

\[ \langle x, y\rangle _{\pm } \; =\; n - 2\, d(x, y). \]
Theorem 77.7 Signed inner product as agreements minus Hamming distance
✓

Let \(x\) and \(y\) be two \(n\)-bit strings. Their signed inner product \(\langle x, y\rangle \) is the integer \(\sum _{i} \varepsilon _i\), where \(\varepsilon _i = +1\) at each coordinate \(i\) on which \(x_i = y_i\) and \(\varepsilon _i = -1\) at each coordinate on which \(x_i \neq y_i\). Writing \(a(x,y)\) for the agreement count of \(x\) and \(y\), the number of coordinates on which they agree, and \(d_H(x,y)\) for the Hamming distance between them, the number of coordinates on which they differ, one has

\[ \langle x, y\rangle \; =\; a(x,y) - d_H(x,y), \]

an equality of integers in which the two counts are regarded as integers.

Theorem 77.8 Additivity of the signed inner product under concatenation
✓

Let \(x_1, y_1 : \mathrm{Fin}\, m \to \mathrm{Bool}\) be \(m\)-bit strings and \(x_2, y_2 : \mathrm{Fin}\, n \to \mathrm{Bool}\) be \(n\)-bit strings, and write \(x_1 \frown x_2\) for the length-\((m+n)\) string obtained by concatenation, whose first \(m\) coordinates are those of \(x_1\) and whose last \(n\) coordinates are those of \(x_2\). Writing \(\langle x, y\rangle \) for the signed inner product of two equal-length bit strings — the number of coordinates on which they agree minus the number on which they disagree — the signed inner product of the two concatenations splits as the sum of the block-wise signed inner products:

\[ \langle x_1 \frown x_2,\; y_1 \frown y_2\rangle \; =\; \langle x_1, y_1\rangle + \langle x_2, y_2\rangle . \]
Theorem 77.9 Invariance of the signed inner product under reindexing
✓

Let \(m\) and \(n\) be natural numbers with \(m = n\), and let \(x, y \colon \mathrm{Fin}\, n \to \mathrm{Bool}\) be two \(n\)-bit strings, writing \(\langle x, y\rangle \) for their signed inner product. The equality \(m = n\) gives a bijection \(\sigma \colon \mathrm{Fin}\, m \to \mathrm{Fin}\, n\), and precomposing with it turns \(x\) and \(y\) into the \(m\)-bit strings \(x \circ \sigma \) and \(y \circ \sigma \). Then reindexing both strings in this way leaves the signed inner product unchanged:

\[ \langle x \circ \sigma ,\; y \circ \sigma \rangle \; =\; \langle x, y\rangle . \]
Theorem 77.10 Signed inner product scales under repetition
✓

Let \(x, y \colon \{ 0, \dots , n-1\} \to \{ 0,1\} \) be two \(n\)-bit strings, and write \(\langle x, y\rangle \) for their signed inner product, the integer \(\sum _{i} \sigma _i\) where \(\sigma _i = +1\) when \(x_i = y_i\) and \(\sigma _i = -1\) otherwise. For a natural number \(a\), let \(x^{(a)}\) and \(y^{(a)}\) denote the \(an\)-bit strings obtained by concatenating \(a\) consecutive copies of \(x\) and of \(y\), respectively. Then

\[ \langle x^{(a)}, y^{(a)}\rangle \; =\; a \cdot \langle x, y\rangle . \]