8
CSC312 Automata Theory Lecture # 23 Chapter # 10 by Cohen Nonregular Languages

CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Embed Size (px)

DESCRIPTION

Nonregular Languages: The language that cannot be expressed by any regular expression is called a nonregular language. The languages PALINDROME and PRIME are the examples of nonregualr language. By Kleene’s theorem a nonregular language can also not be accepted by any FA of TG. All the language are either regular or nonregular, none are both. Ex: Consider the language L={an bn : n=0,1,2,…} = {, ab, aabb, aaabbb, …} PRIME = {ap where p is a prime} PALINDROME = {w= wR} where w is a string in the language

Citation preview

Page 1: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

CSC312Automata Theory

Lecture # 23

Chapter # 10 by CohenNonregular Languages

Page 2: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Nonregular Languages:The language that cannot be expressed by any regular expression is called a nonregular language. The languages PALINDROME and PRIME are the examples of nonregualr language.By Kleene’s theorem a nonregular language can also not be accepted by any FA of TG. All the language are either regular or nonregular, none are both. Ex:Consider the languageL={an bn : n=0,1,2,…} = {, ab, aabb, aaabbb, …}PRIME = {ap where p is a prime}PALINDROME = {w= wR} where w is a string in the language

2

Page 3: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Pumping Lemma:If L be any infininte language (that has infinite many words), defined over an alphabet then there exists three strings x, y and z belonging to * (where y is not the null string) such that all the strings of the form synz for n=1, 2, 3, … are the words in L. If the new word is in the language then it is a regular language otherwise nonregular language. . Ex:Consider the languageL={an bn : n=0,1,2,…} = {, ab, aabb, aaabbb, …}

3

Page 4: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Chapter # 11 by CohenDecidability

Page 5: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Effectively Solvable Problem:A problem is said to be effectively solvable if there exists an algorithm that provides the solution in finite number of steps e.g. finding solution for quadratic equation is effectively solvable problem. Decision Procedure:An effective solution to a problem that has a yes or no answer is called a decision procedure. Decidable:A problem that has a decision procedure is called decidable.

5

Page 6: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Decidability ProblemsEquivalency problem – equivalence of two

languagesIf L1 and L2 are regular languages, then they can be

expressed either by REs or by FAs. We can easily develop FAs for . Therefore, we can produce an FA that accepts the language

This machine accepts the language of all words that are in L1 but not in L2, or else in L2 but not in L1. If L1 is equal to L2, then this machine accepts nothing at all, not even the Null string.

6

/ /

1 2, L L

/ /

1 2 1 2L L L L

Page 7: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Decidability ProblemsEquivalence of two languages (cont…)Methods that determine whether a given FA accepts any

words or not. Method-1:Convert the FA into regular expression – If a single RE is

generated then the FA accepts some strings. The algorithm that determines what word is definitely

present in the given RE.Step-1: Remove all Kleene’s Star and Kleene’s Plus

operators from the REStep-2: For each + sign, throw away the right half of the

sum and the + sign itself.Step-3: Remove parentheses, and we get the final word if

exist.

7

Page 8: CSC312 Automata Theory Nonregular Languages Chapter # 10 by Cohen

Decidability ProblemsMethod-2: (Blue paint method)To examine whether a certain FA accepts any word, it is required to seek paths from initial to final state. Following is the procedure to find such paths.Step-1: Paint the start state Blue.Step-2: From every blue state follow every edge that leads out of it and paint the destination state blue, then delete these edges from the machine. Step-3: Repeat step-2 until no new state is painted blue, then stop.Step-4: When the procedure stops, if any of the final states are painted blue, then the machine accepts some words, otherwise not.

8