CSCI 2670 Introduction to Theory of Computing September 7, 2004.

Slides:



Advertisements
Similar presentations
CSC 361NFA vs. DFA1. CSC 361NFA vs. DFA2 NFAs vs. DFAs NFAs can be constructed from DFAs using transitions: Called NFA- Suppose M 1 accepts L 1, M 2 accepts.
Advertisements

CSCI 2670 Introduction to Theory of Computing September 13, 2005.
Applied Computer Science II Chapter 1 : Regular Languages Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany.
Regular expressions Regular languages Sipser 1.3 (pages 63-76)
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Regular expressions Regular languages Sipser 1.3 (pages 63-76)
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Introduction to Computability Theory
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Regular Expressions.
CS 310 – Fall 2006 Pacific University CS310 Regular Expressions Sections:1.3 page 63 September 18, 2006 September 20, 2006.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Lecture 8 Sept 29, 2011 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
1 Non-Deterministic Automata Regular Expressions.
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
1.Defs. a)Finite Automaton: A Finite Automaton ( FA ) has finite set of ‘states’ ( Q={q 0, q 1, q 2, ….. ) and its ‘control’ moves from state to state.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Theory of Languages and Automata
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
CSCI 2670 Introduction to Theory of Computing August 26, 2004.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
Lecture 5 Sept 06, 2012 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
Lesson No.6 Naveen Z Quazilbash. Overview Attendance and lesson plan sharing Assignments Quiz (10 mins.). Some basic ideas about this course Regular Expressions.
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing September 13.
Regular Expressions Costas Busch - LSU.
August 23, 2005 CSCI 2670 Introduction to Theory of Computing August 23, 2005.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
CSCI 3130: Formal languages and automata theory Tutorial 1 Lee Chin Ho.
Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language.
1 Introduction to the Theory of Computation Regular Expressions.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Computation Automata Theory Dr. Ayman Srour.
Non Deterministic Automata
Regular Expressions Sections:1.3 page 63 September 17, 2008
Nondeterministic Finite Automata
Single Final State for NFA
Non-Deterministic Finite Automata
Non-Deterministic Finite Automata
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

CSCI 2670 Introduction to Theory of Computing September 7, 2004

Agenda Last week –Section 1.2 –NFA’s Today –Start Section 1.3 Regular expressions This week –Sections 1.3 and 1.4 May not complete Section 1.4

Announcement Homework due next Tuesday (9/14) –1.5e, 1.12a, 1.16a (show the GNFA steps), 1.17b, 1.39 Quiz tomorrow –Section 1.2 & Formal definition of RE

Regular expressions (RE’s) So far we have had to describe languages either with finite automata or with words –Potentially clumsy or imprecise Today we learn precise expression to describe regular languages –Example: All strings with at least one 1 becomes  *  {1}  *, or more simply  * 1  *

Where have you seen RE’s? Grep Awk Perl Search expressions within emacs or vi

RE inductive definition R is a regular expression if R is 1.a for some a   2. ε 3.  4.R 1  R 2 where R 1 and R 2 are both regular expressions 5.R 1  R 2 where R 1 and R 2 are both regular expressions 6.(R 1 * ) R 1 is a regular expression

Examples 0 * 10 * 10 * –{w | w contains exactly two 1’s}  11  –{w | w contains two consecutive 1’s}  1(0  ε)1  –{w | w contains two 1’s separated by at most one 0} (0  ε)(1  ε) –{0,1,01,ε}

RE’s and regular languages Theorem: A language is regular if and only if some regular expression describes it. –i.e., every regular expression has a corresponding DFA and vice versa

RE’s and regular languages Lemma: If a language is described by a regular expression, then it is regular. –find an NFA corresponding to any regular expression –use inductive definition of RE’s

1. R=a for some a  N = {{q 1,q 2 }, , ,q 1,{q 2 }} where  (q 1,a)=q 2 and  (r,x)=  whenever r=q 2 or x=b a q1q1 q2q2

2. R= ε N = {{q 1 }, , ,q 1,{q 1 }} where  (q 1,x)=  for all x q1q1

3. R=  N = {{q 1 }, , ,q 1,  } where  (q 1,x)=  for all x q1q1

Remaining constructions R = R 1  R 2 R = R 1  R 2 R = R 1 * These were all shown to be regular operators –We know we can construct NFA’s for R provided they exist for R 1 and R 2

Example R =  1 –R = (0  1)1 0 R 1 = 0 R 3 = 0  ε ε 1 R = (0  1)1 0 1 ε ε ε ε 1 R 2 = 1

Example2 R = 1(0  ε)  * 1 R 1 = 1 R 2 = 0  ε 0 ε ε ε 0,1 R 3 =  * ε R = 1(0  ε )  * 1 0 ε ε ε ε 0,1 ε ε ε

Equivalence of RE’s and DFA’s We have seen that every RE has a corresponding NFA –Therefore, every RE has a corresponding DFA We need to show that every DFA can be described by a regular expression Begin by converting all DFA’s into GNFA’s –Generalized Non-deterministic Finite Automata

GNFA’s A GNFA is an NFA with the following properties: 1.The start state has transition arrows going to every other state, but no arrows coming in from any other state 2.There is exactly one accept state and there is an arrow from every other state to this state, but no arrows to any other state from the accept state 3.The start state is not the accept state

GNFA’s (continued) 4.Except for the start and accept states, one arrow goes from every state to every other state and also from each state to itself 5.Instead of being labeled with symbols from the alphabet, transitions are labeled with regular expressions