PROPERTIES OF REGULAR LANGUAGES

Slides:



Advertisements
Similar presentations
Properties of Regular Sets
Advertisements

Lecture 9,10 Theory of AUTOMATA
Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
1 Midterm I review Reading: Chapters Test Details In class, Wednesday, Feb. 25, :10pm-4pm Comprehensive Closed book, closed notes.
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
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.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
Courtesy Costas Busch - RPI1 Non-regular languages.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
1 Non-regular languages. 2 Regular languages Non-regular languages.
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.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Closure.
CS 3240 – Chapter 4.  Closure Properties  Algorithms for Elementary Questions:  Is a given word, w, in L?  Is L empty, finite or infinite?  Are L.
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
Properties of Regular Languages
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
CS355 - Theory of Computation Regular Expressions.
CS 203: Introduction to Formal Languages and Automata
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University 2006.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language.
Chapters 11 and 12 Decision Problems and Undecidability.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
CSE 105 theory of computation
Formal Language & Automata Theory
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
Non Deterministic Automata
Properties of Regular Languages
FORMAL LANGUAGES AND AUTOMATA THEORY
CSE 3813 Introduction to Formal Languages and Automata
PDAs Accept Context-Free Languages
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Single Final State for NFA
Chapter 2 FINITE AUTOMATA.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Infiniteness Test The Pumping Lemma Nonregular Languages
Regular Expression We shall build expressions from the symbols using simple operations include concatenation, union and kleen closure. Several intuitive.
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
4. Properties of Regular Languages
Non-Deterministic Finite Automata
Decidable Languages Costas Busch - LSU.
Deterministic PDAs - DPDAs
Closure Properties of Context-Free languages
Elementary Questions about Regular Languages
Non-regular languages
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Chapter 4 Properties of Regular Languages
CS21 Decidability and Tractability
Applications of Regular Closure
CHAPTER 1 Regular Languages
NFAs accept the Regular Languages
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

PROPERTIES OF REGULAR LANGUAGES Chapter 4 PROPERTIES OF REGULAR LANGUAGES

Learning Objectives At the conclusion of the chapter, the student will be able to: State the closure properties applicable to regular languages Prove that regular languages are closed under union, concatenation, star-closure, complementation, and intersection Prove that regular languages are closed under reversal Describe a membership algorithm for regular languages Describe an algorithm to determine if a regular language is empty, finite, or infinite Describe an algorithm to determine if two regular languages are equal Apply the pumping lemma to show that a language is not regular

Closure Properties Theorem 4.1 states that if L1 and L2 are regular languages, so are the languages that result from the following operations: L1  L2 L1  L2 L1L2 L1 L1* In other words, the family of regular languages is closed under union, intersection, concatenation, complementation, and star-closure.

Proof of the Closure Properties Since L1 and L2 are regular languages, there exist regular expressions r1 and r2 to describe L1 and L2, respectively The union of L1 and L2 can be denoted by the regular expression r1 + r2 The concatenation of L1 and L2 can be denoted by the regular expression r1r2 The star-closure of L1 can be denoted by the regular expression r1* Therefore, the union, concatenation, and star-closure of arbitrary regular languages are also regular

Proof of the Closure Properties (cont.) To prove closure under complementation of an arbitrary regular language L1, assume the existence of a dfa M that accepts L1 A dfa M’ that accepts the complement of L1 can be constructed as follows: M’ has the same states, alphabet, transition function, and start state as M The final states in M become non-final states in M’, while the non-final states in M become final states in M Since M’ accepts precisely the strings that M rejects, and M’ rejects precisely the strings that M accepts, then M’ accepts the complement of L1, which is therefore shown to be regular

