Documentation

Complexity.Computability.TreeEval.Reader.Cert.Offset

Offsets of nodes within linear work space #

The offset of the node at a path is a fold over the path from the root: a step adds the length of a table and, to the right child, the length of the body of the left one. With the lengths computed by iteration, and the path read off the stack, it is tidily computable within work space linear in the encoded stack, the height and the value length.

Main results #

Folding over the path #

A step of the offset along a path from the root, on the height left and the sum.

Instances For
    theorem Cslib.TreeEval.Reader.foldl_pathStep (ℓ : ℕ) (P : List Bool) (d acc : ℕ) :
    List.foldl (pathStep ℓ) (d, acc) P = (d - P.length, acc + pathOffset ℓ d P)

    The offset as a fold over the path: folding pathStep ℓ over P from the height d and the sum acc gives the height d - P.length and the sum acc + pathOffset ℓ d P.

    theorem Cslib.TreeEval.Reader.foldl_cons_dir (st : List Iter.Frame) (acc : List Bool) :
    List.foldl (fun (acc : List Bool) (fr : Iter.Frame) => fr.dir :: acc) acc st = (List.map Iter.Frame.dir st).reverse ++ acc

    Certificates #

    Frames #

    @[reducible, inline]

    The encoding of tuples of frames.

    Instances For
      theorem Cslib.TreeEval.Reader.frameFinite_inSpace {β : Type} {encB : β ↪ List Bool} (g : Fin 4 × Bool × Fin 3 → β) :

      A function of the finite fields of a frame.

      The offset of the node at the path of a stack #