Documentation

Complexitylib.Classes.Containments.Internal.CodeRewind

Reading the verdict cell out of a record #

⚠️ Unreviewed by Bolton

Acceptance is a property of cell 1 of the output tape, but a code stores each tape split at its head, so where cell 1 sits depends on the head. Driving the head back to cell 0 first puts it in a fixed place: the encoding's right half-block is then the whole tape in order, two bits per cell, so cell 1 is bits 2 and 3.

That is the same rewind the completeness direction of Cobham's theorem uses to read a simulated machine's output, Cobham.rewindFn, run here as a loop of its own.

Main definitions #

Main results #

The output tape inside a record #

Block 3 is the output tape's left half.

Block 4 is the output tape's right half.

The output tape's code, read out of a record.

Equations
Instances For
    theorem Complexity.outPairFn_mem_FP {a b : List BoolList Bool} (ha : a FP) (hb : b FP) :
    (fun (z : List Bool) => outPair (a z) (b z)) FP

    The two blocks are the output tape's code.

    The rewind loop #

    A whole rewind: one step per bit of the ruler.

    Equations
    Instances For
      theorem Complexity.rewindCode_eq (R ruler z : List Bool) :
      rewindCode R ruler z = (Cobham.rewindFn R)^[ruler.length] z
      theorem Complexity.rewindCode_pairCode (W : ) (t : Tape) (hinv : t.StartInvariant) (hW : t.head W) (ruler : List Bool) (hlen : W ruler.length) :
      rewindCode (Cobham.blockRuler W) ruler (Cobham.pairCode W t) = Cobham.pairCode W { head := 0, cells := t.cells }

      A long enough rewind parks the head at cell 0.

      Both are polynomial-time #

      theorem Complexity.rewindFnFn_mem_FP {a b : List BoolList Bool} (ha : a FP) (hb : b FP) :
      (fun (z : List Bool) => Cobham.rewindFn (a z) (b z)) FP
      theorem Complexity.rewindCodeFn_mem_FP {Rf rulerf zf : List BoolList Bool} (hR : Rf FP) (hruler : rulerf FP) (hz : zf FP) (hlen : ∀ (w : List Bool), (zf w).length 2 * (Rf w).length) :
      (fun (w : List Bool) => rewindCode (Rf w) (rulerf w) (zf w)) FP

      The rewind is polynomial-time.