Documentation

CslibFrontier.Foundations.Data.Code.RegularSyndrome

Binary regular syndrome decoding #

The regular syndrome decoding relation used by SD-in-the-Head partitions a binary word into equally sized chunks and requires each chunk to be an elementary vector: it has exactly one nonzero coordinate. A witness additionally satisfies the ordinary parity-check relation y = H *ᵥ x [SDitH2026, Sections 2.2 and 3.1.1].

The chunked index type Fin chunks × Fin chunkSize makes the source requirement that the word length is chunks * chunkSize explicit. This module reuses Cslib.Code.syndrome; it does not introduce a second parity-check or code API.

Main definitions #

Main results #

References #

def Cslib.Code.regularWord {chunks chunkSize : ℕ} (positions : Fin chunks → Fin chunkSize) :
Fin chunks × Fin chunkSize → Bool

Concatenate one elementary word per chunk. This is the binary regular word determined by positions.

def Cslib.Code.IsRegularWord {chunks chunkSize : ℕ} (x : Fin chunks × Fin chunkSize → Bool) :

A binary word is regular when each chunk is a Boolean unit vector.

Instances For
    @[instance_reducible]
    instance Cslib.Code.instDecidableIsRegularWord {chunks chunkSize : ℕ} (x : Fin chunks × Fin chunkSize → Bool) :
    def Cslib.Code.IsRegularSyndromeSolution {checks chunks chunkSize : ℕ} (H : Matrix (Fin checks) (Fin chunks × Fin chunkSize) Bool) (y : Fin checks → Bool) (x : Fin chunks × Fin chunkSize → Bool) :

    A regular syndrome-decoding witness for public parity-check matrix H and syndrome y.

    Instances For
      @[instance_reducible]
      instance Cslib.Code.instDecidableIsRegularSyndromeSolution {checks chunks chunkSize : ℕ} (H : Matrix (Fin checks) (Fin chunks × Fin chunkSize) Bool) (y : Fin checks → Bool) (x : Fin chunks × Fin chunkSize → Bool) :
      @[simp]
      theorem Cslib.Code.regularWord_eq_true_iff {chunks chunkSize : ℕ} {positions : Fin chunks → Fin chunkSize} {i : Fin chunks} {j : Fin chunkSize} :
      regularWord positions (i, j) = true ↔ j = positions i
      theorem Cslib.Code.hammingNorm_eq_sum_chunks {chunks chunkSize : ℕ} (x : Fin chunks × Fin chunkSize → Bool) :
      hammingNorm x = ∑ i : Fin chunks, hammingNorm fun (j : Fin chunkSize) => x (i, j)

      Total Hamming weight is the sum of the Hamming weights of the chunks.

      @[simp]
      theorem Cslib.Code.isRegular_regularWord {chunks chunkSize : ℕ} (positions : Fin chunks → Fin chunkSize) :
      theorem Cslib.Code.isRegularWord_iff_exists_positions {chunks chunkSize : ℕ} (x : Fin chunks × Fin chunkSize → Bool) :
      IsRegularWord x ↔ ∃ (positions : Fin chunks → Fin chunkSize), x = regularWord positions

      The per-chunk unit-vector predicate is equivalent to the source's description as a concatenation of elementary words.

      theorem Cslib.Code.IsRegularWord.hammingNorm_eq {chunks chunkSize : ℕ} {x : Fin chunks × Fin chunkSize → Bool} (hx : IsRegularWord x) :
      hammingNorm x = chunks

      Every binary regular word has exactly one nonzero coordinate per chunk.

      @[simp]
      theorem Cslib.Code.hammingNorm_regularWord {chunks chunkSize : ℕ} (positions : Fin chunks → Fin chunkSize) :
      hammingNorm (regularWord positions) = chunks
      theorem Cslib.Code.isRegularSyndromeSolution_regularWord {checks chunks chunkSize : ℕ} (H : Matrix (Fin checks) (Fin chunks × Fin chunkSize) Bool) (positions : Fin chunks → Fin chunkSize) :

      The canonical word constructed from positions solves the syndrome instance obtained by applying H to that word.

      theorem Cslib.Code.IsRegularSyndromeSolution.hammingNorm_eq {checks chunks chunkSize : ℕ} {H : Matrix (Fin checks) (Fin chunks × Fin chunkSize) Bool} {y : Fin checks → Bool} {x : Fin chunks × Fin chunkSize → Bool} (hx : IsRegularSyndromeSolution H y x) :
      hammingNorm x = chunks

      A regular syndrome solution has the source-required total Hamming weight.