Documentation

CslibFrontier.Foundations.Data.Code.OddCircuit

Odd circuits and one extra parity check #

A finite set S of vectors is a zero-sum circuit (Cslib.Code.IsZeroSumCircuit) when it is nonempty, sums to zero, and no nonempty proper subset sums to zero. Over 𝔽₂ = ZMod 2 these are exactly the inclusion-minimal linearly dependent sets of vectors.

Saglam's refinement of the folklore union-bound argument for linear codes [Sag26] rests on two facts about a finite set K of vectors over 𝔽₂.

Counting matrices then gives: if the odd circuits S of a finite set B satisfy ∑_S 2 ^ (-m (|S| - 1)) < 1, some M ∈ 𝔽₂^{m × ι} leaves no odd circuit of B in its kernel, and appending the extra row to M gives an (m + 1)-row matrix whose kernel misses B (Cslib.Code.exists_mulVec_ne_zero_of_sum_lt_one). For B the nonzero words of weight less than d this is a parity-check matrix of a linear code of minimum distance at least d (Cslib.Code.exists_le_minDist_parityCheckCode_of_sum_lt_one). This is the deterministic part of [Saglam2027, Sections 1–2]; the sum is the expected number 𝔼 Z of odd circuits in the kernel, bounded there by Fourier analysis (Cslib.Code.OddCircuitFourier).

Main definitions #

Main results #

References #

A zero-sum circuit: a nonempty finite set S whose elements sum to zero while no nonempty proper subset of S sums to zero. Over ZMod 2 these are the inclusion-minimal linearly dependent sets of vectors.

