12. Turing Machines
Feb 15, 2022
-
Deterministic machine with infinite tape, read-write head, head moves to left or right
-
Behavior at each time step:
- reads a symbol (
) - writes a symbol (
) - moves left or right
- reads a symbol (
-
is the input alphabet, is the tape alphabet- special blank symbol (e.g. ⎵) where
and
- special blank symbol (e.g. ⎵) where
Example
Time 0 ...| ⎵ | a | b | a | c | ⎵ | ⎵ | ... reads a, writes k, moves left H Time 1 ...| ⎵ | a | b | k | c | ⎵ | ⎵ | ... reads b, writes f, moves right H Time 2 ...| ⎵ | a | f | k | c | ⎵ | ⎵ | ... H
-
head starts at the leftmost position of the input string
-
read and write can operate on the same symbol, to not change the tape
-
no
-transitions => if there is no allowed transition in a state the machine halts -
accepting states have no outgoing transitions => the machine immediately accepts and halts
- in order to accept, it is not necessary to process all input
- accepting necessitates halting
-
rejecting can happen if:
- machine halts in a non-accepting state
- machine enters an infinite loop
Example
- Scans all symbols
, and once it reaches a blank symbol moves to accepting state and halts. - If ever
is encountered, the machine halts and rejects.
Special case:
- it is not necessary to scan any input, machine always accepts
If machine enters an infinite loop:
- accepting state cannot be reached
- machine never halts
- the input is rejected
Formal definition
- (these definitions may vary slightly and machines are usually not defined in formally and in detail)
-
where is a set of states is input alphabet is transition function : is start state is blank tape symbol is accept states
-
The accepted language, for any Turing machine
:- if language
is accepted by Turing machine then is Turing-recognizable - alternative terms: Turing-acceptable, recursively enumerable
- if language
Configuration
- configuration describes the machine state at time step
... | a | a | a | b | b | b | ... H
-
we can describe configuration as:
aaaqbbb
whereaaa
is the tape content to the left of the headq
is the current state ( ) and position of the head wrt the tapebbb
is the tape content to the right of the head
-
a move:
- a computation is a sequence:
- equivalent notation:
- equivalent notation: