98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,

Slides:



Advertisements
Similar presentations
CSE 311 Foundations of Computing I
Advertisements

Finite Automata CPSC 388 Ellen Walker Hiram College.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
CS5371 Theory of Computation
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
61 Nondeterminism and Nodeterministic Automata. 62 The computational machine models that we learned in the class are deterministic in the sense that the.
Finite Automata Finite-state machine with no output. FA consists of States, Transitions between states FA is a 5-tuple Example! A string x is recognized.
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.
56 Rumination on the Formal Definition of DPDA In the definition of DPDA, there are some parts that do not agree with our intuition. Let M = (Q, , ,

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.
CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
PZ03A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03A - Pushdown automata Programming Language Design.
Regular Expressions (RE) Empty set Φ A RE denotes the empty set Empty string λ A RE denotes the set {λ} Symbol a A RE denotes the set {a} Alternation M.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
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.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions.
REGULAR LANGUAGES.
Cs3102: Theory of Computation Class 6: Pushdown Automata Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual.
Lexical Analysis Constructing a Scanner from Regular Expressions.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
1 1. Let A ={r, p, i } and B = { w, o, r, l, d }. What does each of the following (a), (b) and (c) denote? Briefly explain in plain English. (a) A * B.
Lecture # 12. Nondeterministic Finite Automaton (NFA) Definition: An NFA is a TG with a unique start state and a property of having single letter as label.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
PZ03A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03A - Pushdown automata Programming Language Design.
Exercise 1 Consider a language with the following tokens and token classes: ID ::= letter (letter|digit)* LT ::= " " shiftL ::= " >" dot ::= "." LP ::=
1 Pushdown Automata There are context-free languages that are not regular. Finite automata cannot recognize all context-free languages.
Lecture Notes 
Overview of Previous Lesson(s) Over View  A token is a pair consisting of a token name and an optional attribute value.  A pattern is a description.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Theory of Computation Automata Theory Dr. Ayman Srour.
1 Section 11.2 Finite Automata Can a machine(i.e., algorithm) recognize a regular language? Yes! Deterministic Finite Automata A deterministic finite automaton.
1 Chapter Pushdown Automata. 2 Section 12.2 Pushdown Automata A pushdown automaton (PDA) is a finite automaton with a stack that has stack operations.
1 1. Eliminate all  -transitions from the following FA without changing the number of states and the language accepted by the automaton. You should also.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
Lecture #5 Advanced Computation Theory Finite Automata.
Non Deterministic Automata
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Pushdown Automata.
Chapter 7 PUSHDOWN AUTOMATA.
Pushdown Automata.
Recognizer for a Language
PZ03A - Pushdown automata
Chapter 2 FINITE AUTOMATA.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Non-Deterministic Finite Automata
Non-Deterministic Finite Automata
Non Deterministic Automata
Midterm (Models of Computation, Fall, 2000)
Homework #5 (Models of Computation, Spring, 2001) Due: Section 1; February 27 Section 2; February 28 ** Please put your homework in the collection.
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Principles of Computing – UFCFA3-30-1
Chapter 1 Regular Language
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Presentation transcript:

98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars, FA, and regular expressions, and designing them. However, we know that an NFA is a conceptual model that cannot directly be built because of the nondeterministic transition. Then what about all the NFA that appear in the examples and proofs? Are those nondeterministic automata remain as theoretical model that cannot bring down to the real world? For context-free languages, there are languages that can only be recognized by NPDA, for example {xx R | x  {a, b} * }. As far as PDA are concerned, NPDA are strictly more powerful than DPDA. For LBA, it is open problem. (Looks like the space restriction is too much for a DLBA to do the same computation as an NLBA does.) For TM, any problem that can be solved by an NTM can also be solved by a DTM by tracing every possible transition of an NTM computation using its unlimited space available.

99 Fortunately, for NFA there is a straightforward way to transform them into DFA. (Actually it is based on the same idea that we used to eliminate  - transitions.) The basic idea is to consider the set of states that can be reachable by a transition as a single state in deterministic transition. The following example will be enough to understand the technique. (We assume that the automaton has no  -transitions.) b a,b,c (a) An NFA a 1 2 a 0 b,c c start Notice that the state with label {0, 1, 2} is from the set of states given by the nondeterministic transition  (0, a) = {0, 1, 2}. Also notice that any state whose label contains an accepting state is defined as an accepting state in the deterministic machine. {0,1,2} {2} a a {1,2} b c b c c (b) Converted DFA 0 start b,c

100 Minimization Technique for DFA The number of states of an automaton has direct affect to the size of the machine realizing the automaton. Hence, it is very important to reduce the number of states, if possible. For PDA, LBA and TM, it is very difficult problem to reduce the number of states. However, for DFA there is very efficient algorithm for minimizing the number of states of a given DFA. Figure (a) below is a part of the state transition graph of a DFA M = ( Q, , , q 0, F ), where  = { a, b }. Clearly, for every w   *,  ( q 3, w ) is in an accepting state if and only if  ( q 4, w ) is. Hence, we can merge q 3 and q 4 into a single state as shown in Figure (b) without affecting the language of the machine. b a a b b a aa b q4q4 b q3q3 q1q1 q2q2 Figure (a) q 34 q1q1 q2q2 Figure (b) b

101 State Reduction by Partitioning We say two states p and q are equivalent (or indistinguishable), if, for every string w   *, transition  ( p, w ) ends in an accepting state if and only if  ( q, w) does. In the preceding slide states q 3 and q 4 are equivalent. There are efficient algorithms available for computing the sets of equivalent states of a given DFA. The following example shows a procedure using the set partitioning technique. The technique is similar to one that they use for partitioning people into groups (each having certain preferences) based on their responses to questionnaire. The following two slides show the detailed steps for computing equivalent state sets of the DFA in Figure (a) and constructing the reduced DFA shown in Figure (b). b ba bb a a b a b a a 5 0 Figure (a) A DFA b a a, b 3 1,2 a b 4,5 0 a, b Figure (b) Reduced DFA

102 Step 0: Partition the states according to accepting/non-accepting. P 1 P 2 { 3, 4, 5 } { 0, 1, 2 } Figure (a) Initial partition For a state q and symbol t, let P i be the response of q on t, if  (q, t) enters a state in P i. Step 1: Get the response of each state for each input symbol. Notice that States 3 and 0 show different responses from the ones of the other states in the same set. P 1 P 2 p 1 p 1 p 1 p 2 p 1 p 1 a  {3,4,5 } {0,1,2 } b  p 2 p 1 p 1 Figure (b) Record responses for each input symbol State Reduction by Partitioning(cont’ed)

103 Step 2: Partition the sets according to the responses, and go to Step 1 until no partition occurs. P 11 P 12 P 21 P 22 p 11 p 11 p 12 p 12 a   {4, 5}{3}{1, 2}{0} b   p 11 p 11 Figure (c) Partition the set, and record responses for each input symbol No further partition is possible for the sets P 11 and P 21. So the final partition results are as follows. {4, 5}{3} {1, 2}{0} (d) Final partition