Languages and Finite Automata - PowerPoint PPT Presentation

1 / 100
About This Presentation
Title:

Languages and Finite Automata

Description:

Formal Languages. Turing Machines. Hinrich Sch tze. IMS, Uni ... The 0 is the delimiter that. separates the two numbers. 73. Start. Finish. final state ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 101
Provided by: cost70
Category:

less

Transcript and Presenter's Notes

Title: Languages and Finite Automata


1
Formal Languages Turing Machines Hinrich
Schütze IMS, Uni Stuttgart, WS 2007/08 Slides
based on RPI CSCI 2400 Thanks to Costas Busch
2
A Turing Machine
Tape
......
......
Read-Write head
Control Unit
3
The Tape
No boundaries -- infinite length
......
......
Read-Write head
The head moves Left or Right
4
......
......
Read-Write head
The head at each time step 1.
Reads a symbol 2. Writes a
symbol 3. Moves Left or Right
5
Example
Time 0
......
......
Time 1
......
......
1. Reads
2. Writes
3. Moves Left
6
Time 1
......
......
Time 2
......
......
1. Reads
2. Writes
3. Moves Right
7
The Input String
Input string
Blank symbol
......
......
head
Head starts at the leftmost position of the input
string
8
Input string
Blank symbol
......
......
head
Remark the input string is never empty
9
States Transitions
Write
Read
Move Left
Move Right
10
Example
Time 1
......
......
current state
11
Time 1
......
......
Time 2
......
......
12
Example
Time 1
......
......
Time 2
......
......
13
Example
Time 1
......
......
Time 2
......
......
14
Determinism
Turing Machines are deterministic
Not Allowed
Allowed
No lambda transitions allowed
15
Partial Transition Function
Example
......
......
Allowed
No transition for input symbol
16
Halting
The machine halts if there are no possible
transitions to follow
17
Example
......
......
No possible transition
HALT
18
Final States
Allowed
Not Allowed
  • Final states have no outgoing transitions
  • In a final state the machine halts

19
Acceptance
If machine halts in a final state
Accept Input
If machine halts in a non-final state
or If machine enters an infinite loop
Reject Input
20
Turing Machine Example
Language?
21
Turing Machine Example
A Turing machine that accepts the language
22
Time 0
23
Time 1
24
Time 2
25
Time 3
26
Time 4
Halt Accept
27
Rejection Example
Time 0
28
Time 1
No possible Transition
Halt Reject
29
Language?
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
Another Turing Machine Example
Language?
37
Another Turing Machine Example
Turing machine for the language
38
Time 0
39
Time 1
40
Time 2
41
Time 3
42
Time 4
43
Time 5
44
Time 6
45
Time 7
46
Time 8
47
Time 9
48
Time 10
49
Time 11
50
Time 12
51
Time 13
Halt Accept
52
Observation
If we modify the machine for the language
we can easily construct a machine for the
language
53
Formal Definitionsfor Turing Machines

54
Transition Function
55
Transition Function
56
Turing Machine
Input alphabet
Tape alphabet
States
Transition function
Final states
Initial state
blank
57
Configuration
Instantaneous description
58
Time 4
Time 5
A Move
59
Time 4
Time 5
Time 6
Time 7
60
Equivalent notation
61
Initial configuration
Input string
62
The Accepted Language
For any Turing Machine
Initial state
Final state
63
Standard Turing Machine
The machine we described is the standard
  • Deterministic
  • Infinite tape in both directions
  • Tape is the input/output file

64
Machine for L vvv in a,b ?

65
Computing FunctionswithTuring Machines

66
A function
has
Range
Domain
67
A function may have many parameters
Example
Addition function
68
Integer Domain
Decimal
5
Binary
101
Unary
11111
69
Definition
A function is computable if there is
a Turing Machine such that
Initial configuration
Final configuration
final state
initial state
For all
Domain
70
In other words
A function is computable if there is
a Turing Machine such that
Initial Configuration
Final Configuration
For all
Domain
71
Example
is computable
The function
are integers
Turing Machine
Input string
unary
Output string
unary
72
Start
initial state
The 0 is the delimiter that separates the two
numbers
73
Start
initial state
Finish
final state
74
The 0 helps when we use the result for other
operations
Finish
final state
75
Turing machine for function
76
Execution Example
Time 0
(2)
(2)
Final Result
77
Time 0
78
Time 1
79
Time 2
80
Time 3
81
Time 4
82
Time 5
83
Time 6
84
Time 7
85
Time 8
86
Time 9
87
Time 10
88
Time 11
89
Time 12
HALT accept
90
Another Example
is computable
The function
is integer
Turing Machine
Input string
unary
Output string
unary
91
Start
initial state
Finish
final state
92
Turing Machine for
93
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
94
Example
Start
Finish
95
Another Example
if
The function
if
is computable
96
Turing Machine for
if
if
Input
or
Output
97
Turing Machine Pseudocode
  • Repeat

Match a 1 from with a 1 from
Until all of or is matched
  • If a 1 from is not matched
  • erase tape, write 1
  • else
  • erase tape, write 0

98
Combining Turing Machines

99
Block Diagram
Turing Machine
input
output
100
Example
if
if
Adder
Comparer
Eraser
Write a Comment
User Comments (0)
About PowerShow.com