Non-Regular Languages
Regular Expressions
Source:http://surl.li/bcakh
Regular Expressions are usually used to indicate the regular languages.
- The language that gets acquired by the finite automata(FA) can also be described by the simple expressions which are called as Regular Expressions. It is the most effective and reliable way to represent any language.
- The languages that is accepted by some regular expression is referred as Regular languages.
- A regular expression can also be described as a chain of patterns that defines a string.
- Regular expressions are usually used to match the character combinations in the strings. String searching algorithm are used in this pattern to find the operations on a string.
Examples of regular expression:
1. Construct a regular expression for the language which accepts all the strings which starts with 1 and ends with 0 over ∑ = {0, 1}.
Solution:
In this regular expression, the starting symbol should be 1 and the ending symbol should be 0 and in between 1 and 0 we can have any type of strings. So, The regular expression for this language is as follows:
R = 1 (0+1)* 0
R = {a + ab}*
Regular Language
- a*b* is regular language
- {w belongs to {a, b}* : every a is immediately followed by b} is regular language
Non-Regular language
A language which is not defined by the regular expression is called nonregular language or an irregular language. The existence of the languages which are not regular is basically guaranteed by the fact that the regular languages of any alphabet can be counted, and we know that the set of all the subsets of the strings are not countable.
Examples of non regular language:An example of non regular language is { a^nb^n | n ≥ 0 }. This language cannot be recognized with the help of finite automata, since the finite automata has finite memory and it basically cannot remember the exact number of a's. Some other examples are:
- {w ∈{a, b}* : every a has a matching b somewhere} is not a regular language
- {a^n: n >=1 is a prime number} is not regular language.
Pumping lemma for Regular languages
- It gives a method for pumping or generating a lot of substrings from a given string.
- We can also say that it provides a means to break a given long input string into several substrings.
- It specifies the requirements for proving that a set of strings is not regular.
But the pumping lemma is a contradiction test which means that if any language does not satisfy the pumping lemma, then we can say that the language it is not regular. But, if it satisfies the conditions of the pumping lemma, then we can say that the language may or may not be regular.
Pumping Lemma is actually a mathematical proof, which takes a lot of time and also sometimes creates a lot of confusion.
Every language that is finite is also regular, that means if there is a limit to language then we can basically say it is regular.
Consider the following language as an example:
L = { a10b20} is a regular language whereas,
L = { anbn| n > 0} is not a regular language.
Suppose, if there is an infinite language, then we will have to check whether its deterministic finite automata i.e. DFA can be created or not. If we can’t create the DFA, then the language will not be a regular language.
The length of a string follows an arithmetic progression, and the language must have a pattern in order to generate finite automata (FA).
Let’s consider some examples to identify whether the language is regular or not.
Example 1
Consider all the strings which are of length 2 over an alphabet {a, b}*
The language is:
L = {aa, ab, ba, bb}.
In this problem, we have been given an expression of all the strings of length 2 over the alphabets {a, b}* which is a non-regular language, but the value is bounded by a constant like length which is equal to 2. So, we can say that the language is a regular language.
Example 2
Prove that the language L = { ai bi | i ≥ 0} is not regular.
Sol-
The strings which can be produced by this language are:
L = {ab, aabb, aaabbb, aaaabbbb, .....}
Let us take any string from this language.
- Let us take the string aaabbb.
- Now, we have to divide this string into three parts x, y and z, |y| >0, |xy|< P. Let us say x = aa,
y = ab and z = bb. - Now, according to pumping lemma, we have to pump the string y. So, let us pump it to y^2 i.e.
y = abab. - The new string formed is xyz = aaababbb.
- This string does not belong to the language L.
- Therefore, By Pumping Lemma, the language L = { ai bi | i ≥ 0} is not a regular language.
How can you tell whether a language is regular or not?
Conclusion
Regular languages are those languages all of whose members can be expressed with just a regular expression (RE). Non regular languages are those whose members can not be expressed with RE’s Or a regular language is a language that can be modeled by finite automata while non regular languages can not.
References:
1. https://www.javatpoint.com/automata-regular-expression
2. https://brilliant.org/wiki/regular-languages/
3. https://www.geeksforgeeks.org/how-to-identify-if-a-language-is-regular-or-not/
4. https://www.cs.wcupa.edu/rkline/fcs/re-pump.html
5. https://www.geeksforgeeks.org/pumping-lemma-in-theory-of-computation/
good job
ReplyDeleteGreat work 👍
ReplyDeletehelpful 🙂👍🏻
ReplyDeleteVery informative...
ReplyDeleteNice content
ReplyDeleteNice content 👍
ReplyDeleteNice content
ReplyDeleteReally helpful, Perfectly Explained
ReplyDelete👍👍
ReplyDeleteVery informative
ReplyDeleteVery good 👍
ReplyDeleteNice bloggg
ReplyDeleteNice work
ReplyDeleteVery good 👍
ReplyDeleteVery informative
ReplyDeleteGood informative blog !!
ReplyDeletegreat work
ReplyDeletegood explanation.
ReplyDeleteNice work
ReplyDeleteGreat👍
ReplyDeleteCommendable
ReplyDeleteInformative guys
ReplyDeleteAmazing work
ReplyDeleteOk
ReplyDeleteNice work👍
ReplyDeleteInformative
ReplyDeleteGreat Work 👍👍
ReplyDeletegood work
ReplyDeleteNice work guys 👌
ReplyDeleteGreat work
ReplyDeleteNice work
ReplyDeletePerfect
ReplyDeletegood👍
ReplyDeleteNice work done 👍👍
ReplyDeleteNice content👍
ReplyDeleteSuperb Content... Nicely Explained Sir ❤️
ReplyDeleteGreat Work
ReplyDelete👍👍
ReplyDelete👍👍👍
ReplyDeleteHelpful.
ReplyDeleteGreat work.
Perfectly explained!!
ReplyDelete