1 Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism.

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
Advertisements

&& Department of nskinfo-i educationwww.nsksofttch.com CS2303-THEORY OF COMPUTATION uChapter: Closure.
6.2 Closure Properties of CFL's
Properties of Regular Languages
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)*
Automata and Formal Languages Tim Sheard 1 Lecture 9 Reasoning with DFAs.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
NFAs Sipser 1.2 (pages 47–54). CS 311 Fall Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
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.
1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction.
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 Languages and Finite Automata or how to talk to machines...
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
1 Module 31 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union, concatenation.
Nondeterministic Finite Automata
1 Lecture 19 Closure Properties for LFSA using NFA’s –union second proof –concatenation –Kleene closure.
Definitions Equivalence to Finite Automata
Decision Properties of Regular Languages
1 Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism.
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.
1 Regular Expressions Definitions Equivalence to Finite Automata.
Properties of Context-Free Languages
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
NFA Closure Properties Sipser pages pages NFAs also have closure properties We have given constructions for showing that DFAs are closed under.
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.
Transition Diagrams Lecture 3 Wed, Jan 21, Building Transition Diagrams from Regular Expressions A regular expression consists of symbols a, b,
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.
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
1 Closure Properties of Regular Languages L 1 and L 2 are regular. How about L 1  L 2, L 1  L 2, L 1 L 2, L 1, L 1 * ?
CS 203: Introduction to Formal Languages and Automata
Introduction to Finite Automata
1 Decision Properties of Regular Languages General Discussion of “Properties” The Pumping Lemma Minimizing DFA.
1 Regular Expressions Definitions Equivalence to Finite Automata.
Regular Languages ภาษาปกติ. Jaruloj Chongstitvatana Outline Regular expressions Regular languages Equivalence between languages accepted by.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
Strings and Languages Denning, Section 2.7. Alphabet An alphabet V is a finite nonempty set of symbols. Each symbol is a non- divisible or atomic object.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory III Properties of Regular Languages 1.Closure 2.Union 3.Concatenation 4.Complement(Negation)
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
Languages.
Properties of Context-Free Languages
Closure Properties of Regular Languages
Properties of Regular Languages
FORMAL LANGUAGES AND AUTOMATA THEORY
Formal Language & Automata Theory
Lecture 9 Theory of AUTOMATA
Closure Properties of Regular Languages
Single Final State for NFA
Decision Properties of Regular Languages
Closure Properties for Regular Languages
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
Closure Properties of DFAs
COSC 3340: Introduction to Theory of Computation
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
4. Properties of Regular Languages
Closure Properties of Context-Free languages
Closure Properties of Regular Languages
Properties of Context-Free languages
Closure Properties of Regular Languages
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
NFAs accept the Regular Languages
Presentation transcript:

1 Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism

2 Closure Properties uRecall a closure property is a statement that a certain operation on languages, when applied to languages in a class (e.g., the regular languages), produces a result that is also in that class. uFor regular languages, we can use any of its representations to prove a closure property.

3 Closure Under Union uIf L and M are regular languages, so is L  M. uProof: Let L and M be the languages of regular expressions R and S, respectively. uThen R+S is a regular expression whose language is L  M.

4 Closure Under Concatenation and Kleene Closure uSame idea: wRS is a regular expression whose language is LM. wR* is a regular expression whose language is L*.

5 Closure Under Complementation  The complement of a language L (with respect to an alphabet Σ such that Σ * contains L) is Σ * – L. uProof: if A is DFA for L then A¯ is DFA that accepted states  unaccepted states and unaccepted states  accepted states.

6 Closure Under Intersection uIf L and M are regular languages, then so is L  M. uProof: L and M are regular so L¯ and M ¯ are regular. So L¯  M ¯ is regular. uDemorgan Rule: (L¯  M ¯ ) ¯ = L  M is regular.

7 Closure Under Difference uIf L and M are regular languages, then so is L – M = strings in L but not M. uProof: L – M = L  M ¯

8 Closure Under Reversal u If L is regular Language then L R is regular. uProof: if A is DFA for L then A R is DFA that : w1) q 0 is final state. w2) q f is start state. w3) Reverse all transitions.

9 Closure Under Reversal – (2) uGiven language L, L R is the set of strings whose reversal is in L. uExample: L = {0, 01, 100}; L R = {0, 10, 001}. uProof: Let E be a regular expression for L. uWe show how to reverse E, to provide a regular expression E R for L R.

10 Reversal of a Regular Expression  Basis: If E is a symbol a, ε, or ∅, then E R = E. uInduction: If E is wF+G, then E R = F R + G R. wFG, then E R = G R F R wF*, then E R = (F R )*.

11 Example: Reversal of a RE uLet E = 01* + 10*. uE R = (01* + 10*) R = (01*) R + (10*) R u= (1*) R 0 R + (0*) R 1 R u= (1 R )*0 + (0 R )*1 u= 1*0 + 0*1.

12 Homomorphisms uA homomorphism on an alphabet is a function that gives a string for each symbol in that alphabet.  Example: h(0) = ab; h(1) = ε. uExtend to strings by h(a 1 …a n ) = h(a 1 )…h(a n ). uExample: h(01010) = ababab.

13 Closure Under Homomorphism uIf L is a regular language, and h is a homomorphism on its alphabet, then h(L) = {h(w) | w is in L} is also a regular language. uProof: Let E be a regular expression for L. uApply h to each symbol in E. uLanguage of resulting RE is h(L).

14 Example: Closure under Homomorphism  Let h(0) = ab; h(1) = ε. uLet L be the language of regular expression 01* + 10*.  Then h(L) is the language of regular expression ab ε * + ε (ab)*. Note: use parentheses to enforce the proper grouping.

15 Example – Continued  ab ε * + ε (ab)* can be simplified.  ε * = ε, so ab ε * = ab ε.  ε is the identity under concatenation.  That is, ε E = E ε = E for any RE E.  Thus, ab ε * + ε (ab)* = ab ε + ε (ab)* = ab + (ab)*. uFinally, L(ab) is contained in L((ab)*), so a RE for h(L) is (ab)*.