Documentation

Complexity.Foundations.Data.BitString.Block

Blocks of bit strings #

A string of m * k bits is read as m consecutive blocks of k bits through finProdFinEquiv: bit j of block i is bit finProdFinEquiv (i, j) of the string (BitString.block). Cutting a string into its blocks is an equivalence BitString (m * k) ≃ (Fin m → BitString k) (BitString.blocksEquiv). The positions of the blocks (BitString.blockBits) are pairwise disjoint, and gluing two strings along the positions of one block takes that block from the first string and every other block from the second (BitString.block_piecewise).

Main definitions #

Main results #

def Cslib.BitString.block {m k : ℕ} (x : BitString (m * k)) (i : Fin m) :

The i-th block of k consecutive bits of a string of m blocks.

Instances For
    @[simp]
    theorem Cslib.BitString.block_apply {m k : ℕ} (x : BitString (m * k)) (i : Fin m) (j : Fin k) :
    x.block i j = x (finProdFinEquiv (i, j))

    Bit j of block i is bit finProdFinEquiv (i, j) of the string.

    Cutting a string of m * k bits into its m blocks of k bits.

    Instances For
      @[simp]
      @[simp]

      blocksEquiv cuts a string into its blocks with block.

      @[simp]

      Cutting the concatenation of blocks into its blocks recovers them.

      def Cslib.BitString.blockBits {m : ℕ} (k : ℕ) (i : Fin m) :
      Finset (Fin (m * k))

      The positions of the bits of the i-th block of k bits.

      Instances For
        theorem Cslib.BitString.mem_blockBits {m k : ℕ} {i : Fin m} {p : Fin (m * k)} :

        A position lies in block i exactly when its block index under finProdFinEquiv is i.

        Distinct blocks occupy disjoint positions.

        theorem Cslib.BitString.block_piecewise {m k : ℕ} (i : Fin m) (x z : BitString (m * k)) (j : Fin m) :
        block ((blockBits k i).piecewise x z) j = if j = i then x.block j else z.block j

        Gluing x and z along the positions of block i takes block i from x and the other blocks from z.

        Block i of k bits of a bit list: the k bits from position i * k on.

        Instances For
          theorem Cslib.BitString.listBlock_ofFn {m k : ℕ} (z : BitString (m * k)) (i : Fin m) :

          Block i of the list of a bit string is the list of its block i.