Most powerful abstract model of computation. Can simulate any real computer (ignoring efficiency). Modelled by Alan Turing.
A 5-tuple .
Where:
- = finite set of states
- = input alphabet
- = tape alphabet
- = start state
- = transition function
Components
Tape
Consists of infinite cells. One dimensional. Works as memory.
Cell
A component inside the tape. Can be read from or written to.
Symbol
Element that can be written on a cell. means empty.
Tape Head
Points to a cell. Reads from or writes to a cell. Can move left or right or stay at the current cell.
CPU
Has internal state (from an finite set of states). Decides whether to move the tape head, in which direction to move, whether to write on the cell, what to write on the cell. Decisions based on current symbol and current state.
State
State of the machine (or the CPU). Includes 2 halting states:
- : Accept
- → Reject
Transition Function
It means, from state , reading :
- Write
- Move to state
- Move head
Configuration
Represents the current status. . Current symbol under tape head is underlined.
For input string , the machine starts at .
Configuration Changes
Turing machine changes from 1 configuration to another in each step. Can either move in:
- Single step
- Multiple steps
Halting
Turing machine halts when it reaches either of the halting states. May run forever without halting.
Acceptance
A string is accepted iff the machine reaches accepting state i.e. .
Examples
Regular Language
TM behaves like FA. Moves right only. Does not modify the tape.
Ends with “aba”
Must read entire input before accepting.
Palindromes
Match first and last symbols. Replace them and repeat. Deterministic.
Functions
TM can compute functions of the form .
TM computes iff .
Partial Functions
When the function is undefined for certain inputs.
TM will produce output only for valid inputs. Loop indefinitely otherwise.
Characteristic Function
For a language :
Combination
Suppose and are 2 Turing machines with disjoint non-halting states and transition functions.
denotes a new Turing machine that is a combination of the 2. It starts with the initial state of and executes first. For any move that halts in an accepting state of , the machine moves to the initial state of and execute . Can also be denoted as .
If either or rejects, also rejects.
Variations
Many minor variations can be defined such as:
- A Turing machine that must move either left or right
- A Turing machine that can either write a symbol or move but not both
- A Turing machine with multiple tapes and multiple tape heads However the ultimate computing power is unchanged.
n-tape Turing Machine
A Turing machine with multiple tapes. Each tape has its own tape head.
An -tape Turing machine is a 6-tuple where:
- : finite set of states
- : input alphabet
- : tape alphabet ()
- : initial state
- : set of accepting states
- : transition function
The machine reads n symbols (one from each tape). Based on the current state and these symbols:
- It moves to a new state
- Writes n symbols (one on each tape)
- Moves each tape head independently (Left, Right, or Stay)
Non-deterministic TM
Aka. NTM. Same as the deterministic TM except the transition function’s output is a set of configurations.
For any non-deterministic TM, there exists a deterministic TM that accept the same language.
Universal TM
Denoted by A Turing machine that can run any arbitrary program with an arbitrary data set (input to the program).
- The program is expressed as a string that specifies another special purpose TM,
- Data set is a string (input to )
simulates the processing of by .
Church-Turing Thesis
Formerly known as Church’s thesis. Says that a TM is a general model of computation, i.e. any real-world computation can be translated into an equivalent computation involving a Turing machine.
First formulated by Alonzo Church. Considered as a conjecture as well.
It’s generally accepted because:
- no one has proposed a counterexample for 90+ years
- other theoretical computation models have been proven to be equivalent to a Turing machine
- enhanced Turing machines do not enhance the computing power
- nature of Turing machine indicate all steps crucial to human computation
Characteristic Function
For any language in , its characteristic function is defined as:
Computing is the same as accepting a language.
A Turing machine may distinguish between strings that are in and not in by either:
- accepting or rejecting the string OR
- accepting and ending up in either or configurations
Accept vs Decide
A Turing machine accepts iff accepts all strings of . For all strings of , the Turing machine halts in an accepting state. But for other strings, it may:
- Halt at a rejecting state OR
- Loop forever
A Turing machine decides iff:
- halts in state and
- calculates its characteristic function, for every string .
Turing Completeness
A system is said to Turing complete if it can simulate any Turing machines.