Download presentation
Published byMia McDowell Modified over 11 years ago
1
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala
Turing Machine CSE-501 Formal Language & Automata Theory Aug-Dec,2010 ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala
2
The Language Hierarchy
? ? Context-Free Languages Regular Languages
3
Languages accepted by Turing Machines Context-Free Languages Regular Languages
4
A Turing Machine Tape ...... ...... Read-Write head Control Unit
5
The Tape No boundaries -- infinite length ...... ......
Read-Write head The head moves Left or Right
6
...... ...... Read-Write head The head at each time step: 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right
7
Example: Time 0 ...... ...... Time 1 ...... ...... 1. Reads 2. Writes 3. Moves Left
8
Time 1 ...... ...... Time 2 ...... ...... 1. Reads 2. Writes 3. Moves Right
9
The Input String Input string Blank symbol ...... ...... head
Head starts at the leftmost position of the input string
10
Input string Blank symbol ...... ...... head Remark: the input string is never empty
11
States & Transitions Write Read Move Left Move Right
12
Example: Time 1 ...... ...... current state
13
Time 1 ...... ...... Time 2 ...... ......
14
Example: Time 1 ...... ...... Time 2 ...... ......
15
Example: Time 1 ...... ...... Time 2 ...... ......
16
Determinism Not Allowed Turing Machines are deterministic Allowed
No lambda transitions allowed
17
Partial Transition Function
Example: ...... ...... Allowed: No transition for input symbol
18
Halting The machine halts if there are
no possible transitions to follow
19
Example: ...... ...... No possible transition HALT!!!
20
Final States Not Allowed Allowed
Final states have no outgoing transitions In a final state the machine halts
21
Acceptance If machine halts Accept Input in a final state
in a non-final state or If machine enters an infinite loop Reject Input
22
Turing Machine Example
A Turing machine that accepts the language:
23
Time 0
24
Time 1
25
Time 2
26
Time 3
27
Time 4 Halt & Accept
28
Rejection Example Time 0
29
Time 1 No possible Transition Halt & Reject
30
Infinite Loop Example A Turing machine for language
31
Time 0
32
Time 1
33
Time 2
34
Time 2 Time 3 Infinite loop Time 4 Time 5
35
Because of the infinite loop:
The final state cannot be reached The machine never halts The input is not accepted
36
Formal Definitions for Turing Machines
37
Transition Function
38
Transition Function
39
Turing Machine: Input alphabet Tape alphabet States Transition function Final states Initial state blank
40
Configuration Instantaneous description:
41
Time 4 Time 5 A Move:
42
Time 4 Time 5 Time 6 Time 7
43
Equivalent notation:
44
Initial configuration:
Input string
45
The Accepted Language For any Turing Machine Initial state Final state
46
Standard Turing Machine
The machine we described is the standard: Deterministic Infinite tape in both directions Tape is the input/output file
47
Computing Functions with Turing Machines
48
A function has: Result Region: Domain:
49
A function may have many parameters:
Example: Addition function
50
Integer Domain Decimal: 5 Binary: 101 We prefer unary representation: easier to manipulate with Turing machines Unary: 11111
51
Definition: A function is computable if there is a Turing Machine such that: Initial configuration Final configuration initial state final state For all Domain
52
In other words: A function is computable if there is a Turing Machine such that: Initial Configuration Final Configuration For all Domain
53
Example The function is computable are integers Turing Machine:
Input string: unary Output string: unary
54
Start initial state The 0 is the delimiter that separates the two numbers
55
Start initial state Finish final state
56
The 0 helps when we use the result for other operations Finish final state
57
Turing machine for function
58
Execution Example: Time 0 (2) (2) Final Result
59
Time 0
60
Time 1
61
Time 2
62
Time 3
63
Time 4
64
Time 5
65
Time 6
66
Time 7
67
Time 8
68
Time 9
69
Time 10
70
Time 11
71
Time 12 HALT & accept
72
Another Example – SELF STUDY
The function is computable is integer Turing Machine: Input string: unary Output string: unary
73
Start initial state Finish final state
74
Turing Machine Pseudocode for
Replace every 1 with $ Repeat: Find rightmost $, replace it with 1 Go to right end, insert 1 Until no more $ remain
75
Turing Machine for
76
Example Start Finish
77
Block Diagram Turing Machine input output
78
Turing’s Thesis
79
Turing’s thesis: Any computation carried out by mechanical means
can be performed by a Turing Machine (1930)
80
Computer Science Law: A computation is mechanical if and only if it can be performed by a Turing Machine There is no known model of computation more powerful than Turing Machines
81
Definition of Algorithm:
An algorithm for function is a Turing Machine which computes
82
Algorithms are Turing Machines
When we say: There exists an algorithm We mean: There exists a Turing Machine that executes the algorithm
83
Construct a Turing Machine:
Construct a TM to accept the set L of all strings over {0,1} ending with 010.
84
Can one TM simulate every TM?
Can a TM simulate a TM? Yes, obviously. Can one TM simulate every TM?
85
Universal Turing Machine An Any TM Simulator
Input: < Description of some TM m, w > Output: result of running m on w m Universal Turing Machine Output Tape for running TM- m starting on tape w w
86
Universal Turing Machine (UTM)
functional notation of UTM: U(“m”“w”) = “m(w)” takes 2 arguments: m : a description of a Turing Machine TM w : description of an input string w have 2 properties: UTM halts on input “m” “w” if & only if TM halts on input “w”.
87
Halting Problem
88
Thank you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.