Documentation

Complexitylib.Classes.Containments.Internal.PHBounds

The enumerator's bounds, in the input's length #

⚠️ Unreviewed by Bolton

Every quantity the enumerator's contracts and windows are stated in terms of — the width of a pair, the number of digits in a counter, the running time of a stage — is bounded by a polynomial in the input's length. This file collects those bounds.

Main results #

theorem Complexity.PolyExists.dropTop_length_le (m j N : ) (hN : N = 2 ^ (m + 1) - 1) (hj : j < N) :
(dropTop (j + 1)).length m

A witness below the horizon is no longer than the exponent.

theorem Complexity.PolyExists.pair_length_le (x : List Bool) (m j N : ) (hN : N = 2 ^ (m + 1) - 1) (hj : j < N) :
(pair x (dropTop (j + 1))).length 2 * x.length + 2 + m

And the pair it goes into is bounded too.

theorem Complexity.PolyExists.bits_length_le (m j N : ) (hN : N = 2 ^ (m + 1) - 1) (hj : j N) :

A counter at most the horizon has at most m + 1 digits.

theorem Complexity.PolyExists.tally_le (P : Bool) (v : ) :

A tally never exceeds its count.

theorem Complexity.PolyExists.binarySuccTime_le' (m v N : ) (hN : N = 2 ^ (m + 1) - 1) (hv : v N) :
TM.binarySuccTime v 2 * (m + 1) + 2

The successor's running time, in digits.

theorem Complexity.PolyExists.binaryBumpTime_le' (m j N : ) (hN : N = 2 ^ (m + 1) - 1) (hj : j < N) :

The witness advance's running time.

theorem Complexity.PolyExists.binaryEqTime_le' (m j N : ) (hN : N = 2 ^ (m + 1) - 1) (hj : j < N) :

The comparison's running time.

A polynomial with natural coefficients is monotone.

The bounds themselves #

The width of the pair the matrix machine reads.

Equations
Instances For

    The window the matrix machine needs.

    Equations
    Instances For

      The wipe height.

      Equations
      Instances For

        The bound on the heads the rewinds have to chase.

        Equations
        Instances For

          The uniform bound on every head of every intermediate state.

          Equations
          Instances For
            theorem Complexity.PolyExists.bP_le_bHb (lx m sb : ) :
            bP lx m bHb lx m sb
            theorem Complexity.PolyExists.bHb_lt_bH (lx m sb : ) :
            bHb lx m sb + 1 bH lx m sb
            theorem Complexity.PolyExists.bP_lt_bH (lx m sb : ) :
            bP lx m + 1 bH lx m sb
            theorem Complexity.PolyExists.bB_le_bG (lx m sb : ) :
            bB lx m bG lx m sb
            theorem Complexity.PolyExists.bHb_le_bG (lx m sb : ) :
            bHb lx m sb + 1 bG lx m sb
            theorem Complexity.PolyExists.bP_le_bG (lx m sb : ) :
            bP lx m + 1 bG lx m sb
            theorem Complexity.PolyExists.one_le_bG (lx m sb : ) :
            1 bG lx m sb
            theorem Complexity.PolyExists.one_le_bHb (lx m sb : ) :
            1 bHb lx m sb
            def Complexity.PolyExists.bW (st lx m sb pro epi : ) :

            The window the whole machine runs in: the uniform head bound plus one summand for every stage's own budget. Sums, not maxima, so that the whole thing is visibly a polynomial in the input's length.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem Complexity.PolyExists.bG_le_bW (st lx m sb pro epi : ) :
              bG lx m sb bW st lx m sb pro epi
              theorem Complexity.PolyExists.one_le_bW (st lx m sb pro epi : ) :
              1 bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage1 (st lx m sb pro epi : ) :
              bG lx m sb + 1 bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage2 (st lx m sb pro epi : ) (x w : List Bool) (hx : x.length = lx) (hw : w.length m) :
              bG lx m sb + TM.pairInputWorkTime x w bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage3 (st lx m sb pro epi : ) :
              bG lx m sb + (1 + 1 + (2 * (max (bB lx m + 2) (3 * (bB lx m + 3) + 1) + 1) + 1)) bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage4 (st lx m sb pro epi P : ) (hP : P bP lx m) :
              bG lx m sb + (2 * P + 5) bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage6 (st lx m sb pro epi : ) :
              bG lx m sb + (1 + 1 + (2 * (max (bHb lx m sb + 2) (1 * (bHb lx m sb + 3) + 1) + 1) + 1)) bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage8 (st lx m sb pro epi a r v : ) (ha : TM.binarySuccTime a 2 * (m + 1) + 2) (hr : TM.binarySuccTime r 2 * (m + 1) + 2) (hv : TM.binarySuccTime v 2 * (m + 1) + 2) :
              bG lx m sb + (3 * (max (1 + 1 + max (TM.binarySuccTime a) (TM.binarySuccTime r) + 5) (TM.binarySuccTime v) + 1) + 1) bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage9 (st lx m sb pro epi t : ) (ht : t 2 * m + 2) :
              bG lx m sb + t bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_stage10 (st lx m sb pro epi H : ) (hH : H = bH lx m sb) :
              bG lx m sb + (st * (H + 4) + H * 4 + 8 + 1 + (st * (H + 4) + 1)) bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_test (st lx m sb pro epi N j : ) (hj : TM.binaryEqTime (j + 1).bits N.bits m + 2) :
              bG lx m sb + testTime (bB lx m) N j bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_copy (st lx m sb pro epi : ) :
              1 + (lx + 1) bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_rewind (st lx m sb pro epi : ) :
              lx + 1 + (1 + 1 + (2 * (max (bB lx m + 2) (1 * (bB lx m + 3) + 1) + 1) + 1)) bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_prologue (st lx m sb pro epi : ) :
              1 + pro bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_epilogue (st lx m sb pro epi e : ) (he : e epi) :
              1 + e bW st lx m sb pro epi
              theorem Complexity.PolyExists.bW_matrix (st lx m sb pro epi : ) :
              bHb lx m sb bW st lx m sb pro epi

              The bounds as polynomials #

              The width of the pair, as a polynomial in the input's length.

              Equations
              Instances For

                The matrix machine's window, as a polynomial.

                Equations
                Instances For

                  The wipe height, as a polynomial.

                  Equations
                  Instances For

                    The rewind bound, as a polynomial.

                    Equations
                    Instances For

                      The uniform head bound, as a polynomial.

                      Equations
                      Instances For

                        The register machine's per-operation budget, as a polynomial.

                        Equations
                        Instances For

                          The prologue's running time, dominated by a polynomial.

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

                            The epilogue's running time, dominated by a polynomial.

                            Equations
                            Instances For
                              theorem Complexity.PolyExists.epilogueTime_le (m A N : ) (hN : N = 2 ^ (m + 1) - 1) (hA : A N) :
                              epilogueTime A 6 * m + 50
                              noncomputable def Complexity.PolyExists.bWPoly (st : ) (p s q : Polynomial ) :

                              The enumerator's space bound, as a polynomial.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[simp]
                                theorem Complexity.PolyExists.bWPoly_eval (st : ) (p s q : Polynomial ) (lx : ) :
                                theorem Complexity.PolyExists.tally_pos_iff (P : Bool) (N : ) :
                                0 < NTM.tally P N j < N, P j = true

                                A tally is positive exactly when something below the count satisfied the predicate.

                                theorem Complexity.PolyExists.tally_pos_iff_mem (L' : Language) (p : Polynomial ) (x : List Bool) (N : ) (hN : N = 2 ^ (Polynomial.eval x.length p + 1) - 1) :

                                What the machine computes is membership in the bounded existential.

                                The enumerator, instantiated #

                                Every hypothesis the enumerator's contract and window need, at one input.

                                theorem Complexity.PolyExists.enumTM_decides {k : } (M : TM k) {L' : Language} {f : } (s : Polynomial ) (hs : ∀ (n : ), f n Polynomial.eval n s) (hdecS : M.DecidesInSpace L' f) (hdec : M.DecidesInTime L' (M.spaceTimeBound f)) (p : Polynomial ) (x : List Bool) (N H B Hb bBody bTest : ) (hNdef : N = 2 ^ (Polynomial.eval x.length p + 1) - 1) (hHdef : H = bH x.length (Polynomial.eval x.length p) (Polynomial.eval (bP x.length (Polynomial.eval x.length p)) s)) (hBdef : B = bB x.length (Polynomial.eval x.length p)) (hHbdef : Hb = bHb x.length (Polynomial.eval x.length p) (Polynomial.eval (bP x.length (Polynomial.eval x.length p)) s)) (hbBody : v < N, bodyTime k x (M.spaceTimeBound f) H Hb B v (NTM.tally (enumP L' x) v) (NTM.tally (fun (u : ) => !enumP L' x u) v) bBody) (hbTest : v < N, testTime B N v bTest) :
                                ∃ (c' : Cfg (enumTapes k) (enumTM M p (bHPoly p s)).Q), (enumTM M p (bHPoly p s)).reaches ((enumTM M p (bHPoly p s)).initCfg x) c' (enumTM M p (bHPoly p s)).halted c' (x polyExistsLang p L'c'.output.cells 1 = Γ.one) (xpolyExistsLang p L'c'.output.cells 1 = Γ.zero)

                                The enumerator decides the bounded existential.

                                theorem Complexity.PolyExists.enumTM_space {k : } (M : TM k) {L' : Language} {f : } (s : Polynomial ) (hs : ∀ (n : ), f n Polynomial.eval n s) (hdecS : M.DecidesInSpace L' f) (hdec : M.DecidesInTime L' (M.spaceTimeBound f)) (hne : M.qstart M.qhalt) (p : Polynomial ) (x : List Bool) (N H B Hb G W bBody bTest : ) (hNdef : N = 2 ^ (Polynomial.eval x.length p + 1) - 1) (hHdef : H = bH x.length (Polynomial.eval x.length p) (Polynomial.eval (bP x.length (Polynomial.eval x.length p)) s)) (hBdef : B = bB x.length (Polynomial.eval x.length p)) (hHbdef : Hb = bHb x.length (Polynomial.eval x.length p) (Polynomial.eval (bP x.length (Polynomial.eval x.length p)) s)) (hGdef : G = bG x.length (Polynomial.eval x.length p) (Polynomial.eval (bP x.length (Polynomial.eval x.length p)) s)) (hWdef : W = bW (scratchTargets k).length x.length (Polynomial.eval x.length p) (Polynomial.eval (bP x.length (Polynomial.eval x.length p)) s) (Polynomial.eval x.length (proPoly p (bHPoly p s))) (Polynomial.eval x.length (epiPoly p))) (hbBody : v < N, bodyTime k x (M.spaceTimeBound f) H Hb B v (NTM.tally (enumP L' x) v) (NTM.tally (fun (u : ) => !enumP L' x u) v) bBody) (hbTest : v < N, testTime B N v bTest) (c' : Cfg (enumTapes k) (enumTM M p (bHPoly p s)).Q) :
                                (enumTM M p (bHPoly p s)).reaches ((enumTM M p (bHPoly p s)).initCfg x) c'c'.WithinDecisionSpace x.length W

                                The enumerator keeps a polynomial window.

                                theorem Complexity.PolyExists.exists_loop_bounds {k : } (M : TM k) (f : ) (x : List Bool) (L' : Language) (N H B Hb : ) :
                                ∃ (bBody : ) (bTest : ), (∀ v < N, bodyTime k x (M.spaceTimeBound f) H Hb B v (NTM.tally (enumP L' x) v) (NTM.tally (fun (u : ) => !enumP L' x u) v) bBody) v < N, testTime B N v bTest

                                The two loop budgets exist. Both are finite suprema over the counter range — they need not be polynomial, since the loop's time never enters the space accounting.