Documentation

CslibFrontier.Foundations.Data.BitString.Parity.DotProduct

Inner products of bit strings as parities #

Over the two-element Boolean ring, the inner product x ⬝ᵥ w = Σᵢ xᵢ wᵢ of two bit strings is the parity of x on the support of w (Cslib.BitString.dotProduct_eq_parityOn). Parities on nonempty sets are balanced (Cslib.card_filter_parityOn_eq), so the inner product with a fixed nonzero string takes each value on half of the strings (Cslib.BitString.card_dotProduct_eq_false). Consequently a nonzero string lies in the kernel of exactly 2 ^ ((d - 1) c) of the 2 ^ (d c) matrices with c rows (Cslib.BitString.card_kernel). Since v, w and v + w are all nonzero for distinct nonzero v and w, inclusion–exclusion shows that a quarter of the strings are orthogonal to both (Cslib.BitString.card_dotProduct_eq_false_and_eq_false), so both lie in the kernel of a 4 ^ c-th of the matrices (Cslib.BitString.card_kernel_pair).

Main results #

theorem Cslib.BitString.dotProduct_eq_parityOn {ι : Type u_1} [Fintype ι] (x w : ι → Bool) :
x ⬝ᵥ w = parityOn {i : ι | w i = true} x

The inner product with w is the parity on the support of w.

theorem Cslib.BitString.card_dotProduct_eq_false {d : ℕ} {w : Fin d → Bool} (hw : w ≠ 0) :
{x : Fin d → Bool | x ⬝ᵥ w = false}.card = 2 ^ (d - 1)

The rows orthogonal to a nonzero w: 2 ^ (d - 1) of the 2 ^ d.

theorem Cslib.BitString.card_kernel {c d : ℕ} {w : Fin d → Bool} (hw : w ≠ 0) :
{A : Fin c → Fin d → Bool | ∀ (i : Fin c), A i ⬝ᵥ w = false}.card = (2 ^ (d - 1)) ^ c

Matrices with c rows whose kernel contains a nonzero w: 2 ^ ((d - 1) c).

theorem Cslib.BitString.card_dotProduct_eq_false_and_eq_false {d : ℕ} {v w : Fin d → Bool} (hv : v ≠ 0) (hw : w ≠ 0) (hvw : v ≠ w) :
{x : Fin d → Bool | x ⬝ᵥ v = false ∧ x ⬝ᵥ w = false}.card * 4 = 2 ^ d

The rows orthogonal to two distinct nonzero strings v and w: a quarter of the 2 ^ d.

theorem Cslib.BitString.card_kernel_pair {c d : ℕ} {v w : Fin d → Bool} (hv : v ≠ 0) (hw : w ≠ 0) (hvw : v ≠ w) :
{A : Fin c → Fin d → Bool | ∀ (i : Fin c), A i ⬝ᵥ v = false ∧ A i ⬝ᵥ w = false}.card * 4 ^ c = 2 ^ (d * c)

Matrices with c rows whose kernel contains two distinct nonzero strings v and w: a 4 ^ c-th of the 2 ^ (d c).