Regular languages are closed under union, intersection, concatenation, complementation, and reversal, but closure under intersection and concatenation requires both languages to be regular. Decidability varies by language class: membership, emptiness, and finiteness are decidable for regular, CFL, and CSL languages, while equivalence, regularity, ambiguity, and completeness are generally undecidable for CFL and CSL but decidable for recursive languages. Moore machines associate outputs with states, while Mealy machines associate outputs with transitions, enabling applications in lexical analysis, text editors, and sequential circuits.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Decidability | Lecture 24 | Prof. Ravindrababu Ravula
Added:Yeah.
Okay. So, open the Telegram channel and answer this question.
when the languages are given you don't have to use the properties you can directly get them right if you use the property this is CFL and you'll convert it to CFL and then you'll say L1 L2 equal to CFL right but that's wrong if I say a A L1 union L2 it is going to be A + B star if I say L1 union L2 it is going to be a plus B star which is regular which is regular right so let's see some pro properties on regular languages okay so if L1 is regular if L1 is regular and L2 is regular If L1 is regular and L2 is regular then we know that L1 union L2 is regular.
How? Write the regular expression for L1. Write the regular expression for L2 and just put a plus. If L1 is regular and L2 is regular, then L1 union L2 is regular.
Right?
Now, now the question is if L1 union L2 is regular, if L1, L2 is regular, then what can you say about L1 and L2 is the question.
What can you say about L1, L2? Is the question. Try to answer this. Try to answer this.
Hello. Hello.
What do you think?
Okay. If L1 is then L2 is regular then L1 comma L2 may or may not be regular.
L1 comma L2 may or may not be regular may or may not be regular.
Right?
Now if L1 intersection L2 is regular L1 intersection L2 is regular then L1 L2 may or may not be regular.
If L1 concatenated with L2 is regular.
If L1 concatenate with L2 is regular then L1 comma L2 may or may not be regular may or may not be regular. You give me all the examples for these cases. Okay, you have to give me all the examples for these cases. But one property is for is very important.
If L is regular, if L is regular, L complement is regular.
If L is regular then L power R is regular. Reversal of language is regular.
Right? Similarly, if L power R is regular, L is regular. If L complement is regular, L is regular. Now I what I want is for these three cases, give me examples.
Give me examples for these three cases.
Okay.
Try and give the examples for these three. Try and give the examples for these three.
Don't remember.
That's it.
Please.
didn't They got to do something.
Yeah.
Now let's talk about union.
Okay. Now L1 L2 union of L1 L2 is regular. Then L1 and L2 need not be regular. Right? Let us write different cases. Now let's take the case when both are regular. Now let us say here we have a star. We here we have B star. Now what is L1 union L2? L1 union L2 is A* + B star. Therefore it is regular.
Now let us take a case.
Let us take a case where L1 is regular and L2 is non-regular.
L1 is regular and L2 is non-regular.
Okay. For example, I can write A + B star which is regular and I can write A power N B power N which is non-regular.
Then if I say L1 union L2 then it is going to be A + B* and then that is it a + B star. If you union anything with universal language, you are going to get the universal language only.
Right? If you union anything with universal language, you are going to get the universal language only. Now let's take not regular and not regular. Not regular and not regular. Right? So a power n bn n and a power n b power n complement are not regular.
They are not regular. Right?
Now union of two non-regular languages is nothing. See if I take a language and its complement and if I apply union then what do I get? L1 union L2 is A + B star. Right? So in all these cases L1 union L2 is regular. Last year they have asked this question in GATE. Last year they have asked this question in GATE.
Okay.
Now let's talk about intersection. Can you do this intersection?
Intersection. Now L1 and L2 they can be regular.
They can be regular.
Right? For example, if I write AAR here, B star here. Then what is L1 intersection L2? Only epsilon is present in both of them. Only epsilon is present in both of them. Right? Now regular and non-regular regular and non-regular.
So phi is regular and a power n b power n is non-regular.
If I take the intersection I'm going to get five and five is regular.
Five is regular. Now L1 and L2 can be non-regular right? L1 and L2 can be both of them can be non-regular. For example, A power N b power N and A power N B power N whole complement whole complement. Right? Now L1 intersection L2 is equal to 5 which is regular which is regular.
Right?
And we know that if L is regular then L complement is also regular.
If L complement is regular then L is regular. Right? Now regular so regular languages are closed under complementation.
regular languages are closed under complementation.
Regular languages are closed under closed gender complementation.
So what does that mean? Regular language are closed complementation means L comma L complement L comma L complement are both are both regular or L comma L complement are both non-regular.
They are both regular or they are both non-regular.
Right.
Right.
Now one thing you have to understand is when you do complementation regular is closed.
I'll do in a separate page. Okay. When you talk about complementation, when you talk about complementation, so one thing that you have to understand is if a language L is there which is regular DCFL CSL and REC regular DCFL CSL and this is a very frequently asked question that is why I'm giving you separately actually this is in RBI table one okay actually this is in RBI table one so if I take complementation of a regular I mean language. If it is regular result will be regular. If it is DCFL result will be DCFL. If it is CSL register will be CCL CSL and if it is result will be.
So what are the various points can we write about it?
So what are the various points can we write about it?
What are the points can you write about it? I'm seeing your WhatsApp channel, sorry, Telegram channel.
What are the points that you can write about it?
right? So you can say that you can say that L and L complement both are regular. If L is regular, L complement is regular. Both are regular or both are non-regular.
This point you can say this is as in gate. Okay. Now L and L complement both are DCFL or both are non DCFL.
Non DCFL. Right. Right.
Similarly, you can say L and L complement both are CSL or both are not CSL.
Similarly you can say L and L complement both are recursive or both are not recursive. Both are not recursive.
groups Okay fine.
Now same thing can be applied to closure also. clean closure also.
Right. Right. Now let us say L = A power N² such that N is greater than or equal to 1. L= A power N² such that N is greater than or equal to 1.
Right?
Now this language is non-regular because we don't have a linear power. The language is non-regular.
Now what is Lar?
What is Lar?
What is Lar?
Let us say the L square, right?
What is Lar?
Can someone answer this in the telegram channel?
Can someone answer this in the telegram channel?
Oh no, phone number.
Okay. Now let's see what is L. In place of N if you put one it is a. In place of N if you put one it is a power 4. In place of N if you put three it is a power 9. In place of n if you put four it is a power 16 so on right now what is lar applying a star to this now when I apply star we can repeat all these any number of times therefore a will also be repeated any number of times since star is there if I put a zero epsilon is in the language and a can repeat any number of times therefore you are going to get a star.
Very good.
Very good. Nsw answer is a star.
Now answer this question.
L = a power 2 power n such that n is greater than or equal to 1.
Now what is lar?
What is Lar?
a power two power n such set n is greater than or equal to 1. What is lstar?
Try it everyone.
Not very easy, but you can try it.
solve.
So guys, now what is L?
In place of N, if you put one, it is going to be a power 2. In place of N, if you put two, it is going to be a power 4. In place of N, if you put three, it is going to be a power, right? If you put four it is going to be a power 16 so on. Now if I put a star here and if I put a star here. Now if I put a zero in place of star I'll get epsilon.
Now if you see this a square can be repeated any number of times. It is not a it is a square which will be repeated any number of times. Therefore the answer is a a star.
Therefore the answer is yeah a star.
So what did you observe here? What did you observe here? See if a language is regular. Let me write language L1.
If a language L1 is regular then if a language L1 is regular then then L1 star is regular.
L1 star is regular.
Similarly, if a language L1 is non-regular, then L1 star then L1 star may or may not be regular.
may or may not be regular.
May or may not be regular.
Right? Now, what do you mean by decidability?
If for a problem, if for a problem, if an algorithm exists, if for a problem an algorithm exists, then we can say that the problem is decidable.
Right? If for a problem an algorithm exists, we can say that it is decidable.
Right? Now, there are lot of questions on this table. Now we are going to discuss something called as RBR table 3.
You have seen RBR table one. RBR table two. I asked you to apply table two first then table one. Now the table three.
I think we have seen RBI table three also. This is table number four.
We have seen three tables. Right? We have seen three tables. This is table number four. And this table is about decidability. Lot of questions.
Lot of questions have come in this.
Lot of questions have come in this decidability.
Lot of questions have come in this. If you can remember this table, it is very easy to score two marks right. So first I will write the table. You just give some gaps. Okay? Don't write it because you don't know how to give the gap. I will write the table and I will give you the time to write. Okay, I will write the table. You don't know how much space to give. Just let me write the table.
Okay.
Membership, emptiness, finitness, equivalence, regularity.
Ambiguity, completeness, disjointness.
Just see how big the table is going to be. Later you copy it. Don't draw it now because you may not have enough space allotted. So just see how I am doing it.
Then you can copy this. Okay, I'll give you time. Okay. Now the languages are regular.
We don't have DCFL. We have CFL.
We have CFL and we have CSL and we have REC and we have RE and we have RE right so this is decidable decidable decidable decidable and undecidable And this is decidable. Decidable.
Undecidable. Undecidable.
Undecidable.
And this is decidable. Decidable.
Undecidable.
Undecidable.
Undecidable.
Decidable means there is algorithm.
Undecidable means there is no algorithm.
Now equivalence decidable undecidable undecidable undecidable undecidable.
Now regularity decidable undecidable undecidable undecidable undecidable ambiguity.
Decidable.
Undecidable.
Undecidable.
Undecidable.
Undecidable.
Completeness.
Decidable.
Undecidable. Undecidable.
Undecidable.
Undecidable.
Undecidable.
Undecidable.
Undecidable. Undecidable. Right. How will the question be asked? Given a string, does it belong to the language that is membership?
Given a language, is it equal to five empty?
And is L finite?
Is L finite?
What about equivalence?
Is L1 = L2?
What about regularity?
Is L = R? What about ambiguity? Is L ambiguous? What about completeness?
Is L = sigma*?
What about disjointness? Is L1 intersection L2?
Is L1 intersection L2?
Write the table. Take time and copy the table.
Okay.
So most of the table is undecidable. If you see this only this part and this part is decidable. Most of the table is undecidable. Okay. This is also decidable. Okay. So whenever they give an exam in the exam you can directly answer that it is undecidable. Okay. You can directly answer that it is undecidable.
Right.
Now let us see various applications of finite automator.
Let us see various applications of finite automator.
Various applications of finite automata one is lexical analysis. So in compiler design we are going to use lexical analyzer and second one is text editors. We have various text editors right there. Finite automata is used for what? Per search.
And there is a command called grapin Unix that uses regular expressions.
And then auto suggestions.
For auto suggestions also for auto suggestions also regular expressions are used.
Right.
And then third one is in digital you are going to see something called as sequential circuits.
Sequential circuits or circuit there we are going to use mur and millie. Mur and mele are not over. Okay.
Mle and Mia are not over. Now let us see various variations of finite automator.
A finite automator can have many variations.
Variations of finite automator. Right?
One is multitape finite automator.
Multitape finite automator. Right? What do I mean by multitape finite automator? We have a finite automator with finite number of states. But input can be in multiple tips.
Input can be in multiple tips.
Right? Now you can see one symbol from each state and you can decide. Okay.
Okay. But then it is found out that multi-state multi-ave finite automator has same power as finite automator.
It has same power as finite automator.
And then multi- heads finite automator.
Multi- head finite automator. So what does this mean? If you have a If you have a finite automator, If you have a finite automator, these are the states, then it can have multiple heads.
It can have multiple heads.
Similarly, finite automator with read write head.
Finite automator with read write head.
So what does this mean? You have a finite automator.
You have a finite automator.
And then you have read write head.
Read right head.
And then we have finite automator which can move both the sides. Generally finite automator moves in only one side.
Right? But it can move right or it can move left. Even this has same power as finite automator.
Same power as finite automator.
Same power as finite automator. Right.
Now to the finite automator.
To the finite automator.
If I allow it to read and write and if it can move right or left then this will become cheuring machine.
Then it will become cheuring machine.
Now per finite automator if I add one stack per finite automator if I add one stack then it will become push down automator and we know that cheuring machine is more powerful than finite automator and push down automator is more powerful than finite automator and also cheuring machine is more powerful than finite automator. If you want to write all of these three, curing machine is more powerful than push down automator is more powerful than finite automator.
Finite automator.
Right? Now there is a different machine which does not have a name. Okay? Now let us say finite automator plus one counter.
finite automator plus one counter. So what do I mean by one counter?
One counter is a stack with only one symbol.
One counter is a stack with only one symbol.
One counter in a stack with only one symbol. You can put any symbol but only one symbol. Like you can put only one one one.
Now this machine doesn't have any name.
Let us call it as X. We don't have any name. Let us call it as X. Right? Now X is more powerful than finite automator.
And X is less powerful than pushdown automator. And X is more powerful than finite automator.
Less powerful than pushon automator.
Right now using this counters concept you can extend it a little bit. Okay. So finite automata plus two counters.
Finite automator plus two counters is cheing machine. Even if you add more counters plus three counters is also chewing machine plus four counters is also cheing machine. So on so on so on right now let's talk about the last concept of to so probably today to is going to be over okay today to is I mean sorry lost concept of regular regular languages today we are going to finish it take a quick break for 3 4 minutes Then we will see Mur and Millie with this regular languages is completed. We have to do PQS. Okay.
Probably this Sunday we will do PQs or I will take PQ session on a weekday on weekdays every day. Okay. Fine.
Take break for 3 minutes. Okay.
Okay.
What?
Now let's look at mur and mele machines.
Okay.
So let's look at mur machines first.
Murray machines.
Okay.
So I'll just with examples it will be clear. Okay.
Construct a mur.
Construct a mur.
Construct a murray machine that takes that takes set of all strings set of all strings over set of all strings over a comma b set of all strings over a comma b and and prints and prints one as output and prints one as output. For every occurrence of For every occurrence of For every occurrence of AB as a substring AB as a substring for every occurrence of AB as a subspring, right? How are you going to do this? Tell me in the telegram channel.
How are you going to do this? Tell me in the telegram channel.
Google.
>> Okay. So whenever you get a a you are going to print one. Okay. So how can I make sure that so you have to make sure that whenever you get a a b you have to reach a state right so you see this a b I will reach this state okay I will reach this state now the question is even if I get one more ab again I have to reach this state so what I will do is if I get a a I'll go back and once I get a AB I'll reach this state and any number of B's I will wait for a A and any number of A I will wait here till I get a B so let us say this is state A output is zero this is state B output is zero this is state C output is one now this is nothing but ending with so if I get a B I have to wait for entire AB so this is nothing but finite automator which accept set of all strings ending with AB. This is nothing but finite automator where set of all strings are ending with AB.
Finite automator where set of all states are ending with AB.
Right?
So how do you trace it? Now let us say you have ab a b two abs are there. So you are supposed to get two ones.
Initially you'll be in state a output is zero. Now on seeing a a you'll go to b output is zero. And on seeing a b you go to c output is 1. And on seeing a a you'll go to A output is zero you'll go to B right C on seeing a A will go to B and B on seeing a B will go to C and output is one which means whenever you see A a B you are printing a output one whenever you see a AB you are printing a output one right right now what if I change the question a little bit.
What if I change a question a little bit and say for every occurrence of BAA for every occurrence of BAA?
For every occurrence of BAA, Okay.
So it has to end with BAA. Whenever you get a BA, one should be output, right?
So whenever you get B A output should be one. So for A output is zero. For B output is zero. For C output is zero. For D output is one.
For D output is one.
Okay, this is ending with B AAA. Now any number of A may come, I will wait for a BA. Now here any number of B's may come, I'll wait for a AA. Right? Now here I want BA. If a A comes, I go here. If a B comes, I'll go back and wait for a AA.
Here if a A comes, I have to wait for entire B AAA.
Here if a B comes, I had to wait for AA.
I had to wait for AA.
Right? Now let us say the string is B A followed by B A A. Now initially you'll be in state A output will be zero.
Now from state A on seeing a B you'll go to B output will be zero and from B on seeing a A you'll go to C output will be zero and C on seeing a A will go to D output will be one. Which means when I see B a A output is getting one. Now from D if I get a B I will go to B and output will be zero. From B if I get a A from B if I get a A from B if I get a A I will go to C.
I'll go to C and output will be zero.
from C if I get a A I'll go to D and output will be zero right so for every occurrence of BA we got one now one thing that you have to notice in mur is if the input is n symbols then the output will be n +1 symbols this one you have to remember if the input is n symbols output will be n +1 symbols see this 1 2 3 4 5 6 1 2 3 4 5 6 7 Right.
Right. Right.
Okay.
Now tell me about this.
Tell me about this. Okay. Take time and do it. It is not easy.
Construct.
Construct a mur.
Construct a murray machine that takes Construct a Murray machine that takes set of all strings.
Set of all strings.
Set of all strings over over 0 comma 1 over 0 comma 1 and produces and produces a as output and produces a as output. If If input If input ends with 1 0 If input ends with 1 0 if input once with 1 0 or produces or produces B as output produces B as output.
If if input if input ends with 1 one if input ends with 1 one or produces or produces C otherwise or produces C otherwise produces C otherwise produces C otherwise That's it.
Okay, construct a murray machine that takes set of all strings and produces a as output. If input ends with 1 zero and if it runs with 1 one, it is going to produce b right otherwise it is going to produce c. So c is the output. If in the beginning let any number of zeros come we will not do anything. Now once I get a one then I may get a one ending with one or I may get a zero ending with zero.
Right?
If the input ends with 1 0 let's see this. So if the input ends with 1 0 A has to be produced and if the input ends with 1 1 B has to be produced otherwise C has to be produced.
Now remember one thing both the Millie machines and Murray machines are DFS not NFS. Okay both the Mur and Millie machines are DFS not the NFS.
Okay fine. Now if I get a zero here it will be ending with 1 zero. Any number of ones it will be ending with 1 1. Now here if I get a zero it is actually 1 0 0. Now again I have to wait for entire 1 0 or 1 1. So if I get a zero I'll go back and wait for 1 0 or 1 1. Now if I get a 1 0 1 I have to wait for either 0 or 1. If I get a 1 0 1, I have to wait for 0 or 1, I have to wait for 0 or 1. So this is the mur machine for the question.
Right now I'll give you one question.
You try to solve it. Construct a mur.
Construct a mur.
Construct a murray machine that takes Construct a Murray machine that takes binary numbers that takes binary numbers as input.
Binary numbers as input and produces and produces residue residue modulo 3 and produces residue modulo 3. Which means when I divide the number whatever remainder we are getting that residue has to be printed. Now assume epsilon is divisible by 3.
Assume epsilon is divisible by 3. Try to answer this question.
Try to answer this question.
time >> YouTube community as well as um what the app notifications Telegram.
I'm sorry.
Why no one is able to do this?
You have to divide a number by three and you have to just put the remainder.
Right?
Why is no one able to do this?
See this I'll do. See this I will do.
Okay. So we know divisible by three.
Binary number divisible by three. Right?
We have seen it many times. 0 1 1 0 0 1 1.
Right? So this is the DFA. Now the remainder in this state is zero.
Remainder in this state is one. element in the state is two that outputs will be printed or if you want to do it in a faster way. If you want to do it in a faster way, you can also write like this. There are three states Q1 Q2. Right? Now there are two two inputs 0 and 1. So Q1 Q2 Q1 Q2 and now output output can be zero here, one here and two here. Right? If you write like this, it will be direct and simple.
If you write like this, it will be direct and simple. Right? Now solve one more question.
Base four number modulo Okay.
It takes base four number, right? and produces residue modulo five assuming epsilon is divisible by five.
Try doing this.
Try doing this.
Okay, you can use the table method, right? Table method will be faster. So when I divide a number with five, how many remainders do I get? Q, Q1, Q2, Q3, Q4. And Q not is the final state. Q not is the final state. Right? Now this is a base four number which means 0 1 2 3. So you are going to write Q1 Q2 Q3 Q4 and again Q1 Q2 Q3 Q4 and again Q1 Q2 Q3 Q4 and again Q1 Q2 Q3 Q4 Right? Now what will be the output?
Output is going to be for Q not it is 0.
For Q1 it is 1. Q2 it is 2. Q3 it is 3.
Q4 it is 4. 0 1 2 3 4.
0 1 2 3 4. Simple right? Simple right?
Now let us see Millie.
Let us see one or two problems on Millie as we have time.
Okay, Millie.
So in mur output is associated with this state. In millie machine output is associated with the transition. What do I mean by that? If you look at the previous problems, if you look at the previous problems here, every state is getting the output, right? That is about mur. Now coming to me, every transaction, every trans transition will get a output. Every transition will get a output. Right? Now do this simple one. Construct Construct a Millie machine.
Construct a millie machine that takes Construct a Millie machine that takes That takes binary numbers that takes binary numbers as input.
binary numbers as input and produces and produces once complement as output and produces once complement as output.
So we are done. This is the last topic.
Okay, we are done with regular languages.
Probably in one more class I will I will tell you about Okay. So what is once complement?
Whenever there is zero, you are going to make it one. Whenever there is one, you are going to make it zero. Simple. Let us say state A is there. Whenever there is zero, you'll make it one. And whenever there is one, you'll make it zero. Right? For example, if I have the string 1 0 1 0. Right? Now I'll be in the state A and if I see a one I'm going to make it zero. I'll be in state A. If I see a zero I'll make it one. I'll be in state A. If I see a one I'll make it zero. I'll be in state A. And if I see a zero I will make it one. Simple, right?
Okay. We will end the class here. There are few more problems in millie machine.
Okay.
Related Videos
Walmart Manager Arrested After Stealing $670,000 - A Data Analyst 800 Miles Away Caught Him
bodycamsecretsyt
111 views•2026-06-09
GitLab’s Manav Khurana: AI Agents, Orbit, and the Future of Coding
TechVoices-live
374 views•2026-06-10
"What's the Difference Between a Class and an Object?"#class #programming #softwaredevelopment
CS-with-Alireza
349 views•2026-06-08
Why Your Computer FREEZES?
GreshamCollege
1K views•2026-06-09
Feodo Tracker: Botnet C2 Intelligence Platform #CyberCavin
CyberCavin
269 views•2026-06-06
I thought this feature would be easy to deploy... I was wrong.
dreamsofcode
815 views•2026-06-10
The Operating System That Should Have Beaten Linux
BitByteTalks
23K views•2026-06-08
STCS - Class 23: How to make your Mobile App Fast
mosesmbadi
116 views•2026-06-07