Proof of the Closure Properties (cont.) To prove that the intersection of two regular languages L1 and L2 is also regular, two basic approaches exist: Given a dfa M1 that accepts L1 and a dfa M2 that accepts L2, construct a new dfa M’ with states and transition function resulting from a combination of the states and transition functions from M1 and M2 Use DeMorgan’s law to show that the intersection of L1 and L2 can be obtained by applying union and complementation: Since the union and complementation operations have been shown to produce regular languages, the intersection of L1 and L2 must also produce a regular language

Closure under Reversal Theorem 4.2 states that if L is a regular language, so is LR To prove closure under reversal, we can assume the existence of a nondeterministic finite automaton M with a single final state that accepts L Given the transition graph for M, to construct a nfa MR that accepts LR: The start state in M becomes the final state in MR The final state in M becomes the start state in MR The direction of all transition edges in M is reversed

Elementary Questions about Regular Languages Given a regular language L and an arbitrary string w, is there an algorithm to determine whether or not w is in L? Given a regular language L is there an algorithm to determine if L is empty, finite, or infinite? Given two regular languages L1 and L2, is there an algorithm to determine whether or not L1 = L2 ?

A Membership Algorithm for Regular Languages Theorem 4.5 confirms the existence of a membership algorithm for regular languages To determine if an arbitrary string w is in a regular language L, we assume the existence of a standard unambiguous representation of L Given a standard representation of L, construct a dfa to accept L Simulate the operation of the dfa while processing w as the input string As previously stated, if the machine halts in a final state after processing w, then w is in L

Determining Whether a Regular Language is Empty, Finite, or Infinite Theorem 4.6 confirms the existence of an algorithm to determine if a regular language is empty, finite, or infinite Given the transition graph of a dfa that accepts L, If there is a simple path from the start state to any final state, L is not empty (since it contains, at least, the corresponding string) If a path from the start state to a final state includes a vertex which is the base of some cycle, L is infinite (otherwise, L is finite)

Determining Whether Two Regular Languages are Equal For finite languages, equality could be determined by performing a comparison of the individual strings More generally, theorem 4.7 confirms the existence of an algorithm to determine if two regular languages L1 and L2 are equal: Define the language L = (L1  L2)  (L1  L2) By closure, L is regular, so we can construct a dfa M to accept it, and by theorem 4.6, we can determine whether L is empty L1 and L2 are equal if and only if L is empty

Identifying Nonregular Languages Although regular languages can be infinite, their associated automata have finite memory and are therefore incapable of accepting many languages To show that a language is not regular, two basic approaches exist: Use the pigeonhole principle to construct a proof by contradiction Use a pumping lemma for regular languages

Basis for the Pumping Lemma The transition graph for a regular language has certain properties: If the graph has no cycles, the language is finite If the graph has a nonempty cycle, the language is infinite If the graph has such cycle, the cycle can either be skipped or repeated an arbitrary number of times, so if the cycle has label v and if the string w1vw2 is in the language, so are the strings w1vvw2, w1vvvw2, etc. If such a cycle exists in a dfa with m states, the cycle must be entered by the time m symbols have been processed As a basis for the pumping lemma, we observe that given a language L, if any string in L does not satisfy these properties, L is not regular

A Pumping Lemma for Regular Languages Theorem 4.8: Given an infinite regular language L, every sufficiently long string w in L can be broken into three parts xyz such that |y| > 0 and |xy|  m (where m is an arbitrary integer  |w|) An arbitrary number of repetitions of y yields another string in L The middle section, y, is said to be “pumped” to generate additional strings in L The pumping lemma can be used to show that, by contradiction, a certain language is not regular

Applying the Pumping Lemma to Show that a Language is not Regular The proof is similar to a game in which our goal is to show that a language L is not regular, while an opponent maintains the opposite: The opponent picks m We pick a string w in L so that |w| ≥ m The opponent chooses the decomposition xyz, subject to |y| > 0 and |xy|  m, in a way that makes it hard to establish a contradiction We try to pick a number of repetitions i, such that xyiz is not in L In general, we try to establish a strategy that allows us to show a contradiction regardless of the choices made in steps 1 and 3.