This preview shows pages 1–8. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture 3: NFAs and Regular Expressions David Dill Department of Computer Science 1 Outline NFAs More operations on languages Regular expression syntax and semantics 2 NFA Idea; Allow state changes that dont consume input symbols (silent moves). Choice of whether to take transition is nondeterministic. q0 q1 1 q2 e 1 e (e in the drawing is ) The input 001 is accepted. The path followed is q q 2 q 1 q q 1 q 2 . 3 Definition of NFA The only difference in the mathematical definition is in : : Q ( { } ) 2 Q 4 closure Preliminary: the closure of state q , ECLOSE ( q ) , is the set of all states reachable from q by silent moves. ECLOSE ( q ) = { q } ECLOSE ( q 1 ) = { q 1 ,q 2 } ECLOSE ( q 2 ) = { q 1 ,q 2 } 5 Definition of ECLOSE Def: S is the least set satisfying property P if whenever P ( S ) holds, S S . ECLOSE ( q ) is the least set satisfying: q ECLOSE ( q ) ( s, ) ECLOSE ( q ) for all s ECLOSE ( q ) Also, ECLOSE ( S ) = uniontext { ECLOSE ( q )  q S } (Extend to sets this is overloading) 6 Acceptance by an NFA We can define for an NFA taking ECLOSE into account. Here is a recursive definition on the structure of strings: Base: w = : ( q, ) = ECLOSE ( q ) Induction: w = xa : ( q,xa ) = ECLOSE ( uniontext s ( q,x ) ( s,a )) (Same as for NFA, with...
View
Full
Document
This note was uploaded on 01/12/2010 for the course CS 154 at Stanford.
 '08
 Motwani,R
 Computer Science

Click to edit the document details