Documentation

Complexitylib.Classes.Containments.Internal.SavitchSim

The encoded step simulates the abstract one #

⚠️ Unreviewed by Bolton

Complexity.savStep is Savitch's recursion written on a bitstring, so that it lands in FP; Complexity.Sav.step is the same recursion on an inductive state, where it can be reasoned about. This file writes the encoding down and proves the square commutes.

Main definitions #

Main results #

Flags as booleans #

noncomputable def Complexity.baseReachB {k : } (tm : NTM k) (R u v : List Bool) :

The base reachability test, as a boolean.

Equations
Instances For
    noncomputable def Complexity.baseAccB {k : } (tm : NTM k) (R rl u : List Bool) :

    The base acceptance test, as a boolean.

    Equations
    Instances For
      theorem Complexity.baseReach_eq {k : } (tm : NTM k) (R u v : List Bool) :
      baseReach tm R u v = [baseReachB tm R u v]
      theorem Complexity.baseAcc_eq {k : } (tm : NTM k) (R rl u : List Bool) :
      baseAcc tm R rl u = [baseAccB tm R rl u]

      The encoding #

      A returned value on the tape.

      Equations
      Instances For
        @[simp]

        A frame on the tape.

        Equations
        Instances For
          noncomputable def Complexity.savSem {k : } (tm : NTM k) (R : List Bool) :

          The abstract step the encoded one runs.

          Equations
          Instances For

            The square commutes #

            @[simp]
            @[simp]
            @[simp]
            theorem Complexity.stR_encSst (R : List Bool) (s : Sav.Sst) :
            stR (encSst R s) = R
            @[simp]
            @[simp]
            @[simp]
            @[simp]
            theorem Complexity.frU_encFrm (f : Sav.Frm) :
            frU (encFrm f) = f.u
            @[simp]
            theorem Complexity.frV_encFrm (f : Sav.Frm) :
            frV (encFrm f) = f.v
            @[simp]
            theorem Complexity.frM_encFrm (f : Sav.Frm) :
            frM (encFrm f) = f.m
            theorem Complexity.savStep_encSst {k : } (tm : NTM k) (R : List Bool) (s : Sav.Sst) (hne : s.stk = []s.ret none) :
            savStep tm (encSst R s) = encSst R (savSem tm R s)

            One encoded step is one abstract step. The side condition rules out the one shape the encoding cannot express: an empty stack with nothing returning.

            Iterating #

            theorem Complexity.savStep_iterate {k : } (tm : NTM k) (R : List Bool) (j : ) (s : Sav.Sst) :
            Sav.StkOk s(savStep tm)^[j] (encSst R s) = encSst R ((savSem tm R)^[j] s)
            noncomputable def Complexity.savRoot {k : } (tm : NTM k) (qp lp : Polynomial ) (x : List Bool) :

            The root frame the recursion starts from.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              noncomputable def Complexity.savInitSst {k : } (tm : NTM k) (qp lp : Polynomial ) (x : List Bool) :

              The state Complexity.savInit builds, decoded.

              Equations
              Instances For
                theorem Complexity.savInit_eq {k : } (tm : NTM k) (qp lp : Polynomial ) (x : List Bool) :
                savInit tm qp lp x = encSst (savR qp x) (savInitSst tm qp lp x)
                theorem Complexity.savSem_iterate_stkOk {k : } (tm : NTM k) (R : List Bool) (j : ) (s : Sav.Sst) :
                Sav.StkOk sSav.StkOk ((savSem tm R)^[j] s)
                theorem Complexity.savInitSst_stkOk {k : } (tm : NTM k) (qp lp : Polynomial ) (x : List Bool) :
                Sav.StkOk (savInitSst tm qp lp x)
                theorem Complexity.savG_iterate {k : } (tm : NTM k) (qp lp : Polynomial ) (x : List Bool) (j : ) :
                (savG tm qp lp)^[j + 1] (pair [] x) = pair (encSst (savR qp x) ((savSem tm (savR qp x))^[j] (savInitSst tm qp lp x))) x

                The packed orbit is the abstract one.

                The head of a packed state is its done flag.

                How long an encoded state is #

                theorem Complexity.encStack_length_le (fs : List (List Bool)) (B : ) :
                (∀ ffs, f.length B)(encStack fs).length fs.length * (2 * B + 2)
                theorem Complexity.encFrm_length_le {Lmax Wm : } {f : Sav.Frm} (hl : f.lvl.length Lmax) (hs : Sav.FrmSize Wm f) :
                (encFrm f).length 2 * Lmax + 5 * Wm + 14
                theorem Complexity.encSst_length_le {Lmax Wm : } (R : List Bool) (s : Sav.Sst) (h : Sav.StkSize Lmax Wm s.stk) :
                (encSst R s).length 2 * R.length + (Lmax + 1) * (2 * (2 * Lmax + 5 * Wm + 14) + 2) + 14

                An encoded state is polynomially long.