different answer and their questions with pic and examples very informative and easy wording very difficult searching about theory of automata assignments
1. NAME ………………………………….AHSAN IFTIKHAR
ROLL NO………………………………..564
COURCE NAME ………………………Theory of automata
ASSIGNMENT TOPIC………………….SET theory and automata
SEMESTER………………………………….4th
EVENING
SUBMITED TO…………………………….SIR MOHSIN RAZA
DATE ……………………………………..11/07/2020
2. Q 1 : Define and explain the following terms ?
1) Context free gramer :” CFG stand for context free grammer it is formal
grammer which is used to generate all possibles patterns of strings in a
given FL CFG can be define by four tupels as G(v,t,p,s)”
G: is grammer which consist of a set of production rule it is use to generate the
string of a language
T: is a final set of terminal symbol .it is denoted by lower case letters
V: is final set of non –terminal symbols it is denoted by capital letter
3. P: is a set of production rule which is use to replacing non-terminal symbols (of
left side)in a string with other non terminal symbol (of right side) of product.
S: is the short symbol to derive the string.
2) Regular expression: “The language accepted by finite automata can be
easily described by simple expression called regular expression”
A regular expression can also be described as a sequience of pattern that
define a string . regular expression are used to match character combinater in
string.
3) Context free language : “a language which is generated by a CFG is
called a context free language “
CFL is the set of all strings of terminal that can be produced from the start
symbol using the production as substitution
4 ) Dterministic Finite Automata : DFA is the type of finite automata it is
used to define a language it is graphical method when we know the next
state then we call the deterministic finite automata it consist of five parts
for example L1 ={aaa}
Q: number of states
Q0: initial state
F: final state
∑: letters in alphabets
Transition movement
4. In above example we canot string and double letter at one state in dfa we
pas single character at one state
Difference between DFA and NFA is as follow
NFA : in above we cannot recognize exact path to
moving next state q1 and Q3 therefore we call it non deterministic finite
automata
DFA: in above example we recognize the next state easily
therefore we call it deterministic finoite automata we ha no confusion to
moving next state
5. Q 2(A) : Explain the following term:
a) Automata: is greek letter automata is a word formulated from automations
which means machines designing or replaving humain beings with machines it
is the plural of automation and it means something that work automatically
Kinds of automata:
1) Finite no temporary memory
2) Push down STAC
3) Turning machine Random access memory
Types of automata
1 Deterministic Finite Automata (DFA)
2 Non deterministic Finite Automata (NFA)
in NFA we cannaot recognize next statement
in DFA we recognize next statement easily
b) Set theory : a set is an un order collection of objects s={a,b,c}
A,b,c are element or member of set s elements in set need no relation to each
other
Example: S = {1,2,3,4,5,} B = {red,blue,green,pink}
In above example there is no relation in both set s and b
Q 2 (b) For the following relation between sets A and set B mention if they are
one to one /or onto :
A = {a,b,c} B = {1,2,3}
1) { (a,1),(b,1),(c,1) } this is not onto/one to one function .it is into
function
6. 2) { (a,2),(b,2),(c,3) } this is not onto/one to one function it is also into
function
3) { (a,1),(a,2),(b,2),(c,3)} this is no function
4) { (a,2),(b,1),(c,2) } this is not onto /one to one function it is also into
function
Q 3(A) construct an example of DFA ? write down the steps to convert
FA to DFA
Draw a DFA that start with ab ab(a+b)*
Q0 : is initial state Q1 : is running state Q2 : is final state Q3: is reject state
Steps to convert FA into DFA :
1) Initialy Q= ϕ
2) Add Q0 of NFA to Q then find the transition from this start state .
3) In Q find the possible set of states for each input symbol if this set of state
is not in Q,
then add it to Q,
4) In DFA the final state will be all state which contain F (final state of
NFA)
Example :
7. Q 4 (b) : construct DFA for the following regular expression :(a/b)*
ab*
?
The full form of DFA is deterministic finite automata
In above diagram first we draw initial state and send “a” to next final state
and (a/b) means (a+b) sterik means we use loop in q0 and in final state we also
use loop
Q 4(a) consider the language S*,where S = {aa b}. how many words does
this language have of length 4?of length 5? What can be said in general ?
Consider the language S*
over S = {aa b} the words of the language having
length 4 are { baab,bbaa,bbbb,aaaa,aabb }there are five words of length 4 in
the language S
The language having length 5 are {
aabaa,aaaab,aabbb,baaaa,bbbbb,aabaa,bbbaa,aabbb,bbaab,baabb,bbaab,aabaa}
there are 12 words of length 5 in the language S
Q 4(b) construct a regular expression defining each of the following
language over the alphabets ∑ = { a b }:
8. 1 ) all words in which a appears tripled, if at all.this means that every
clump of a,
s contains 3 or 6 or 9 or 12 ……a,
s .
ANS is (aaa+b)*
2) All strings that have exactly one double letter in them
ANS is (b*aab*+a*bba*)
3 ) All words that contain exactly two b,
s or exactly three b,
s, not more
ANS is ( a*ba*ba*) +( a*ba*ba*ba*)
Q-5(a): What is relationship between regular language and context free
grammer?Discuss them?Construct a language that can be generated by
CFG?
RELATIONSHIP BETWEEN REGULAR LANGUAGE AND CONTEXT
FREE GRAMMER:
Regular language is either right or left linear ,whereas context free grammer is
basically any combination of terminal and non-terminal . Hence you can see
regular language is a subset of context free grammer.
A regular language can be recoganized by a finite automata.A context free
grammer requires a stack. Basically regular language is a subset of context free
grammer, but we can not say every context free grammer is regule grammer.
Construct a language generated by CFG:
(a,b)*
{aacaa,bcb,abcba,abbcbba}
S aSa rule 1
S bSb rule 2
S c rule 3
Now if we derived a string abbcbba
S aSa
S abSba from rule 2
S abbSbba from rule 2
S abbcbba from rule 3
9. Q(5)b:consider the context free grammer
S ax x ax|bx|ϕ y bbb
(a+b)*bbb(a+b)*
S ax
S aax
S aabx
S aabbx
S aabbbx
S aabbbbx
S aabbbax
S aabbbaax
S aabbbbaabx
S aabbbbaabϕ