Cs466(Prasad)L14Equiv1 Equivalence of Regular Language Representations.

Slides:



Advertisements
Similar presentations
PrasadL12NFA2DFA1 NFA to DFA Conversion Rabin and Scott (1959)
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.
Properties of Regular Languages
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.
Fall 2006Costas Busch - RPI1 Regular Expressions.
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.
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.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
Fall 2005 CSE 467/567 1 Formal languages regular expressions regular languages finite state machines.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
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.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
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 25, 2005.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
 Regular Grammar and Regular Language [Def 3.1] Regular Grammar(use to in lexical analysis) Type 3 grammar(regular grammar, RG) Type 3 grammar(regular.
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
CS 3813: Introduction to Formal Languages and Automata
CS 203: Introduction to Formal Languages and Automata
Regular Expressions Costas Busch - LSU.
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Regular Grammars Reading: 3.3. What we know so far…  FSA = Regular Language  Regular Expression describes a Regular Language  Every Regular Language.
Finite Automata & Regular Languages Sipser, Chapter 1.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Conversions Regular Expression to FA FA to Regular Expression.
1 Chapter 3 Regular Languages.  2 3.1: Regular Expressions (1)   Regular Expression (RE):   E is a regular expression over  if E is one of:
1 Introduction to the Theory of Computation Regular Expressions.
LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
1 Section 11.2 Finite Automata Can a machine(i.e., algorithm) recognize a regular language? Yes! Deterministic Finite Automata A deterministic finite automaton.
Deterministic Finite Automata Nondeterministic Finite Automata.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
CS412/413 Introduction to Compilers Radu Rugina Lecture 3: Finite Automata 25 Jan 02.
Department of Software & Media Technology
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Language Recognition MSU CSE 260.
Properties of Regular Languages
Chapter 2 Finite Automata
Formal Language & Automata Theory
Single Final State for NFA
Language Recognition (12.4)
REGULAR LANGUAGES AND REGULAR GRAMMARS
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
4. Properties of Regular Languages
4b Lexical analysis Finite Automata
Closure Properties of Context-Free languages
Properties of Context-Free languages
4b Lexical analysis Finite Automata
Language Recognition (12.4)
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
NFAs accept the Regular Languages
CSCI 2670 Introduction to Theory of Computing
Finite Automata Part Three
Presentation transcript:

cs466(Prasad)L14Equiv1 Equivalence of Regular Language Representations

cs466(Prasad)L14Equiv2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin and Scott’s work) (Collapsing graphs; Structural Induction) (S. Kleene’s work) (Construction) (Solving linear equations)

cs466(Prasad)L14Equiv3 Role of various representations for Regular Languages Closure under complemention. (DFAs) Closure under union, concatenation, and Kleene star. (NFA- s, Regular expression.) Consequence: Closure under intersection by De Morgan’s Laws. Relationship to context-free languages. (Regular Grammars.) Ease of specification. (Regular expression.) Building tokenizers/lexical analyzers. (DFAs)

cs466(Prasad)L14Equiv4 Application to Scanner (Lexer, Tokenizer) High-level view Regular expressions NFA DFA Lexical Specification Table-driven Implementation of a minimal DFA

cs466(Prasad)L14Equiv5 M(a) Construction of Finite Automata from Regular Expressions Show that there are FA for basis elements and there exist constructions on FA for capturing union, concatenation, and Kleene star operations. Basis Case

cs466(Prasad)L14Equiv6 Constructions on NFA- s M(R1) M(R2) M M(R1 U R2) M M(R1 R2) M M(R*) M(R2) M(R)

cs466(Prasad)L14Equiv7 Construction of Regular Expression from Finite Automaton Expression Graph is a labeled directed graph in which the arcs are labeled by regular expressions. An expression graph, like a state diagram, contains a distinguished start node and a set of accepting nodes.

cs466(Prasad)L14Equiv8 Examples ab L(M) = (ab)*

cs466(Prasad)L14Equiv9 Examples ba L(M) = (b+ a)* (a u b) (ba)* b+ a a u b

cs466(Prasad)L14Equiv10 Examples bb L(M) = (b a)* b*( bb u (a+(ba)*b*) )* ba b*b* a+a+

cs466(Prasad)L14Equiv11 Main Idea To associate an RE with an FA, –reduce an arbitrary expression graph to one containing at most two nodes, –by repeatedly removing nodes from the graph and relabeling the arcs to preserve the language. Without loss of generality, we can assume one accepting state (because of the presence of the union operation).

cs466(Prasad)L14Equiv12 Example qj qk qj qi qk Wj,i Wj,i Wi,k Wi,k

cs466(Prasad)L14Equiv13 qj qk qj qi qk Wj,i Wj,i (Wi,i)* Wi,k Wi,k Wi,i

cs466(Prasad)L14Equiv14 Final Graph : Alternative 1 u L(M) = (u)*

cs466(Prasad)L14Equiv15 Final Graph : Alternative 2 w L(M) = (u)* v( w u (x (u)* v) )* u v x

cs466(Prasad)L14Equiv16 Detailed Example b a b a a b b q0 q1q2q3

cs466(Prasad)L14Equiv17 Delete node q1 b a b a a b b q0 q1q2q3bb ab

cs466(Prasad)L14Equiv18 Delete node q2 b a a b u bb q0 q2q3 ab ab*ab

cs466(Prasad)L14Equiv19 Finally a b u bb q0 q3 ab*ab (ab*ab)*a ((bubb) (ab*ab)*a)*

cs466(Prasad)L14Equiv20 For precise details, see Algorithm on Page 194 in Sudkamp’s Languages and Machines, 3 rd Edition.

cs466(Prasad)L14Equiv21 From Regular Expression to NFA to DFA to Regular Grammars Via Examples

cs466(Prasad)L14Equiv22 Exercise Construct a DFA for a+b+ q0 b q1q2 a a b

cs466(Prasad)L14Equiv23 Equivalent DFA {q0} {q1,q2} {q0,q1} {} a a a a,b b b b

cs466(Prasad)L14Equiv24 Two Equivalent (Right-linear) Regular Grammars -> a | a -> b | b -> λ -> a -> a | b -> λ | b All productions involving can be deleted, as does not derive any terminal strings.

cs466(Prasad)L14Equiv25 Two Equivalent (Left-linear) Regular Grammars -> λ | a -> b | a -> b -> λ -> a | a -> | b

cs466(Prasad)L14Equiv26 From Grammars to Finite Automata S -> aA | c A -> bB | bA B -> λ S -> aA | cF A -> bB | bA B -> λ F -> λ S A B F a b b c

cs466(Prasad)L14Equiv27 From Grammars to Finite Automata S -> aA | c A -> bB | bA B -> λ S -> λ A -> Sa | Ab B -> Ab F -> Sc Z Z -> B | F S A B F a b b c