Automata Assignments
Automata Assignments
Answer:A
string is any combination of the letters of an alphabet where as the words of a language are the
strings that are always made according to certain rules used to define that language.For example if
we take
Alphabet = { a , b } Here a , b are the letters of this alphabet.
As you can see we can make a lot of strings from these letters a and b.
For example a,b,aa,ab,ba,bb,aaa,aab,aba,baa, and so on.
But when we define a language over this alphabet having no as and only odd number ofbs. Then
the words of this language would have only those strings that have only odd number of bs and
no as.some example words of our defined language are
b , bbb , bbbbb , bbbbbbb ,..and so on.
So we can say that all the words are strings but all the strings may not be the words of
alanguage.Hence strings are any combination of letters of an alphabet and the words of a language
are strings made according to some rule.
QNo.2 What is the difference between an Alphabet and an element of a set. Whether
Alphabet is an element of a set or it is a set itself?
Answer:An Alphabet is a set in itself. The elements of an Alphabet are called letters .
For example
Binary Alphabet = {0,1}
Here 0,1 are the letters of binary alphabet.
Binary Alphabet is very important because it the Alphabet used by the computer.
Set of Natural Numbers
N={1,2,3,4,5,..}
Here 1,2,3. are the elements of set of Natural Numbers.
QNo.3 What is Null String () ?
Answer:The string with zero occurrences of symbols (letters) from .
It is denoted by (Small Greek letter Lambda) or (Capital Greek letter Lambda) , is called an
empty string or null string.
The capital lambda will mostly be used to denote the empty string, in further discussion.
QNo.4 What is PALINDROME ?
Answer:The language consisting of (Null String) and the strings s defined over an Alphabet
such that
Rev(s)=s.
If = {x}
Then * = {, x, xx, xxx, xxxx, .}
If = {0,1}
Then * = {, 0, 1, 00, 01, 10, 11, .}
If = {aaB, c}
Then * = {, aaB, c, aaBaaB, aaBc, caaB, cc, .}
Note:
Languages generated by Kleene Star Closure of set of strings, are infinite languages. (By infinite
language, it is supposed that the language contains infinite many words, each of finite length)
QNo12.Valid/In-Valid alphabets?
Answer:Any alphabet is valid if any of its letter does not appear in the start of any other letter
otherwise it is invalid.
QNo13.What is Reverse of a string?
Answer:Alphabet provides only a set of symbols. A string is a concatenation of these symbols.
Reverse of the string means to write the string in reverse order. It has no effect on alphabet.
Alphabet will remain same.
QNo14.Differentiate Kleene Star Closure and PLUS?
Answer:Given , then the Kleene Star Closure of the alphabet , denoted by *, is the collection of
all strings defined over , including .
Plus Operation is same as Kleene Star Closure except that it does not generate (null string),
automatically.
You can use other symbol for alphabet but we are mostly use sigma symbol.
QNo15.Define Regular Expression?
Answer:Regular Expression is the generalized form of any regular language through which you can
construct any string related to that language.
Take an example from your handouts
L1 = {, a, aa, aaa, } and L2 = {a, aa, aaa, aaaa, } can simply be expressed by a* and a+,
respectively.
so a* and a+ are the generalized form of Languages L1, L2.
And a* and a+ are called the regular expressions (RE) for L1 and L2 respectively.
and
B = {0,2,4,6,8,10}
then, A U B = { 0,1,2,3,4,5,6,7,8,9,10 }
you can see that A U B contain elements of both sets similar is the case with FAs.
Q No.5 What is the difference between is TG and GTG ?
In TG, there are letter transitions for the strings. While in GTG, one can write whole RE as a
transition from one state to another one.
Q No.6 How one can create RE of a particular language?
First thing about RE and FA is that there is no hard and fast formula or method to generate
these. One can generate them by its mental approach. And this mental approach can be
acquired through only PRACTICE.
Here are some useful tips to write REs,
Let our language consist of the words of length three exactly over alphabet = {a,b}
then it consists of the words
L = {aaa, aab, aba,abb,baa,bab,bba,bbb}.
Its RE can be simply written as
RE = aaa + aab + aba + abb + baa + bab + bba + bbb
which simply means that our language consists of only these words.
So we can make RE for a finite language by writing its all words with + operator between
them.
We should also keep the null string in our mind. If our language generates null string than
our RE should also generate it)
For example language having all the words of even length has null string in it as well so we
can write its RE as follows
RE = ((a+b)(a+b))*
This RE also generates null string.
If a language generates all strings starting with a. then strings will be of type
We have been given more freedom in TGs. But this freedom is on the cost of more memory
and processing power it means that if we implement TGs on computer using some
programming language it will need more memory and processing power of computer than used
in the implementation of FAs.
Q No.2 What is the concept of the Union of FAs ?
When we take Union of two FAs it means that resultant FAs should accept all the words that
were accepted by the two FAs individually. It is like taking union of two sets the resultant set
contain members of both sets.
For example
Let A ={1,3,5,7,9}
and
B = {0,2,4,6,8,10}
then, A U B = { 0,1,2,3,4,5,6,7,8,9,10 }
you can see that A U B contain elements of both sets similar is the case with FAs.
Q No.3 What is the difference between GT and GTG ?
In TG, there are transitions for the strings. While in GTG, one can write whole RE as a transition
from one state to another one.
Q No.4 How to create a RE of a particular Language?
Regular expression is used to express the infinite or finite language, these RE are made in such
a way that these can generate the strings of that unique language also for the cross check that
the defined RE is of a specified language that RE should accept all the string of that language
and all language strings should be accepted by that RE.
Q No.5 How diagrams of FAs are created ?
It depends upon the question how many states involve in a FA. There is not any formal
procedure to design FA for a language. This ability just improves with time and practice.
Every FA is also a TG but not every TG is FA. In every FA, every state shows transition of all
letters of given alphabet but in any TG it is not must. In TG, we may or may not show all letters
transition according to requirement. We can also show transitions on reading any strings in TGs
but it is not possible in FAs.
Q No.6 How one can create RE of a particular language?
First thing about RE and FA is that there is no hard and fast formula or method to generate
these. One can generate them by their mental approach. And this mental approach can be
acquired through only PRACTICE.
I am giving you few tips. I hope those will help you.
If we have a finite language then it will always be regular and will not have * in RE.
e.g. L={aaa, aba, bb}. L language generates given three strings then its RE will be
(aaa + aba + bb}. So in finite language + of all strings can be its RE.
If we have an infinite language, then there will be * in its RE.
will be accepted.
Remember, as there may be more than one path for a letter from a state. So any path can be
used. Goal is to reach the final state. Remaining theory is same to the FA.
Practice is the key to success. Just try simple FAs and NFAs in the start.
a set of states
a finite input alphabet from which input strings can be constructed
a transition function that describes how the automaton changes states as it processes an
input string
a single designated starting state
a set of accepting states
The only difference lies in the transition function, which can now target subsets of the states of
the automaton rather than a single next state for each state, input pair.
Q No 2. If a language can be expressed in the form of FA than why it is needed to use
NFA ?
NFA stands for non-deterministic FA and this sort of structure has relaxation compared with FA. So
it is rather more easy to represent a language using NFA.
We have methods to convert NFA into FAs so sometimes it is easier to build NFA of a given
language and than convert its NFA into FA using these methods rather than directly building an FA
for a language which may be very difficult.
Q No 3.How to made NFA corresponding to the closure of an FA ?
While generating NFA corresponding to closure of an FA one should take care of the null string.
Simple way to accept null string is declare initial state, final as well. But in this way a lot of other
strings will also be accepted. Therefore, accurate way is draw another state. Declare the new
state initial as well as final. Connect the new state with the states originally connected with the
old start state with the same transitions as the old start state. Newly drawn diagram will be an
NFA representing the language closure of the given FA
Q No 4.What is the difference between Union of two FAs , Concatenation of two FAs
and closure of two FAs ?
Q No 1.What is the concept of Pumping Lemma I and II and what is the difference
between pumping Lemma 1 and pumping Lemma 2 ?In fact PLI & PLII are same (A way to
recognize Non Regular language). The only difference is that the conditions in pumping lemma
II are more stricter than Pumping Lemma I some language that are difficult to proof Non
Regular by Pumping Lemma I are proved Non Regular by pumping Lemma II easily.
Further mare in pumping lemma I we have to generate all words to of a language but in
Pumping Lemma II we have to generate a single word to prove a language non regular.
Explanation:
Some languages like PALINDROME that are proved to be regular by first version
due to some of their symmetrical words when we pump these words they remain to be
the parts of the language like
bbabb
By pumping lemma 1
Let y = a
Now repeating y three times results in
bbaaabb
That is also a valid word of PALINDROME so by pumping lemma I PALINDROME can not be
proved non regular, so there was the need of pumping lemma version version 2.
Now consider for the word
bbabb
if we take N=2
Then by pumping y (let we take it b ) two times results in
bbbbabb
That word is not in PALINDROME.
But if we take N=3 and y = a
Then by pumping y two times results in
bbaaabb
That word is in PALINDROME. So be careful in taking total no of states of the FA
and also the repeating factor (y) to prove an infinite language non regular you
need to prove only one word that is not part of the language.
Q No 2. What is the significance of Pumping Lemma II ?
The significance of 2nd version of pumping lemma is that there are some infinite non regular
languages like PALINDROME we can built FA that can accept there certain words but if we
increase the length of their words that FA dont accept these words so by pumping lemma
version I it is very difficult to prove them non regular but with the second version we can prove
that a language is Non regular even its some words may be accepted by some FAs.
See page 195 of the book for further example.
Q No 3.Moore and Mealy machine?
1. In order to run a string on a Mealy or Moore machine, you can take directions from transition
table. Running string on Mealy or Moore machine is similar to running string on a FA. For
example, if want to run abba on the machine, take start from initial state. Check what is the
transition for a, what state it goes. After that check what is the path of b from that state and so
on. In this way you will be able to run whole of the string. Note that there is no final state in
Mealy or Moore machine. So there is no case of acceptance or rejection of string. You just have
to determine what the output is. I hope that will clear your mind for further clarification please
listens to your lecture carefully.
2. The string is taken for the testing purposes. You can take any sort of string and determine its
output using machine.
While taking union of two FAs one can represent it using + sign. So (FA1 U FA2) and
(FA + FA2) both are same. There is no difference between them.
STORE ?
No difference at all. Both terms are used to describe memory structure attached
with FAs to store some characters in it.
Q No 5 How we can distinguish between CFG and CNF in the questions
?
Chomsky Normal Form (CNF)
If a CFG has only productions of the form
nonterminal string of two nonterminals
or
Nonterminal one terminal
Then the CFG is said to be in Chomsky Normal Form (CNF).
Thus if the given CFG is in the form specified above it will be called in CNF.
Q No 6.What is meant by the terms stack consistence and input tape
consistence ?
Term Stack consistent means we can pop any character from the top of the stack
only. PDA should not be able to pop any character other than that is present on the
top of the stack.
Term Tape consistent means we can read only the first letter on the tape not any
other letter of the tape after the first one.
Q No 7 What is the concept of unit production ?
The productions of the form
one Nonterminal one Nonterminal
Are called unit productions.
For example
S A (Unit Produciton)
A a | b
Here there is no need of Unit Production S A. we can directly write
S - a | b
Q No 8 Why Context Free Grammars are called Context Free?
Context Free Grammars are called context free because the words of the languages
has only one path out of it and the path taking (multiple paths) decisions take place
only on the READ state.
The word aaaabb is generated as follows from the PDA
START-POP4-PUSH $
This step pops $ and then pushes it to ensure that stack contains $ at the
beginning.
READ1-POP6-PUSH $-PUSH a
As first time after reading a there is $ at the top of stack so we will follow path
segment READ1-POP6-PUSH $-PUSH a
READ1-POP5-PUSH a-PUSH a
Now a is on the top of the stack so we will follow READ1-POP5-PUSH a-PUSH a
READ1-POP5-PUSH a-PUSH a
Again following same segment for a
READ1-POP5-PUSH a-PUSH a
Again following same segment for a
READ1-POP1- HERE-POP2
As we read b on input tape.
READ2-POP1-HERE-POP2
As we read b on input tape.
READ2-POP3-ACCEPT.
As we read from the input tape
Q No 3.How to differentiate between wanted and unwanted branch ?
When we derive a word in Top down parsing beginning with the starting Non
Terminal the branches of the tree that do not lead to our required word are left aside
these branches are called unwanted branches.
Text searching
System verification
There
Question:
Answer:
Question:
Answer:
Question:
Answer:
= 326
reverse (140)
Question:
= 041
Define Strings?
Concatenation of finite letters from the alphabet is called a string.
e.g If = {a,b} then a language L can be defined asL = {a, abab, aaabb,
ababababababababab,}
its mean all words with as more or equal to bs
Answer:
Question:
Answer:
Question:
Answer:
Question:
Answer: