Documentation

Complexitylib.Classes.P.Cobham.Internal.BlockLoop

Looping over the blocks of a string inside the algebra #

Amplified acceptance is a majority vote over the blocks of a random seed. Both that vote and the outer disjunction over shift blocks are limited recursions over a ruler whose length is the iteration count: at the step whose tail is y, the block index is |y|, so the block itself is cut out of the source string by a drop of |y| · |τ| bits — a length smash produces — followed by a take of |τ|. No state has to be threaded through the recursion.

Main definitions #

Main results #

The j-th block of s at width w.

Equations
Instances For

    The block of s selected by the ruler idx at the width of τ.

    Equations
    Instances For
      @[simp]
      theorem Complexity.Cobham.blockOf_eq (τ s idx : List Bool) :
      blockOf τ s idx = blockAtIdx τ.length s idx.length
      theorem Complexity.Cobham.blockOf_mem {n : } {gs gidx : (Fin nList Bool)List Bool} ( : Cobham ) (hs : Cobham gs) (hidx : Cobham gidx) :
      Cobham fun (v : Fin nList Bool) => blockOf ( v) (gs v) (gidx v)

      Counting accepting blocks #

      noncomputable def Complexity.Cobham.acceptCountAux {k : } (tm : NTM k) (u x τ s : List Bool) :

      Unary count of the blocks of s on which the path of tm accepts: one bit per accepting block. The recursion runs once per bit of ρ, and the block index at each step is the length of the remaining tail.

      Equations
      Instances For
        theorem Complexity.Cobham.acceptCountAux_length {k : } (tm : NTM k) (u x τ s ρ : List Bool) :
        (acceptCountAux tm u x τ s ρ).length = jFinset.range ρ.length, if acceptChoiceFn tm u x (blockAtIdx τ.length s j) = [true] then 1 else 0

        The count is the number of accepting block indices below |ρ|.

        theorem Complexity.Cobham.acceptCountAux_mem {k n : } (tm : NTM k) {gu gx gs : (Fin nList Bool)List Bool} (hu : Cobham gu) (hx : Cobham gx) ( : Cobham ) (hs : Cobham gs) ( : Cobham ) :
        Cobham fun (v : Fin nList Bool) => acceptCountAux tm (gu v) (gx v) ( v) (gs v) ( v)

        The count is in the algebra.

        The amplified verdict #

        noncomputable def Complexity.Cobham.majorityFlag {k : } (tm : NTM k) (u x τ s ρ : List Bool) :

        The amplified majority verdict as a flag: strictly more than half of the |ρ| blocks of s accept.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Complexity.Cobham.majorityFlag_flag {k : } (tm : NTM k) (u x τ s ρ : List Bool) :
          majorityFlag tm u x τ s ρ = [true] majorityFlag tm u x τ s ρ = [false]
          theorem Complexity.Cobham.majorityFlag_eq_true_iff {k : } (tm : NTM k) (u x τ s ρ : List Bool) :
          majorityFlag tm u x τ s ρ = [true] ρ.length < 2 * (acceptCountAux tm u x τ s ρ).length
          theorem Complexity.Cobham.majorityFlag_mem {k n : } (tm : NTM k) {gu gx gs : (Fin nList Bool)List Bool} (hu : Cobham gu) (hx : Cobham gx) ( : Cobham ) (hs : Cobham gs) ( : Cobham ) :
          Cobham fun (v : Fin nList Bool) => majorityFlag tm (gu v) (gx v) ( v) (gs v) ( v)
          noncomputable def Complexity.Cobham.verdictFlag {k : } (tm : NTM k) (b : Bool) (u x τ s ρ : List Bool) :

          The verdict sought at a shift: the amplified majority, or its negation.

          Equations
          Instances For
            theorem Complexity.Cobham.verdictFlag_flag {k : } (tm : NTM k) (b : Bool) (u x τ s ρ : List Bool) :
            verdictFlag tm b u x τ s ρ = [true] verdictFlag tm b u x τ s ρ = [false]
            theorem Complexity.Cobham.verdictFlag_mem {k n : } (tm : NTM k) (b : Bool) {gu gx gs : (Fin nList Bool)List Bool} (hu : Cobham gu) (hx : Cobham gx) ( : Cobham ) (hs : Cobham gs) ( : Cobham ) :
            Cobham fun (v : Fin nList Bool) => verdictFlag tm b (gu v) (gx v) ( v) (gs v) ( v)

            Disjunction over shifts #

            noncomputable def Complexity.Cobham.anyShiftAux {k : } (tm : NTM k) (b : Bool) (u x τ ρ σ r wit : List Bool) :

            Disjunction of the verdict over the shift blocks of wit: the recursion runs once per bit of the shift ruler, and at each step the shift block is cut from wit at the index given by the remaining tail.

            Equations
            Instances For
              theorem Complexity.Cobham.anyShiftAux_flag {k : } (tm : NTM k) (b : Bool) (u x τ ρ σ r wit ι : List Bool) :
              anyShiftAux tm b u x τ ρ σ r wit ι = [true] anyShiftAux tm b u x τ ρ σ r wit ι = [false]
              theorem Complexity.Cobham.anyShiftAux_eq_true_iff {k : } (tm : NTM k) (b : Bool) (u x τ ρ σ r wit ι : List Bool) :
              anyShiftAux tm b u x τ ρ σ r wit ι = [true] i < ι.length, verdictFlag tm b u x τ (xorSuffix r (padTo σ (blockAtIdx σ.length wit i))) ρ = [true]

              The disjunction is exactly an existential over shift indices.

              theorem Complexity.Cobham.anyShiftAux_mem {k n : } (tm : NTM k) (b : Bool) {gu gx gr gwit : (Fin nList Bool)List Bool} (hu : Cobham gu) (hx : Cobham gx) ( : Cobham ) ( : Cobham ) ( : Cobham ) (hr : Cobham gr) (hwit : Cobham gwit) ( : Cobham ) :
              Cobham fun (v : Fin nList Bool) => anyShiftAux tm b (gu v) (gx v) ( v) ( v) ( v) (gr v) (gwit v) ( v)

              The disjunction over shifts is in the algebra.

              Membership among blocks #

              Flag: the block c occurs among the width-|τ| blocks of s indexed by the ruler.

              Equations
              Instances For
                theorem Complexity.Cobham.memBlockAux_eq_true_iff (τ s c ι : List Bool) :
                memBlockAux τ s c ι = [true] i < ι.length, blockAtIdx τ.length s i = c

                The membership test is an existential over block indices.

                theorem Complexity.Cobham.memBlockAux_mem {n : } {gs gc : (Fin nList Bool)List Bool} ( : Cobham ) (hs : Cobham gs) (hc : Cobham gc) ( : Cobham ) :
                Cobham fun (v : Fin nList Bool) => memBlockAux ( v) (gs v) (gc v) ( v)

                The membership test is in the algebra.