Theory of Computation Automata Theory Dr. Ayman Srour.

Slides:



Advertisements
Similar presentations
CSE 311 Foundations of Computing I
Advertisements

4b Lexical analysis Finite Automata
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.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Finite Automata CPSC 388 Ellen Walker Hiram College.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
1 Introduction to Computability Theory Discussion1: Conversion of A DFA to a Regular Expression Prof. Amos Israeli.
Introduction to Computability Theory
Regular expressions Regular languages Sipser 1.3 (pages 63-76)
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
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
1 Introduction to Computability Theory Discussion1: Non-Deterministic Finite Automatons Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
CS 310 – Fall 2006 Pacific University CS310 Regular Expressions Sections:1.3 page 63 September 18, 2006 September 20, 2006.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
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.
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.
CS 310 – Fall 2006 Pacific University CS310 Homework 2 & JFLAP September 22, 2006.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Today Chapter 1: RE = Regular Languages, nonregular languages RL pumping lemma Chapter 2: Context-Free Languages (CFLs)
NFA ε - NFA - DFA equivalence. What is an NFA An NFA is an automaton that its states might have none, one or more outgoing arrows under a specific symbol.
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.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing September 13.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
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.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
1 Introduction to the Theory of Computation Regular Expressions.
CSCI 2670 Introduction to Theory of Computing September 7, 2004.
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.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Languages and Automata By: Mojtaba Khezrian.
Non Deterministic Automata
Regular Expressions Sections:1.3 page 63 September 17, 2008
Chapter 2 FINITE AUTOMATA.
COT 4210 Lecture Notes - 3 By Njegos and Monika.
Non-Deterministic Finite Automata
Non-Deterministic Finite Automata
Non Deterministic Automata
Finite Automata.
4b Lexical analysis Finite Automata
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
4b Lexical analysis Finite Automata
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

Theory of Computation Automata Theory Dr. Ayman Srour

TOPIC 2: REGULAR LANGUAGES OUTLINE 2.1 Introduction 2.2 Finite Automata 2.3 Nondeterminism 2.4 Regular Expressions 2.5 Generalized Nondeterministic Finite Automaton

A new type of finite automaton called a generalized nondeterministic finite automaton, GNFA. First we show how to convert DFAs into GNFAs, and then GNFAs into regular expressions. Generalized nondeterministic finite automata are simply nondeterministic finite automata wherein the transition arrows may have any regular expressions as labels, instead of only members of the alphabet or ε. The GNFA reads blocks of symbols from the input, not necessarily just one symbol at a time as in an ordinary NFA.

2.5 Generalized Nondeterministic Finite Automaton A GNFA is nondeterministic and so may have several different ways to process the same input string. It accepts its input if its processing can cause the GNFA to be in an accept state at the end of the input.

2.5 Generalized Nondeterministic Finite Automaton For convenience we require that GNFAs always have a special form that meets the following conditions. The start state has transition arrows going to every other state but no arrows coming in from any other state. There is only a single accept state, and it has arrows coming in from every other state but no arrows going to any other state. The accept state is not the same as the start state. Except for the start and accept states, one arrow goes from every state to every other state and also from each state to itself.

2.5 Generalized Nondeterministic Finite Automaton We can easily convert a DFA into a GNFA in the special form. We simply add a new start state with an ε arrow to the old start state and a new accept state with ε arrows from the old accept states. If any arrows have multiple labels we replace each with a single arrow whose label is the union of the previous labels. Finally, we add arrows labeled Ø between states that had no arrows. This last step won't change the language recognized because a transition labeled with 0 can never be used.

2.5 Generalized Nondeterministic Finite Automaton Now we show how to convert a GNFA into a regular expression. Say that the GNFA has k states. Then, because a GNFA must have a start and an accept state and they must be different from each other, we know that k >= 2. If k > 2, we construct an equivalent GNFA with k - 1 states. This step can be repeated on the new GNFA until it is reduced to two states.

2.5 Generalized Nondeterministic Finite Automaton If k == 2, the GNFA has a single arrow that goes from the start state to the accept state. The label of this arrow is the equivalent regular expression. For example, the stages in converting a DFA with three states to an equivalent regular expression are shown in the following figure.

2.5 Generalized Nondeterministic Finite Automaton

2.5 Generalized Nondeterministic Finite Automaton

2.5 Generalized Nondeterministic Finite Automaton Example 1: In this example we use the preceding algorithm to convert a DFA into a regular expression. We begin with the two-state DFA in Figure (a). In Figure (b) we make a four-state GNFA by adding a new start state and a new accept state, called s and a instead of q start and q accep t so that we can draw them conveniently.

2.5 Generalized Nondeterministic Finite Automaton Example 1: To avoid cluttering up the figure, we do not draw the arrows labeled Ø, even though they are present. Note that we replace the label a, b on the self-loop at state 2 on the DFA with the label aUb at the corresponding point on the GNFA.

2.5 Generalized Nondeterministic Finite Automaton Example 1: In Figure (c) we remove state 2, and update the remaining arrow labels. In Figure (d) we remove state 1 from part (c) and follow the same procedure. Because only the start and accept states remain, the label on the arrow joining them is the regular expression that is equivalent to the original DFA.

2.5 Generalized Nondeterministic Finite Automaton Example 2: In this example we begin with a three-state DFA. The steps in the conversion are shown in the following figure.

2.5 Generalized Nondeterministic Finite Automaton Example 2:

2.5 Generalized Nondeterministic Finite Automaton Example 2: