Documentation

Cslib.Computability.Machines.Turing.MultiTape.Space

Space usage of multi-tape Turing machines #

Defines the space used by a run path of a multi-tape Turing machine. Space usage counts the positions visited by each work-tape head along the path and sums over the tapes.

Design #

The input tape is read-only with bounded head movement, and the output tape is write-only, so we ignore both for space usage. A work-tape cell is visited when its head occupies that position in any configuration of the path, including the initial and final configurations. Each cell counts once, regardless of repeated visits.

Instead of considering the cells visited by the work tape heads, some textbooks (including [AroraBarak09]) only consider the number of cells that contain a non-blank symbol at some point in the execution or the number of cells written to. This allows work tape heads to freely move at no cost as long as they do not write. It is important to note that this causes DSPACE(1) to include DSPACE(log log n), a class that contains e.g. the non-regular language {0^n 1^n | n ∈ ℕ} (it is accepted by a TM that writes a single marker on the work tape and then counts the number of symbols by work tape head movement without writing). Defining space usage via "cells visited" thus yields the more fine-grained "complexity world" in which DSPACE(1) is exactly the class of regular languages.

References #

def Turing.MultiTapeNTM.RunPath.visitedByTapeHead {k : ℕ} {State : Type u_1} {Symbol : Type u_2} {input : List Symbol} {ntm : MultiTapeNTM k Symbol State} (p : ntm.RunPath input) (i : Fin k) :

The set of positions visited by the head of work tape i along a run path.

Equations
Instances For
    def Turing.MultiTapeNTM.RunPath.spaceUsedByTape {k : ℕ} {State : Type u_1} {Symbol : Type u_2} {input : List Symbol} {ntm : MultiTapeNTM k Symbol State} (p : ntm.RunPath input) (i : Fin k) :

    The number of positions visited by the head of work tape i along a run path.

    Equations
    Instances For
      def Turing.MultiTapeNTM.RunPath.space {k : ℕ} {State : Type u_1} {Symbol : Type u_2} {input : List Symbol} {ntm : MultiTapeNTM k Symbol State} (p : ntm.RunPath input) :

      The number of work tape cells visited along a run path.

      Equations
      Instances For
        def Turing.MultiTapeNTM.ComputationPath.space {k : ℕ} {State : Type u_1} {Symbol : Type u_2} {input : List Symbol} {ntm : MultiTapeNTM k Symbol State} (p : ntm.ComputationPath input) :

        The number of work tape cells visited along a computation path.

        Equations
        Instances For
          def Turing.MultiTapeNTM.RunsInSpace {k : ℕ} {State : Type u_1} {Symbol : Type u_2} (ntm : MultiTapeNTM k Symbol State) (input : List Symbol) (s : ℕ) :

          Every computation prefix on input visits at most s work-tape cells, regardless of its outcome.

          Equations
          Instances For
            theorem Turing.MultiTapeNTM.RunsInSpace.mono {k : ℕ} {State : Type u_1} {Symbol : Type u_2} {input : List Symbol} {ntm : MultiTapeNTM k Symbol State} {s s' : ℕ} (h : ntm.RunsInSpace input s) (hs : s ≤ s') :
            ntm.RunsInSpace input s'

            A space bound can be increased.

            @[simp]
            theorem Turing.MultiTapeNTM.runsInSpace_zero_tapes {State : Type u_1} {Symbol : Type u_2} (ntm : MultiTapeNTM 0 Symbol State) (input : List Symbol) (s : ℕ) :
            ntm.RunsInSpace input s

            A machine without work tapes satisfies every space bound.