2 - 图灵机简介 -- Turing Machine

Turing Machine

Alan Turning, 1936, Turing Machine.

A Turing machine can do everything that a real computer can be. Nonetheless, even a Turing machine cannot solve certain problems. In a very real sense, these problems are beyond the theoretical limits of computation.

The Turing machine model uses an infinite tape as its unlimited memory. It has a tape head that can read and write symbols and move around on the tape. Initially the tape contains only the input string and is blank everywhere else. If the machine needs to store information, it may write this information on the tape. The machine continuous computing until it decides to produce an output. The output accept and reject are obtained by entering designated accepting and rejecting states.

The church-Turing Thesis (Church, 1936; Turing, 1937)

Everything that can be effectively computed can be computed using a Turing machine (or: the \(\lambda\) calculus)

Formal Definition of Turing Machine

Definition A Turing Machine is a \(7\)-tuple, \((Q,\sum,\Gamma,\delta,q_0,q_{accept},q_{reject})\), where \(Q\), \(\sum\), \(\Gamma\) are all finite sets and

  • \(Q\) is the set of state,
  • \(\sum\) is the input alphabet not containing the blank symbol \(\sqcup\),
  • \(\Gamma\) is the tape alphabet, where \(\sqcup\in\Gamma\) and \(\sum\subseteq\Gamma\),
  • \(\delta:Q\times\Gamma \rightarrow Q\times\Gamma\times\{L,R\}\) is the transition function,
  • \(q_0\in Q\) is the start state,
  • \(q_{accept}\in Q\) is the accept state, and
  • \(q_{reject}\in Q\) is the reject state, where \(q_{reject}\neq q_{accept}\).

For a Turing machine, \(\delta\) takes the form: \(Q\times\Gamma\rightarrow Q\times\Gamma\times\{L,R\}\). That is, when the machine is in certain state \(q\) and the head is over a tape square containing a symbol \(a\), and if \(\delta(q,a)=(r,b,L)\), the machine writes the symbol \(b\) replacing the \(a\), and goes to state \(r\). The third component is either \(L\) or \(R\) and indicates whether the head moves to the left or right after writing. In this case, the \(L\) indicates a move to the left.

As a Turing machine components, changes occur in the current state, the current tape contents, and the current head location. A setting of these three items is called a configuration of the Turing machine. For a state \(q\) and two strings \(u\) and \(v\) over the tape alphabet \(\Gamma\), we write \(uqv\) for the configuration where the current state is \(q\), the current tape contents is \(uv\), and the current head location is the first symbol of \(v\). The tape contains only blanks following the last symbol of \(v\). Say that configuration \(C_1\) yields configuration \(C_2\) if the Turing machine can legally go from \(C_1\) to \(C_2\) in a single step.

Definition A Turing Machine \(M\) accepts input \(w\) if a sequence of configurations \(C_1, C_2,\cdots,C_k\) exists, where

  1. \(C_1\) is the start configuration of \(M\) on input \(w\),
  2. each \(C_i\) yields \(C_{i+1}\), and
  3. \(C_k\) is an accepting configuration.

Definition Turing recognizable language: A language for which there exists a Turing machine that accepts all strings and only the strings in the language.

Definition Turing decidable language: A language for which there exists a Turing machine that

  • accepts all strings in the language
  • rejects all other strings.

Variants of Turing Machine

Multi-tape Turing Machine

Definition

A mutitape Turing machine is like an ordinary Turing machine with several tapes. Formally, it is:

\[\delta:Q\times\Gamma^k\rightarrow Q\times\Gamma^k\times\{L,R,S\}^k \]

where \(k\) is number of tapes. The expression:

\[\delta(q_i,a_1,\cdots,a_k)=(q_j,b_1,\cdots,b_k,L,R,\cdots,L) \]

means that if the machine is in state \(q_i\) and heads 1 through \(k\) are reading symbols \(a_1\) through \(a_k\), the machine goes to state \(q_j\), writes symbols \(b_1\) through \(b_k\), and directs each head to move left or right, or to say put, as specified.

Theorem Every multitape Turing machine has an equivalent single-tape Turing machine

Nondeterministic Turing Machine

Definition At any point in a computation, the machine may proceed according to several possibilities. The transition function for a nondeterministic Turing machine has the form:

\[\delta:Q\times\Gamma\rightarrow\mathcal{P}(Q\times\Gamma\times\{L,R\}) \]

If some branch of the computation leads to the accept state, the machine accepts its input.

Theorem Every nondeterministic Turing machine has an equivalent deterministic Turing machine.

Reference

Introduction to the Theory of Computation, 3rd edition, Michael Sipser.

上一篇:软件理论基础学习笔记——图灵机


下一篇:构造图灵机Turing