Documentation

MIPRE.Foundations.Cost.TreeBits

The closure library, part VI: the bits of a tree #

The preorder serialization Data.toBits of a tree, as a program (toBitsProg, a stack-driven traversal after sizeProg) and as a polynomial-time function (PolyTimeFun.toBits). This is how the describer of the succinct Cook–Levin theorem obtains the symbol strings of the interpreter machine's fixed input tapes — S d = bits d.toBits — from the data d (planning/succinct-cook-levin.md, S3).

Body of toBitsProg: the state is cons stack acc, stack a list of pending subtrees and acc the bits produced so far, reversed. Pop a subtree: nil emits 0; cons a b emits 1 and pushes a then b. Stop with acc when the stack is empty.

Equations
Instances For

    The step on a cons subtree: emit 1 and push the children.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      The body of the serialization loop.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem MIPRE.Cost.Prog.toBitsBody_step_cons (a b : Data) (rest : List Data) (acc : BitStr) :
        Eval [(Data.list (a.cons b :: rest)).cons (encode acc)] toBitsBody ((Data.nil.cons Data.nil).cons ((Data.list (a :: b :: rest)).cons (encode (true :: acc)))) (a.size + b.size + (Data.list rest).size + esize acc + 18)

        The invariant of the serialization loop for the target bits target: the state is cons stack acc with reverse acc ++ toBits stack₁ ++ … = target.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem MIPRE.Cost.Prog.toBitsLoop_runs (d : Data) (env : Env) (s : Data) (hs : toBitsInv d.toBits s) :
          ∃ t ≤ (s.stackMeasure + 1) * (8 * d.size + 21), ∃ (acc : BitStr), List.reverse acc = d.toBits ∧ Eval (s :: env) toBitsBody.loop (encode acc) t
          theorem MIPRE.Cost.Prog.toBitsProg_runs (d : Data) :
          ∃ t ≤ (d.size + 2) * (13 * d.size + 41), toBitsProg.Runs d (encode d.toBits) t

          The bits of a tree, in polynomial time.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For