Download presentation

Presentation is loading. Please wait.

Published bySkyler Beezley Modified over 3 years ago

1
8/27/2009 Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 2 Theory of Computation Finite Automata Operations on languages Nondeterminism L2.1 Sofya Raskhodnikova; based on slides by Nick Hopper Homework 0 due Homework 1 handed out

2
JFLAP http://www.cs.duke.edu/csed/jflap/ L2.2 8/27/2009 Sofya Raskhodnikova; based on slides by Rakesh Verma aaa aaaaaa

3
Formal definition of FA L2.3 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper Q = {q 0, q 1, q 2, q 3 } Σ = {0,1} : Q Σ → Q transition function * q 0 Q is start state F = {q 1, q 2 } Q accept states M = (Q, Σ, , q 0, F) where M q2q2 0 0,1 0 0 1 1 1 q0q0 q1q1 q3q3 01 q0q0 q0q0 q1q1 q1q1 q2q2 q2q2 q2q2 q3q3 q2q2 q3q3 q0q0 q2q2 *

4
A language is regular if it is recognized by a finite automaton L = { w | w contains 001} is regular L = { w | w has an even number of 1s} is regular The language of M, L(M), is the set of strings that M accepts Language of FA 8/27/2009 L1.4Sofya Raskhodnikova; based on slides by Nick Hopper

5
8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper L1.5 Regular languages Many interesting programs accept regular languages NETWORK PROTOCOLS COMPILERS GENETIC TESTING ARITHMETIC

6
INTERNET TRANSMISSION CONTROL PROTOCOL Let TCPS = { w | w is a complete TCP Session} Theorem. TCPS is regular 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper L1.6

7
COMMENTS : Are delimited by /* */ Cannot have NESTED /* */ Must be CLOSED by */ */ is ILLEGAL outside a comment COMMENTS = {strings with legal comments} Theorem. COMMENTS is regular. Compilers 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper L1.7

8
DNA SEQUENCES are strings over the alphabet {A,C,G,T} GENES are special substrings A GENETIC TEST searches a DNA SEQUENCE for a GENE Theorem. Every GENETIC TEST is regular. Genetic testing 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper L1.8

9
LET 3 = A string over 3 has three ROWS Each ROW b 0 b 1 b 2 …b N represents the integer b 0 + 2b 1 + … + 2 N b N. Let ADD = {S | ROW 1 + ROW 2 = ROW 3 } Theorem. ADD is regular. { [ ],[ ],[ ],[ ], [ ],[ ],[ ],[ ]} 000000 001001 010010 011011 100100 101101 110110 111111 Arithmetic 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper L1.9

10
Operations on languages L2.10 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper Union: A B = { w | w A or w B } Intersection: A B = { w | w A and w B } Complement: A = { w | w A } Reverse: A R = { w 1 …w k | w k …w 1 A } Concatenation: A B = { vw | v A and w B } Star: A* = { w 1 …w k | k ≥ 0 and each w i A } Regular Union: A B = { w | w A or w B } Concatenation: A B = { vw | v A and w B } Star: A* = { w 1 …w k | k ≥ 0 and each w i A }

11
Closure properties of the class of regular languages L2.11 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper THEOREM. The class of regular languages is closed under all 6 operations. If A and B are regular, applying any of these operation yields a regular language.

12
Closure properties L2.12 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper Union: A B = { w | w A or w B } Complement: A = { w | w A }

13
Closure under union L2.13 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. The union of two regular languages is also a regular language Proof: Let M 1 = (Q 1, Σ, 1, q 0, F 1 ) be finite automaton for L 1 and M 2 = (Q 2, Σ, 2, q 0, F 2 ) be finite automaton for L 2 Construct a finite automaton M = (Q, Σ, , q 0, F) that recognizes L = L 1 L 2 1 2

14
Example L2.14 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper q0q0 q1q1 0 0 1 1 p0p0 p1p1 1 1 0 0 M1M1 M2M2 M = ?

15
Proof (continued) L2.15 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper Idea: Run both M 1 and M 2 at the same time! Q = pairs of states, one from M 1 and one from M 2 = { (q 1, q 2 ) | q 1 Q 1 and q 2 Q 2 } = Q 1 Q 2 q 0 = (q 0, q 0 ) 1 2 F = { (q 1, q 2 ) | q 1 F 1 or q 2 F 2 } ( (q 1,q 2 ), ) = ( 1 (q 1, ), 2 (q 2, ))

16
Example (continued) L2.16 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper q0q0 q1q1 0 0 1 1 p0p0 p1p1 1 1 0 0 M1M1 M2M2 q 0,p 0 q 1,p 0 q 0,p 1 q 1,p 1 0 0 0 0 1 1 1 1 M unionintersection

17
Closure properties L2.17 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper Union: A B = { w | w A or w B } Intersection: A B = { w | w A and w B } Complement: A = { w | w A } Reverse: A R = { w 1 …w k | w k …w 1 A }

18
Closure under reverse L2.18 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper Theorem. The reverse of a regular language is also regular language Proof: Let L be a regular language and M be a finite automaton that recognizes it. Construct a finite automaton M R recognizing L R Idea: Define M R as M with the arrows reversed Swap start and accept states

19
Closure under reverse L2.19 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper M R IS NOT ALWAYS A DFA! It may have many start states Some states may have too many outgoing edges, or none

20
Example L2.20 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper 1 0 1 0 1 0,1 0

21
L2.21 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper NON DETERMINISM 1 0 1 0 1 0,1 0 What happens with 100? Nondeterministic Finite Automaton (NFA) accepts if there is a way to make it reach an accept state

22
Nondeterminism Ways to think about nondeterminism parallel computation tree of possible computations guessing the “right” choice L2.22 Deterministic Computation Nondeterministic Computation accept or reject accept reject 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper

23
Example L2.23 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper 1 0 0 L(M)={1,00} ε ε

24
Example L2.24 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper 0,1 0,ε1 0,1 1 L(M)={w | w contains 101 or 11}

25
Formal Definition 8/25/2009 Q is the set of states Σ is the alphabet q 0 Q is the start state F Q is the set of accept states An NFA is a 5-tuple M = (Q, Σ, , q 0, F) L1.25 Sofya Raskhodnikova; based on slides by Nick Hopper : Q Σ ε → P(Q) is the transition function P(Q) is the set of subsets of Q and Σ ε = Σ {ε}

26
Example L2.26 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper 1 0 0 (q 3,1) = N = (Q, Σ, , Q 0, F) Q = {q 0, q 1, q 2, q 3, q 4 } Σ = {0,1} F = {q 4 } (q 2,1) = {q 4 } ε ε q1q1 q2q2 q3q3 q4q4 q0q0

27
Example L2.27 8/27/2009 Sofya Raskhodnikova; based on slides by Nick Hopper 0,1 0,ε1 0,1 1 (q 1,ε) = N = (Q, Σ, , q 0, F) Q = {q 0, q 1, q 2, q 3 } Σ = {0,1} F = {q 3 } (q 0,1) = {q 0, q 1 } {q 1,q 2 } (q 2,0) = q1q1 q2q2 q3q3 q0q0

Similar presentations

OK

1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.

1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Convert pdf to ppt online mac Ppt on conic sections for class 11 free download Ppt on higher education system in india Ppt on adr and gdr group Ppt on panel discussion sample Ppt on sports day poster Ppt on power line communication wiki Ppt on low level language examples What does appt only means Chemistry ppt on water