CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages

Slides:



Advertisements
Similar presentations
&& Department of nskinfo-i educationwww.nsksofttch.com CS2303-THEORY OF COMPUTATION uChapter: Closure.
Advertisements

CS2303-THEORY OF COMPUTATION
Properties of Regular Sets
Finite-state Recognizers
The Pumping Lemma for CFL’s
Chapter Three: Closure Properties for Regular Languages
Properties of Regular Languages
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
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.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Mount Holyoke College 2 Building languages If L is a language, then its complement is L’ = {w |
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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.
Fall 2006Costas Busch - RPI1 Regular Expressions.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
Lecture 3: Closure Properties & Regular Expressions Jim Hook Tim Sheard Portland State University.
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...
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.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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.
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.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
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 August 25, 2005.
Lecture 5 Sept 06, 2012 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
1 Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism.
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.
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.
Lecture 15: Theory of Automata:2014 Finite Automata with Output.
Languages.
Properties of Context-Free Languages
Closure Properties of Regular Languages
Properties of Regular Languages
PROPERTIES OF REGULAR LANGUAGES
Formal Language & Automata Theory
Formal Language & Automata Theory
Closure Properties of Regular Languages
Single Final State for NFA
Language Recognition (12.4)
Closure Properties for Regular Languages
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
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 Regular Languages
Properties of Context-Free languages
Closure Properties of Regular Languages
Language Recognition (12.4)
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.
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
NFAs accept the Regular Languages
Presentation transcript:

CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages www.nskinfo.com && www.nsksofttch.com Department of nskinfo-i education CS2303-THEORY OF COMPUTATION Chapter: Closure Properties of Regular Languages

Closure Properties 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. For regular languages, we can use any of its representations to prove a closure property.

Closure Property …. Resultant languages obtained by performing some operations on regular languages are also regular Union Intersection Complement Difference Kleene’s star Concatenation Reversal Homomorphism Inverse Homomorphism

Closure of Regular languages under boolean operations Or : Let L and M be languages over alphabet ∑. Then L ᴜ M is the language that contains all strings that are are in either or both of L and M. And: Let L and M be languages over alphabet ∑. Then L ∩ M is the language that contains all strings that are both in L and M. * : Let L be a language over alphabet ∑. Then L’, the complement of L, is the set of strings in ∑* that are not in L.

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

Closure Under Concatenation and Kleene Closure Same idea: RS is a regular expression whose language is LM. R* is a regular expression whose language is L*.

Closure under Complement Operator Represented by L’ or Lᶜ. Denoted by L’ = ∑* - L Introduce a new state called “Dead ” state and transitions are added from the states to the dead state on left out input symbols  Accepting states are made as non accepting and vice versa

Closure of regular languages under Intersection operator The intersection of two sets is the set of elements that are not in the complement of either set. Using Demorgans Law

Closure of regular languages under Intersection …… If L and M are regular languages, then so is L  M. Proof: Let A and B be DFA’s whose languages are L and M, respectively. Construct C, the product automaton of A and B. Make the final states of C be the pairs consisting of final states of both A and B.

Example: Product DFA for Intersection 1 [A,C] [A,D] A B 1 0, 1 1 1 1 [B,C] [B,D] 1 C D 1

Closure under Difference Operator L-M is the difference of L and M, is the set of strings that are in language L but not in language M. L – M = L ∩ M’ Property of the language and set theory Since regular languages are closed under complement and intersection operators it may be concluded that L1 – L2 is also regular

Closure under Difference ….. Proof: Let A and B be DFA’s whose languages are L and M, respectively. Construct C, the product automaton of A and B. Make the final states of C be the pairs where A-state is final but B-state is not.

Example: Product DFA for Difference 1 [A,C] [A,D] A B 1 0, 1 1 1 1 [B,C] [B,D] 1 C D Notice: difference is the empty language 1

Reversal of a language Reversal of a string w with symbols a1 a2….an is a string represented as WR with symbols ana n-1….a1 For example if W =110110 then WR = 011011.

Closure under Reversal of a language Given language L, LR is the set of strings whose reversal is in L. Example: L = {0, 01, 100}; LR = {0, 10, 001}. Proof: Let E be a regular expression for L. We show how to reverse E, to provide a regular expression ER for LR.

Reversal of a Regular Expression Basis: If E is a symbol a, ε, or ∅, then ER = E. Induction: If E is F+G, then ER = FR + GR. FG, then ER = GRFR F*, then ER = (FR)*.

Set of states in M2 are same as that of M1 Initial state is a new state with transitions to all accepting states of M1 Final state is only one state and that is the initial state of M1 Reverse all transitions (i.e.) (p, a) = q, are rewritten as (q, a) = p

All the transitions are reversed

Homomorphism Substitute a particular string for each symbol. Denoted by h(L) Ex: h(0) =ab h(1)=Є if the string w=0011 then h(w)=h(0)h(0)h(1)h(1) =abab Theorem: If L is a regular language over alphabet ∑ and h is a homomorphism on ∑, then h(L) is also regular language.

Inverse Homomorphism Let L be the language over alphabet T. Then h-1(L) is the set of string w in ∑ * such that h(w) is in L. h-1(L) = {w | h(w) is in L}. Ex: r=(010)* h(0) =a h(1)=bb h-1(L) =(abba)* Theorem: If h is a homomorphism from alphabet ∑ to alphabet T, and L is a regular language over T, then h-1(L) the inverse homomorphism of the language L is also a regular language.