LectureNotes8

LectureNotes8 - ECS 120 Lesson 8 Regular Expressions, Pt. 2...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECS 120 Lesson 8 Regular Expressions, Pt. 2 Oliver Kreylos Monday, April 16th, 2001 1 Equivalence of Regular Expressions and Fi- nite State Machines, Contd. Today we will prove the other direction of the proof started last time: The language accepted by any NFA M can also be generated by a regular expres- sion R . We will prove this by giving an algorithm to convert an NFA into an equivalent regular expression. Before we can do this, we have to introduce yet another machine type, a generalized nondeterministic finite automaton (GNFA) . 2 Generalized Nondeterministic Finite Au- tomata A GNFA is very similar to a usual NFA; the main difference is, that each transition arrow is not labeled with a single character (or the symbol ), but with a complete regular expression. For convenience, we will denote the set of all possible regular expressions over the alphabet as R (). We also add some minor requirements to make the following proof a little easier: We require that there are no transition arrows going into the start state; that there is exactly one final state; that there are no transition arrows leaving from the final state; and that there is a transition arrow going from each state to every other state (including itself). 1 2.1 Formal Definition of GNFAs A GNFA M is a five-tuple M = ( Q, , , q start , q final ), where Q is a finite set of states, is the input alphabet, : ( Q \ { q final } ) ( Q \ { q start } ) R () is the transition function, q start is the start state, and q final is the final state. Note the different way the transition function is defined: For a DFA, the transition function takes a state and an input character as arguments and returns the next state in the computation; for a GNFA, the transition func- tion takes two states q 1 6 = q final and q 2 6 = q start as arguments and returns the regular expression written along the transition arrow from q 1 to q 2 . This is a valid definition, since we required that there is a transition arrow from each state (except the final state) to each other state (except the start state). 2.2 Computation of GNFAs As opposed to DFAs or NFAs, which read a single input character when transitioning from one state to the next, a GNFA transitions from one state to the next by reading a block of input characters that matches the regular expression the transition arrow is labeled with. A GNFA accepts a word w * , iff w can be written as a concatenation...
View Full Document

This note was uploaded on 05/20/2010 for the course ECS 120 taught by Professor Filkov during the Spring '07 term at UC Davis.

Page1 / 7

LectureNotes8 - ECS 120 Lesson 8 Regular Expressions, Pt. 2...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online