Turing Machines
Sep 10, 2015
Turing Machines
Invented by Alan Turing in 1936.
A simple mathematical model of a general purpose computer.
It is capable of performing any calculation which can be performed by any computing machine.
The Language HierarchyRegular LanguagesContext-Free Languages??
Regular LanguagesContext-Free LanguagesLanguages accepted byTuring MachinesFinite AutomataNDPA
A Turing Machine............TapeRead-Write headControl Unit
The Tape............Read-Write headNo boundaries -- infinite length The head moves Left or Right
............Read-Write headThe head at each time step:
1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right
............Example:Time 0............Time 11. Reads2. Writes 3. Moves Left
............Time 1............Time 21. Reads2. Writes 3. Moves Right
The Input String............Blank symbolheadHead starts at the leftmost positionof the input string
Input stringAre treated as left and right brackets for the input written on the tape.
States & TransitionsReadWriteMove LeftMove Right
Example:............Time 1current state
............Time 1............Time 2
............Time 1............Time 2Example:
............Time 1............Time 2Example:
DeterminismAllowedNot AllowedNo lambda transitions allowedTuring Machines are deterministic
Partial Transition Function............Example:No transitionfor input symbol Allowed:
HaltingThe machine halts if there areno possible transitions to follow
Example:............No possible transitionHALT!!!
Final StatesAllowedNot Allowed Final states have no outgoing transitions
In a final state the machine halts
AcceptanceAccept InputIf machine halts in a final state Reject Input If machine halts in a non-final state or If machine enters an infinite loop
Turing Machine ExampleA Turing machine that accepts the language:
Time 0
Time 1
Time 2
Time 3
Time 4Halt & Accept
Rejection ExampleTime 0
Time 1No possible TransitionHalt & Reject
Infinite Loop Example
Time 0
Time 1
Time 2
Time 2Time 3Time 4Time 5... Infinite Loop
Because of the infinite loop:
The final state cannot be reached
The machine never halts
The input is not accepted
Another Turing Machine ExampleTuring machine for the language
Time 0
Time 1
Time 2
Time 3
Time 4
Time 5
Time 6
Time 7
Time 8
Time 9
Time 10
Time 11
Time 12
Halt & AcceptTime 13
If we modify the machine for the language we can easily construct a machine for the languageObservation:
Formal Definitionsfor Turing Machines
Transition Function
Turing Machine:StatesInputalphabetTapealphabetA partial TransitionfunctionInitialstateBlank : a special symbolOf Finalstates
ConfigurationInstantaneous description:
Time 4Time 5A Move:
Time 4Time 5Time 6Time 7
Equivalent notation:
Initial configuration:Input string
The Accepted LanguageFor any Turing MachineInitial stateFinal state
Standard Turing Machine Deterministic
Infinite tape in both directions
Tape is the input/output fileThe machine we described is the standard:
Design a Turing machine to recognize all strings in which 010 is present as a substring.
q0q1q2H0,0,R1,1,R0,0,R0,0,R1,1, R1,1,R
DFA for the previous languageq0q1q20100110 , 1
Turing machine for odd no of 1s1, 1 , R1, b , R1, b , R
Recursively Enumerable and Recursive
Languages
Definition:A language is recursively enumerableif some Turing machine accepts it
For string :Let be a recursively enumerable languageand the Turing Machine that accepts itifthen halts in a final state ifthen halts in a non-final stateor loops forever
Definition:A language is recursiveif some Turing machine accepts itand halts on any input stringIn other words: A language is recursive if there is a membership algorithm for it
For string :Let be a recursive languageand the Turing Machine that accepts itifthen halts in a final state ifthen halts in a non-final state
We will prove:1. There is a specific language which is not recursively enumerable (not accepted by any Turing Machine)2. There is a specific language which is recursively enumerable but not recursive
RecursiveRecursively EnumerableNon Recursively Enumerable
We will first prove: If a language is recursive then there is an enumeration procedure for it A language is recursively enumerable if and only if there is an enumeration procedure for it
The Chomsky Hierarchy
Unrestricted Grammars:ProductionsString of variablesand terminalsString of variablesand terminals
Example unrestricted grammar:
A language is recursively enumerableif and only if is generated by anunrestricted grammarTheorem:
Context-Sensitive Grammars:and:ProductionsString of variablesand terminalsString of variablesand terminals
The language is context-sensitive:
The language is context-sensitive:
A language is context sensistive if and only if is accepted by a Linear-Bounded automatonTheorem:
There is a language which is context-sensitivebut not recursiveObservation:
Non-recursively enumerableRecursively-enumerableRecursiveContext-sensitiveContext-freeRegularThe Chomsky Hierarchy