Q5.
State and Explain any five closure properties of
regular language
In an automata theory, there are different closure properties for regular
languages. They are as follows −
Union
Intersection
concatenation
Kleene closure
Complement
Let see one by one with an example
Union
If L1 and If L2 are two regular languages, their union L1 U L2 will also be
regular.
Example
L1 = {an | n > O} and L2 = {bn | n > O}
L3 = L1 U L2 = {an U bn | n > O} is also regular.
Intersection
If L1 and If L2 are two regular languages, their intersection L1 ∩ L2 will also
be regular.
Example
L1= {am bn | n > 0 and m > O} and
L2= {am bn U bn am | n > 0 and m > O}
L3 = L1 ∩ L2 = {am bn | n > 0 and m > O} are also regular.
Concatenation
If L1 and If L2 are two regular languages, their concatenation L1.L2 will also
be regular.
Example
L1 = {an | n > 0} and L2 = {bn | n > O}
L3 = L1.L2 = {am . bn | m > 0 and n > O} is also regular.
Kleene Closure
If L1 is a regular language, its Kleene closure L1* will also be regular.
Example
L1 = (a U b )
L1* = (a U b)*
Complement
If L(G) is a regular language, its complement L'(G) will also be regular.
Complement of a language can be found by subtracting strings which are in
L(G) from all possible strings.
Example
L(G) = {an | n > 3} L'(G) = {an | n <= 3}
Note − Two regular expressions are equivalent, if languages generated by them
are the same. For example, (a+b*)* and (a+b)* generate the same language.
Every string which is generated by (a+b*)* is also generated by (a+b)* and vice
versa.
Q9.Write short note on: Chomsky hierarchy of
Grammar.
Chomsky Hierarchy
Chomsky Hierarchy represents the class of languages that are accepted by the
different machine. The category of language in Chomsky's Hierarchy is as given
below:
1. Type 0 known as Unrestricted Grammar.
2. Type 1 known as Context Sensitive Grammar.
3. Type 2 known as Context Free Grammar.
4. Type 3 Regular Grammar.
This is a hierarchy. Therefore every language of type 3 is also of type 2, 1 and
0. Similarly, every language of type 2 is also of type 1 and type 0, etc.
Type 0 Grammar:
Type 0 grammar is known as Unrestricted grammar. There is no restriction on
the grammar rules of these types of languages. These languages can be
efficiently modeled by Turing machines.
For example:
1. bAa → aa
2. S → s
Type 1 Grammar:
Type 1 grammar is known as Context Sensitive Grammar. The context sensitive
grammar is used to represent context sensitive language. The context sensitive
grammar follows the following rules:
o The context sensitive grammar may have more than one symbol on the
left hand side of their production rules.
o The number of symbols on the left-hand side must not exceed the number
of symbols on the right-hand side.
o The rule of the form A → ε is not allowed unless A is a start symbol. It
does not occur on the right-hand side of any rule.
o The Type 1 grammar should be Type 0. In type 1, Production is in the
form of V → T
Where the count of symbol in V is less than or equal to T.
For example:
1. S → AT
2. T → xy
3. A → a
Type 2 Grammar:
Type 2 Grammar is known as Context Free Grammar. Context free languages
are the languages which can be represented by the context free grammar (CFG).
Type 2 should be type 1. The production rule is of the form
1. A → α
Where A is any single non-terminal and is any combination of terminals and
non-terminals.
For example:
1. A → aBb
2. A → b
3. B → a
Type 3 Grammar:
Type 3 Grammar is known as Regular Grammar. Regular languages are those
languages which can be described using regular expressions. These languages
can be modeled by NFA or DFA.
Type 3 is most restricted form of grammar. The Type 3 grammar should be
Type 2 and Type 1. Type 3 should be in the form of
1. V → T*V / T*
For example:
1. A → xy
Q2.Differenciate between DFA and NFA.
Q1. Define Finite State machine.
A finite state machine (FSM) is a computational model that can be in
one of a finite number of states at any time, and transitions between
states are triggered by input events or conditions.
Q7. Give and Explain formal definition of Pumping
Lemma for regular language and prove that following
language is not regular={anbn /n>=1}