Documentation

Complexitylib.Classes.Containments.Internal.IPEnc

The walk's state on a bitstring #

⚠️ Unreviewed by Bolton

Complexitylib.Classes.Containments.Internal.IPSem walks the game tree on an inductive state. A machine has to hold that state on a tape, so this file writes it as a bitstring — a frame is five blocks, the stack a right-nested chain of pairs — and records the invariant the encoding needs: a returning value is a count, so it is never empty, which is what tells some from none.

Main definitions #

Main results #

The encoding #

A frame on the tape: five blocks.

Equations
Instances For

    The stack on the tape: a right-nested chain of pairs, empty stack being the empty string.

    Equations
    Instances For
      @[simp]
      theorem Complexity.IPM.encStk_cons (f : Frm) (fs : List Frm) :
      encStk (f :: fs) = pair (encFrm f) (encStk fs)

      A returning value on the tape. A count is never empty, so the empty string means nothing is returning.

      Equations
      Instances For
        @[simp]

        The invariant the encoding relies on #

        Every frame carries the body of the rounds below it.

        Equations
        Instances For
          theorem Complexity.IPM.bodyOk_cons {f : Frm} {fs : List Frm} (h : f.body = encBodyR (roundsOf fs)) (h' : BodyOk fs) :
          BodyOk (f :: fs)

          The stack descends exactly one level per frame, so its depth is the level it started at.

          Equations
          Instances For
            theorem Complexity.IPM.StkDepth.length_le {D : } {stk : List Frm} :
            StkDepth D stkstk.length D
            structure Complexity.IPM.EncOk (P : Params) (D : ) (s : Sst) :

            The encoding is faithful when nothing is returning while the stack is empty, and every count on the state has the width a count is held in — so that a returning value is never empty.

            Instances For
              theorem Complexity.IPM.encRet_ne_nil {P : Params} {D : } {s : Sst} (h : EncOk P D s) {w : List Bool} (hw : s.ret = some w) :
              theorem Complexity.IPM.freshFrm_len (P : Params) (body lvl : List Bool) :
              (freshFrm P body lvl).sum.length = P.t + 1 (freshFrm P body lvl).best.length = P.t + 1
              theorem Complexity.IPM.step_encOk (P : Params) (D : ) {s : Sst} (h : EncOk P D s) :
              EncOk P D (step P s)

              The invariant is preserved.

              theorem Complexity.IPM.iterate_encOk (P : Params) (D j : ) (s : Sst) :
              EncOk P D sEncOk P D ((step P)^[j] s)
              theorem Complexity.IPM.encOk_start (P : Params) (lvl : List Bool) :
              EncOk P (lvl.length + 1) { done := false, ansBit := false, ret := none, stk := [freshFrm P [] lvl] }

              How long an encoded state is #

              The width a message counter can reach.

              Equations
              Instances For

                Every frame's counters are within the widths the walk uses.

                Equations
                Instances For
                  theorem Complexity.IPM.step_sizeOk (P : Params) {s : Sst} (h : SizeOk P s.stk) :
                  SizeOk P (step P s).stk
                  theorem Complexity.IPM.iterate_sizeOk (P : Params) (j : ) (s : Sst) :
                  SizeOk P s.stkSizeOk P ((step P)^[j] s).stk
                  theorem Complexity.IPM.body_length_le (P : Params) (fs : List Frm) :
                  SizeOk P fs(encBodyR (roundsOf fs)).length fs.length * (8 * msgW P + 4)

                  The transcript body a stack records is polynomially long.

                  theorem Complexity.IPM.encFrm_length_le (P : Params) (D B : ) (f : Frm) (hl : f.lvl.length + 1 D) (hv : f.v.length P.m) (ha : f.a.length msgW P) (hs : f.sum.length = P.t + 1) (hb : f.best.length = P.t + 1) (hbody : f.body.length B) :
                  (encFrm f).length 2 * D + 2 * P.m + 2 * msgW P + 4 * (P.t + 1) + B + 10
                  theorem Complexity.IPM.encStk_length_le (fs : List Frm) (B : ) :
                  (∀ gfs, (encFrm g).length B)(encStk fs).length fs.length * (2 * B + 2)
                  theorem Complexity.IPM.StkDepth.mem_le {D : } {stk : List Frm} :
                  StkDepth D stkfstk, f.lvl.length + 1 D
                  theorem Complexity.IPM.SizeOk.mem {P : Params} {stk : List Frm} :
                  SizeOk P stkfstk, f.v.length P.m f.a.length msgW P
                  theorem Complexity.IPM.SizeOk.tail {P : Params} {g : Frm} {gs : List Frm} (h : SizeOk P (g :: gs)) :
                  SizeOk P gs
                  theorem Complexity.IPM.body_bound_mem (P : Params) (D : ) (stk : List Frm) :
                  BodyOk stkSizeOk P stkStkDepth D stkgstk, g.body.length D * (8 * msgW P + 4)

                  The width the encoded state stays inside.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Complexity.IPM.stateBound_le (P : Params) (D M : ) (hM : msgW P M) :
                    stateBound P D 2 * (P.t + 1) + D * (2 * (2 * D + 2 * P.m + 2 * M + 4 * (P.t + 1) + D * (8 * M + 4) + 10) + 2) + 10
                    theorem Complexity.IPM.encSst_length_le (P : Params) (D : ) (s : Sst) (h : EncOk P D s) (hsz : SizeOk P s.stk) :

                    An encoded state is polynomially long.