Www.nskinfo.comwww.nskinfo.com && www.nsksofttch.com Department of nskinfo-i educationwww.nsksofttch.com CS2303-THEORY OF COMPUTATION uChapter: Closure.

Slides:



Advertisements
Similar presentations
Mathematical Preliminaries
Advertisements

CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
CS2303-THEORY OF COMPUTATION Push Down Automata (PDA)
Properties of Regular Languages
Chapter 4 An Introduction to Finite Automata
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Lecture 10: Context-Free Languages Contextually David Evans
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Fall Building languages If L is a language, then its complement is L’ = {w | w ∉ L} Let A.
PARIXIT PRASAD December 4, 2013 Parixit Prasad | CSA - IISC 1 Deciding Presburger Arithmetic Using Automata Department of Computer Science and Automaton.
ABC Technology Project
CS2303-THEORY OF COMPUTATION
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Finite-state Recognizers
Week 1.
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
We will resume in: 25 Minutes.
Chapter 6 Languages: finite state machines
Equivalence Relations
NFAs and DFAs Sipser 1.2 (pages 47-63).
The Pumping Lemma for CFL’s
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.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
1 Languages and Finite Automata or how to talk to machines...
Nondeterministic Finite Automata
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
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.
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.
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Introduction to Finite Automata
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
Introduction to Finite Automata
1 Decision Properties of Regular Languages General Discussion of “Properties” The Pumping Lemma Minimizing DFA.
1 Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
Deterministic Finite Automata
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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.
Languages.
Properties of Context-Free Languages
Closure Properties of Regular Languages
Closure Properties of Regular Languages
Single Final State for NFA
Decision Properties of Regular Languages
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
4. Properties of Regular Languages
Closure Properties of Regular Languages
The Pumping Lemma for CFL’s
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.
Presentation transcript:

&& Department of nskinfo-i educationwww.nsksofttch.com CS2303-THEORY OF COMPUTATION uChapter: Closure Properties of Regular Languages 1

2 Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

3 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.

4 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.

5 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*.

6 Closure Under Intersection uIf L and M are regular languages, then so is L M. uProof: Let A and B be DFAs whose languages are L and M, respectively. uConstruct C, the product automaton of A and B. uMake the final states of C be the pairs consisting of final states of both A and B.

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

8 Closure Under Difference uIf L and M are regular languages, then so is L – M = strings in L but not M. uProof: Let A and B be DFAs whose languages are L and M, respectively. uConstruct C, the product automaton of A and B. uMake the final states of C be the pairs where A-state is final but B-state is not.

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

10 Closure Under Complementation The complement of a language L (with respect to an alphabet Σ such that Σ * contains L) is Σ * – L. Since Σ * is surely regular, the complement of a regular language is always regular.

11 Closure Under Reversal uRecall example of a DFA that accepted the binary strings that, as integers were divisible by 23. uWe said that the language of binary strings whose reversal was divisible by 23 was also regular, but the DFA construction was very tricky. uGood application of reversal-closure.

12 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.

13 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 )*.

14 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.

15 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.

16 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).

17 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.

18 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)*.

19 Inverse Homomorphisms uLet h be a homomorphism and L a language whose alphabet is the output language of h. uh -1 (L) = {w | h(w) is in L}.

20 Example: Inverse Homomorphism Let h(0) = ab; h(1) = ε. uLet L = {abab, baba}. uh -1 (L) = the language with two 0s and any number of 1s = L(1*01*01*). Notice: no string maps to baba; any string with exactly two 0s maps to abab.

21 Closure Proof for Inverse Homomorphism uStart with a DFA A for L. uConstruct a DFA B for h -1 (L) with: wThe same set of states. wThe same start state. wThe same final states. wInput alphabet = the symbols to which homomorphism h applies.

22 Proof – (2) uThe transitions for B are computed by applying h to an input symbol a and seeing where A would go on sequence of input symbols h(a). Formally, δ B (q, a) = δ A (q, h(a)).

23 Example: Inverse Homomorphism Construction A C B a a a b b b C B A h(0) = ab h(1) = ε 1 1 1Since h(1) = ε 0 0, 0 Since h(0) = ab

24 Proof – (3) Induction on |w| shows that δ B (q 0, w) = δ A (q 0, h(w)). Basis: w = ε. δ B (q 0, ε ) = q 0, and δ A (q 0, h( ε )) = δ A (q 0, ε ) = q 0.

25 Proof – (4) uInduction: Let w = xa; assume IH for x. δ B (q 0, w) = δ B ( δ B (q 0, x), a). = δ B ( δ A (q 0, h(x)), a) by the IH. = δ A ( δ A (q 0, h(x)), h(a)) by definition of the DFA B. = δ A (q 0, h(x)h(a)) by definition of the extended delta. = δ A (q 0, h(w)) by def. of homomorphism.