Instances For
    theorem Cslib.Code.isZeroSumCircuit_iff {G : Type u_1} [AddCommGroup G] {S : Finset G} :
    IsZeroSumCircuit S ↔ S.Nonempty ∧ ∑ x ∈ S, x = 0 ∧ ∀ T ⊂ S, T.Nonempty → ∑ x ∈ T, x ≠ 0
    theorem Cslib.Code.IsZeroSumCircuit.sum_eq_zero {G : Type u_1} [AddCommGroup G] {S : Finset G} (hS : IsZeroSumCircuit S) :
    ∑ x ∈ S, x = 0

    A zero-sum circuit sums to zero.

    theorem Cslib.Code.exists_isZeroSumCircuit_odd {G : Type u_1} [AddCommGroup G] {T : Finset G} (hT : ∑ x ∈ T, x = 0) (hodd : Odd T.card) :
    ∃ S ⊆ T, IsZeroSumCircuit S ∧ Odd S.card

    Odd zero-sum sets contain odd circuits [Saglam2027, Section 2]. A smallest odd zero-sum subset is a circuit: removing a nonempty zero-sum proper subset would leave a smaller odd one.

    theorem Cslib.Code.sum_zmodTwo_smul_eq_sum_filter {G : Type u_1} [AddCommGroup G] [Module (ZMod 2) G] {α : Type u_2} (s : Finset α) (a : α → ZMod 2) (f : α → G) :
    ∑ i ∈ s, a i • f i = ∑ i ∈ s with a i ≠ 0, f i

    Over 𝔽₂, a linear combination is the sum of the vectors with nonzero coefficient.

    theorem Cslib.Code.sum_zmodTwo_eq_card_filter {α : Type u_2} (s : Finset α) (a : α → ZMod 2) :
    ∑ i ∈ s, a i = ↑{i ∈ s | a i ≠ 0}.card

    Over 𝔽₂, the sum of the coefficients is the parity of the number of nonzero ones.

    theorem Cslib.Code.linearIndepOn_of_forall_sum_ne_zero {G : Type u_1} [AddCommGroup G] [Module (ZMod 2) G] {s : Finset G} (hs : ∀ T ⊆ s, T.Nonempty → ∑ x ∈ T, x ≠ 0) :

    Over 𝔽₂, a finite set in which no nonempty subset sums to zero is linearly independent.

    The rank of a circuit [Saglam2027, Section 2]. Removing one element of a zero-sum circuit leaves a linearly independent set, so the circuit spans a space of dimension at least |S| - 1 (in fact exactly |S| - 1).

    theorem Cslib.Code.exists_dotProduct_eq_one_of_even {ι : Type u_1} [Fintype ι] {K : Finset (ι → ZMod 2)} (hK : ∀ T ⊆ K, ∑ x ∈ T, x = 0 → Even T.card) :
    ∃ (v : ι → ZMod 2), ∀ x ∈ K, v ⬝ᵥ x = 1

    One extra parity check [Saglam2027, Section 2]. If every zero-sum subset of a finite set K of vectors over 𝔽₂ has even size, then some vector v has v ⬝ᵥ x = 1 for every x ∈ K: the all-ones row lies in the row space of the matrix whose columns are the elements of K.

    theorem Cslib.Code.card_filter_forall_mulVec_eq_zero_mul_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : Finset (ι → ZMod 2)} (hS : IsZeroSumCircuit S) (m : ℕ) :
    {M : Matrix (Fin m) ι (ZMod 2) | ∀ x ∈ S, M.mulVec x = 0}.card * 2 ^ (m * (S.card - 1)) ≤ 2 ^ (m * Fintype.card ι)

    Few matrices kill a circuit [Saglam2027, Section 2]. At most a 2 ^ (-m (|S| - 1)) fraction of the matrices with m rows over 𝔽₂ kill every vector of a zero-sum circuit S.

    theorem Cslib.Code.exists_mulVec_ne_zero_of_sum_lt_one {ι : Type u_1} [Fintype ι] (B : Finset (ι → ZMod 2)) (m : ℕ) (h : ∑ S ∈ B.powerset with IsZeroSumCircuit S ∧ Odd S.card, (2 ^ m)⁻¹ ^ (S.card - 1) < 1) :
    ∃ (H : Matrix (Fin (m + 1)) ι (ZMod 2)), ∀ x ∈ B, H.mulVec x ≠ 0

    The odd-circuit existence argument [Saglam2027, Sections 1–2]. Let B be a finite set of vectors over 𝔽₂. If its odd zero-sum circuits S satisfy ∑_S 2 ^ (-m (|S| - 1)) < 1, then some (m + 1)-row matrix H maps every element of B to a nonzero vector.

    The sum bounds the expected number of odd circuits of B inside the kernel of a uniformly random m-row matrix M. Some M therefore has none, and then every zero-sum subset of B ∩ ker M is even, so one extra row v with v ⬝ᵥ x = 1 on B ∩ ker M completes H. The hypothesis forces 0 ∉ B, as {0} is an odd circuit.

    theorem Cslib.Code.exists_le_minDist_parityCheckCode_of_sum_lt_one {ι : Type u_1} [Fintype ι] [DecidableEq ι] (d m : ℕ) (h : ∑ S ∈ {x : ι → ZMod 2 | x ≠ 0 ∧ hammingNorm x < d}.powerset with IsZeroSumCircuit S ∧ Odd S.card, (2 ^ m)⁻¹ ^ (S.card - 1) < 1) :
    ∃ (H : Matrix (Fin (m + 1)) ι (ZMod 2)), ↑d ≤ minDist ↑(parityCheckCode H) ∧ 2 ^ (Fintype.card ι - (m + 1)) ≤ Nat.card ↥(parityCheckCode H)

    Codes from the odd-circuit argument [Saglam2027, Sections 1–2]. If the odd zero-sum circuits S among the nonzero words of weight less than d satisfy ∑_S 2 ^ (-m (|S| - 1)) < 1, then some (m + 1)-row parity-check matrix over 𝔽₂ defines a linear code of minimum distance at least d, with at least 2 ^ (|ι| - (m + 1)) codewords.