Lecture 10 Closure Properties of Regular Languages

Slides:



Advertisements
Similar presentations
Lecture 8 From NFA to Regular Language. Induction on k= # of states other than initial and final states K=0 a a* b a c d c*a(d+bc*a)*
Advertisements

COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou.
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
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 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.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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.
The Golden Chain εNFA  NFA  DFA  REGEX. Regular Expressions.
Regular Expressions. Notation to specify a language –Declarative –Sort of like a programming language. Fundamental in some languages like perl and applications.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to DFA.
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
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
1 Regular Expressions Reading: Chapter 3. 2 Regular Expressions vs. Finite Automata Offers a declarative way to express the pattern of any string we want.
Regular Languages ภาษาปกติ. Jaruloj Chongstitvatana Outline Regular expressions Regular languages Equivalence between languages accepted by.
Theory of Computing CSCI 356/541 Lab Session. Outline Lab 1: Finite Automata  Construct and Run Construct and Run  Manipulating Transitions Manipulating.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
Lecture 8 NFA Subset Construction & Epsilon Transitions
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Lecture 10 Closure Properties of Regular Languages Topics: Extended RegExpr Thompson Construction Test 1 Post Mortem October 1, 2008 CSCE 355 Foundations.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 1 Ahmed Ezzat.
1 Introduction to the Theory of Computation Regular Expressions.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Lecture 11 Minimization Topics: Strings distinguishing states Equivalence relation October 6, 2008 CSCE 355 Foundations of Computation.
Lecture 5 NFAs Topics: Induction review/PopQuiz NFAs Delta, delta hat Strings accepted, languages accepted Subset Construction June 5, 2015 CSCE 355 Foundations.
Cpt S 317: Spring 2009 Reading: Chapter 3
Lexical Analyzer in Perspective
3. Regular Expressions and Languages
Foundations of Computing Science
Chapter 3 Lexical Analysis.
Regular Expressions.
CSCE 355 Foundations of Computation
CSE 105 theory of computation
Single Final State for NFA
Closure Properties for Regular Languages
CSE322 PROPERTIES OF REGULAR LANGUAGES
CS 154, Lecture 3: DFANFA, Regular Expressions.
4. Properties of Regular Languages
Regular Expressions.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Closure Properties of Regular Languages
Chapter 4 Properties of Regular Languages
Chapter 1 Regular Language - 02
Subject Name: FORMAL LANGUAGES AND AUTOMATA THEORY
Lecture 6 NFA Subset Construction & Epsilon Transitions
Instructor: Aaron Roth
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Lecture 12 Non-Regular Languages
COMPILERS LECTURE(6-Aug-13)
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
CSE 105 theory of computation
Chapter 1 Regular Language
NFAs accept the Regular Languages
CSCE 355 Foundations of Computation
CSE 105 theory of computation
Presentation transcript:

Lecture 10 Closure Properties of Regular Languages CSCE 355 Foundations of Computation Lecture 10 Closure Properties of Regular Languages Topics: Extended RegExpr Thompson Construction June 13, 2015

Last Time: Readings 2.3 New: Mutual Induction Proof revisited Languages denoted by regular expressions Examples Ruby Regular Expressions TEST 2 – Monday New: Readings section 3.1,3.2(skip DFA RE), 3.3

Homework English descriptions  Regular expressions 3.1.1b – The set of strings of 0’s and 1’s such that the tenth symbol from the right is a 1. 3.1.1c - The set of strings of 0’s and 1’s with at most one pair of consecutive 1’s. 3.1.2 b The set of strings of 0’s and 1’s such that the number of zeroes is divisible by 5. Regular expressions  English descriptions 3.14b (0*1*)*000(0+1)* 3.14c (0+10)*1* Regular expressions  εNFA (construction) 3.2.4b (0+1)01 3.2.4c 00(0+1)* 3.14b, 3.14c convert to εNFA Text matching 3.3.1 re for matching phone numbers (international etc)

Regular expressions for Addresses Why? So we can automatically read email messages and extract addresses and insert into DB Joe Shmo 532 Spring Lake Road Columbia, SC 29209 Let’s start with Street Names Spring Lake Road Road | Rd. | Rd | avenue | Street | …

McNaughton-Yamada Construction Examples

McNaughton-Yamada Construction Examples Extended regular expressions

Lex and Flex Regular definitions Pattern match “.” Last pattern Examples digit = [0-9] alpha= [a-zA-Z_] id = {alpha} ({alpha} | {letter} | ‘_’)* %% id {install_InSymbolTable(yytext); return(ID);} while { return (KEYWHILE);}

Compilation

DFA RegExpr  NFA DFA Regular Languages

Not every language can be recognized by a DFA!

Algebraic Laws for Arithmetic Expressions Properties Equivalence of two expressions

Algebraic Laws for Regular Expressions What does it mean re1=re2 ?

Languages are Sets So Properties are Inherited Commutativity Law for alternation AUB = BUA so r l s = s l r Associativity Law for alternation (r + s) + t = r + (s + t) Associativity Law for concatenation (rs) t = r (st)

Commutivity

Identity/Annihilator

Distributive Laws In algebra Theorem 3.11 If L, M, and N are any languages, then L(M U N) = LM U LN Proof: w is in L(M U N) if and only if w is in LM U LN w is in L(M U N)  w is in LM U LN 

Factoring and Simplifying 0 + 01* = 0(ϵ + 1*) = 01*

Checking for Equality of Two Regular Expressions s = r ? (r+s)* = r* s*

Idempotent Law x + x ? xx ?

Laws involving Closures Ф* = ϵ ϵ* = ϵ L+ = L L* L* = L+ + ϵ L?

Is L intersection R regular?

Is the Complement of a Regular Lang. regular?

Not all Languages are regular L = {0n1n | n >= 1}

Every finite language is Regular

Discovering Laws for Regular Expressions (L +M)* = (L*M*)* Concretize expressions (only work for pure regular expressions, not intersections.)

Theorem 3.14 Theorem 3.14 The following test identifies true laws for regular expressions: Test for a Regular-Expression Algebraic Law to Test if regular expressions E = F is true (L(E) = L(F)) Convert E and F to concrete regular expressions C and D by replacing Variables by a concrete symbol Test whether L(C) = L(D) if so the E = F is true!

Pumping Lemma