Langlib

Langlib.Automata.LinearBounded.Packing

Fixed-width packing for linear-bounded tapes #

This module packs a bounded number of logical symbols into each physical tape cell. It is independent of any particular grammar or automaton and is used by Aho's row encoding.

@[reducible, inline]
abbrev PackedBlock (α : Type) (W : ) :

A width-W block of optional logical symbols stored in one physical tape cell.

Equations
Instances For
    noncomputable instance PackedBlock.instFintype {α : Type} [Fintype α] (W : ) :
    Equations
    def packedCell {α : Type} (W : ) (xs : List α) (i : ) :

    The i-th width-W block of a list, padded with none past the list end.

    Equations
    Instances For
      def packedTape {α : Type} (W n : ) (xs : List α) :
      Fin nPackedBlock α W

      Pack a list into n width-W cells. Entries beyond n * W are ignored.

      Equations
      Instances For
        theorem packedTape_lookup {α : Type} {W n k : } (xs : List α) (hW : 0 < W) (hk : k < n * W) :
        packedTape W n xs k / W, k % W, = xs[k]?
        theorem packedTape_ext_of_length_le {α : Type} {W n : } {xs ys : List α} (hW : 0 < W) (hxs : xs.length n * W) (hys : ys.length n * W) (hpack : packedTape W n xs = packedTape W n ys) :
        xs = ys

        Packing is injective for lists that fit in the advertised physical capacity.