1. Regular VS Non Regular
Languages
Lecture 14
Faryal Shamsi
Lecturer Computer Science
Sukkur IBA University
2. Regular Languages
• A language that can be defined with a Regular Expression
• By Kleene’s Theorem we know that –
• RE=TG=FA
• Therefore, we can say that –
• A regular language can be defined with a Regular Expression, a Transition
Graph and a Finite Automata
3. • The result stated in this theorem is often expressed by saying:
• The set of regular languages is closed under –
• union, concatenation, and the Kleene star operator.
13. Regular Languages are Closed under:
• Union
• Concatenation
• Closure
• Complement
• Intersection
• Difference
• Non regular languages may not have these properties
20. Non Regular Languages
• A language that can not be defined with a Regular Expression
(neither with a finite automata or transition graph), is said to be non-
regular language
• For Example: If = {a,b} then
• PALINDROME = { , a, b, aa, bb, aba, bab, abba, baab, ababa, … }
• EQUAL = { , ab, aabb, abab, bbaa, baba, aabbab …}
21. Non Regular Languages
• A language that can not be defined with a Regular Expression or Finite
Automata or Transition Graph
• For Example –
When the range of the abstract exponent n is unspecified we
mean to imply that it is 0,1,2,3 …
22. Example: anbn
• We shall now show that this language is nonregular.
• Let us note: anbn a*b*
• Though, that it is a subset of many regular languages, such as a*b*,
which, however, also includes such strings as aab and bb that {anbn}
does not.
• Let us be very careful to note that {a"b } is not a regular expression.
• It involves the symbols { } and n that are not in the alphabet of regular
expressions.
30. Consider this case
• PALINROME is a non regular language.
• We cannot always use the first version of the Pumping Lemma to do
this because the string W=aba, satisfy the lemma and do not
contradict the language:
w= xynz x=a y=b z=a
• So, we have another way to express Pumping Lemma
31.
32. Proof:
• Let us consider one of the FA's that might accept PALINDROME
• Consider this FA has 77 states, and it accepts a80ba80
• Now the palindrome must be accepted by this machine and it has
more letters than the machine has states.
(We should’t break ‘aba’ or ‘aabaa’ and so on…)
• This means that we can break w into the three parts, x, y, and z.
33. Proof:
• But since the length of x and y must be in total 77 or less, they must
both be made of solid a's, since the first 77 letters of w are all a's.
• That means when we form the word xyyz we are adding more a's on
to the front of w.
• But we are not adding more a's on to the back of w since all the rear
a's are in the z part, which stays fixed at 80 a's.
• But the second version of the Pumping Lemma said that
PALINDROME has to include. this string. Therefore, the second
version does not apply to the language PALINDROME, which means
that PALINDROME is nonregular.
34. Example 4
• Consider the language of Arithmetic Expressions –
• Try and Construct an FA or RE to recognize it
35. Defining a Non Regular Language
• Let’s recall the concept of ‘Recursive Definition’.
• Reference: Chapter. 3, Lecture 7
• We can define Asthmatic Expressions using Recursive Rules –