CSCI 2670 Introduction to Theory of Computing September 28, 2005.
CSCI 2670 Introduction to Theory of Computing August 25, 2005.
-
Upload
terence-barnett -
Category
Documents
-
view
217 -
download
1
Transcript of CSCI 2670 Introduction to Theory of Computing August 25, 2005.
![Page 1: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/1.jpg)
CSCI 2670Introduction to Theory of
Computing
August 25, 2005
![Page 2: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/2.jpg)
Agenda
• Last class– Defined regular languages– Discussed creating DFA’s
• This class– Finish Section 1.1
• Next week– Section 1.2 (pages 47 – 63)
![Page 3: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/3.jpg)
Announcement
• Tutorials will be with Ryan Foster (room TBA)– Monday 2:30 – 3:30– Friday 10:00 – 11:00
• Hint on problem 0.12– The proof can be done without
induction. What can you conclude if all nodes have different degrees? In a graph with n nodes, what are the possible values for the degree of any node?
![Page 4: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/4.jpg)
Designing finite automata
• Select states specifically to reflect some important concept
• Ensure this meaning is relevant to the language you are trying to define
• Try to get “in the head” of the automaton
• Can also design a DFA by combining two other DFA’s
![Page 5: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/5.jpg)
Combining regular languages
• We can create a regular language from other regular languages A and B using specific allowable operations called regular operations– Union: A B– Concatenation: A B– Kleene star: A*
![Page 6: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/6.jpg)
Union is a regular operation
Theorem: The class of regular languages is closed under the union operation
Proof approach: Assume A1 and A2 are both regular languages with A1=L(M1) and A2=L(M2) and create a DFA M such that L(M) = A1A2
Method: Proof by construction
![Page 7: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/7.jpg)
Idea of construction
• Each state of the new DFA represents both where the same word would be if it was being processed in M1 and where it would be if it were processed in M2
– Keeping track of the progress of the string in both DFA’s simultaneously
![Page 8: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/8.jpg)
Example
q1 q2 q30 0
0,1
1
1
M1
q1,q1’
q2,q1’0
q3,q2’1
1
q1
’q2’ q3’1 0
00
M2
1
1
etc.
q3,q1’0
q1,q2’1
Maximum number of states?
9 product of number of states in M1 and in M2
![Page 9: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/9.jpg)
Formally defining M
• M = (Q,,,q0,F)
– Q = Q1 × Q2
• Q1 and Q2 are the states in machines M1 and M2, respectively
= 1 2
1 and 2 are the alphabets for machines M1 and M2, respectively
((r1,r2),a) = (1(r1,a), 2(r2,a))1 and 2 are the state transition functions
for machines M1 and M2, respectively
![Page 10: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/10.jpg)
Formally defining M
• M = (Q,,,q0,F)
– q0 = (r1, r2)
• r1 and r2 are the starting states in machines M1 and M2, respectively
– F = {(r1,r2) | r1F1 or r2F2}
• F1 and F2 are the accepting states for machines M1 and M2, respectively
![Page 11: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/11.jpg)
q1 q2 q30 0
1
0
1
M1
q1
’q2’1
0
M2
0,1
Another Example1
• Q = – {(q1,q1’), (q1,q2’), (q2,q1’), (q2,q2’), (q3,q1’),
(q3,q2’)}• Σ = {0,1}• q0 =
– (q1,q1’)• F =
– {(q1,q1’), (q1,q2’), (q2,q2’), (q3,q2’)}
![Page 12: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/12.jpg)
q1 q2 q30 0
1
0
1
M1
q1
’q2’1
0
M2
0,1
Another Example1
0 1
(q1,q1’) (,) (,)
(q1,q2’) (,) (,)
(q2,q1’) (,) (,)
(q2,q2’) (,) (,)
(q3,q1’) (,) (,)
(q3,q2’) (,) (,)
(q2,)
(q2,)
(q1,)
(q1,)
(q3,)
(q3,)
(q2,)
(q2,)
(q1,)
(q1,)
(q3,)
(q3,)
(q2,q1’)
(q3,q1’)
(q1,q1’)
(q1,q2’)
(q2,q2’)
(q3,q2’)
(q2,q2’)
(q3,q2’)
(q1,q2’)
(q1,q2’)
(q2,q2’)
(q3,q2’)
![Page 13: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/13.jpg)
Another example
q1’q1’
0
0
11
0
0
1
0
1
q2’q1’ q3’q1’
q1’q2’ q2’q2’ q3’q2’
1
1
1
0
0
![Page 14: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/14.jpg)
Concatenation is a regular operation
Theorem: The class of regular languages is closed under the concatenation operation
Proof approach: Assume A1 and A2 are both regular languages with A1=L(M1) and A2=L(M2) and create a DFA M such that L(M) = A1A2
Method: Proof by construction
![Page 15: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/15.jpg)
Idea of construction
• Any accepting state in M1 has a copy of M2 “tacked on”
– Problem: if we tack a copy of M2 on at each accepting states, we lose the deterministic property
![Page 16: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/16.jpg)
Example
q1 q2 q30 0
0,1
1
1
M1
1
q1
’q2’ q3’1 0
00
M2
1
q1 q2 q30 0
0,1
1
1
1
q1
’q2’ q3’1 0
00
1
ε
Can jump to q1’ non-deterministically
![Page 17: CSCI 2670 Introduction to Theory of Computing August 25, 2005.](https://reader036.fdocuments.net/reader036/viewer/2022082611/56649f1a5503460f94c2fcd1/html5/thumbnails/17.jpg)
Next week
• Non-determinism