TOC EndSem 2023-Micro (FlyHigh Inc.)
TOC EndSem 2023-Micro (FlyHigh Inc.)
Telegram Channel
https://t.me/SPPU_TE_BE_COMP
(for all engineering Resources)
WhatsApp Channel
(for all tech updates)
https://whatsapp.com/channel/
0029ValjFriICVfpcV9HFc3b
Insta Page
(for all engg & tech updates)
https://www.instagram.com/
sppu_engineering_update
S1→ A1 S1 A1 | B1 S1 B1 | ε G= { (V, Σ,P,S)
A1→a V= {S,S1,A1,B1}
B1→b And P= S→ S1S | ε
} S1→A1S1A1 | B1S1B1
Similarly, L2 is a context free language A1→a
which can be represented by a context free
B1→b
grammar G2, such that G2 ∈ L2 and
}
G2 = {V2, Σ ,P2,S2}
Thus grammar G is a context free grammar
V2= {S2,A2,B2}
and language L produced by G is also
Σ={a,b} context free language. Hence context free
language are closed under kleen closure.
S2 is start symbol and P2 is ste of
production Rules
P2={ S2 →aA2A2 | bB2B2
A2→b Q3.Decision Properties Of CFL →Various
decision properties Of CFLs are 1.
B2→a
Emptiness 2. Finiteness 3. Membership
} These properties are discussed in detail as
follows. 1. Emptiness
Now, L=L1L2 can be obtained by G such
that G=G1 U G2. Theorem ::: There exists an algorithm
which can determine whether or not the
Therefore
given context free grammar can generate
G={V, Σ ,P,S} any word at all. Proof : The algorithm to
determine whether or not a grammar
V= {S,S1,A1,B1,S1,A2,B2}
generates any word is given below - i) Put
the dot ( • ) above every terminal symbol.
If there is any null string e then put dot over
ε as well. These symbols occur at right
Theorem 3 : If L1 is context free language hand side of production rule. ii) If all the
then L1 * is also context free. That means symbols of right hand side of the
CFL is closed under kleen closure. production rule are dotted then dot the
corresponding non terminal throughout
Proof : Let, L1 be a context free language
the grammar. Repeat this step as long as
represented by G1 such that G1→ ε L1. The
possible. iii) If the stating symbol gets
CFG G1 can be given as G1= {V1, Σ, P1, S1}
dotted then answer is yes otherwise
where S1 is a start symbol
answer is no.
P1 = {S1→ A1S1A1 | B1S1B1 | ε
Finiteness ::: Theorem: There exists an
Now L =L1* can be represented by a algorithm to determine whether the given
grammar G such that
context free grammar generates a finite or Type 3 - Regular languages Regular
infinite language. languages are those languages which can
be described using regular expressions.
Proof : We will write following algorithm –
These languages can be modelled by NFA
1.Make the grammar simplified by
or DFA. Type 2 - Context free languages
removing unit productions and useless
The context free languages are the
symbols. 2.Check whether there is any self-
languages which can be represented by
embedded non terminal or not by
Context Free Grammar (CFG). The
following steps→ a) Underline some non
production rule is of the form A→ α where
terminal say X which is at LHS of production
A is any single non-terminal and a is any
rule. b) Then put dot over all the X which
combination of terminals and non-
are at RHS throughout the grammar. The
terminals. A NFA or DFA cannot recognize
dotted X and underlined X are treated as
strings of this language because these
two different symbols. c) Put dot over any
automata are not having "stack" to
non terminal at LHS whose RHS contains
memorize. Instead of it the Push Down
any dotted symbols. Dot this non terminal
Automata can be used to represent these
throughout the grammar. d) If underlined
languages. Type 1 - Context sensitive
X gets dotted then X is called self
languages → The context sensitive
embedded otherwise it is not self
grammars are used to represent context
embedded. 3. If the grammar contains any
sensitive languages. The context sensitive
self embedded non terminal then it
grammar is follows the following rules -
generates infinite languages otherwise it
1.The context sensitive grammar may have
generates finite languages.
more than one symbol on the left hand
Membership : There exists an algorithm side of their production rules. 2.The
which tells whether given string belongs to number of symbols on the left hand side
given grammar. To check whether the must not exceed the number of symbols on
given grammar generates desired string the right hand side. 3.The rule of the form
the derivation tree can be drawn. A → ε is not allowed unless A is a start
symbol. It does not occur on the right hand
Q4. Chomsky’s Hierarchy-→The
side of any rule. The automaton which
Chomsky's Hierarchy represents the class
recognizes context sensitive languages is
of languages that are accepted by different
called linear bounded automaton. While
machine. The category of languages in
deriving using context sensitive grammar
Chomsky's Hierarchy is as given below
the sentential form must always increase
in length every time a production rule is
applied. Thus the size of a sentential form
is bounded by a length of the sentence we
are deriving. Type 0 - Unrestricted
languages→ There is no restriction on the
grammar rules of these type of languages.
These languages can be effectively
modeled by turing machines.
Q5.Formal Definition Of PDA →The PDA Q8.Formal definition of Turing machine→
can be defined as a collection of seven A Turing machine can be defined as a
components. 1.The finite set of states Q. collection of 7 components: Q: the finite
2.The input set Σ . 3. T is a stack alphabet. set of states ∑: the finite set of input
4. q0 is initial stage, q 0 ∈ Q. 5. Z0 is a start symbols T: the tape symbol q0: the initial
symbol which is in T. 6. Set of final states F state F: a set of final states B: a blank
subset Q. 7. δ is mapping function used for symbol used as a end marker for input δ: a
moving from current state to next state. transition or mapping function.
Q6.Instantaneous Description (ID) →ID is The turning machine can be modelled with
an informal notation of how a PDA the help of the following representation.
computes an input string and make a →1. The input tape is having an infinite
decision that string is accepted or rejected. number of cells, each cell containing one
An instantaneous description is a triple (q, input symbol and thus the input string can
w, α) where: q describes the current state. be placed on tape. The empty tape is filled
w describes the remaining input. α by blank characters. 2. The finite control
describes the stack contents, top at the and the tape head which is responsible for
left. reading the current input symbol. The tape
head can move to left to right. 3. A finite
Q7. Acceptance By Final State and Empty
set of states through which machine has to
Stack →1. Acceptance by Final State: The
undergo. 4. Finite set of symbols called
PDA is said to accept its input by the final
external symbols which are used in
state if it enters any final state in zero or
building the logic of turing machine.
more moves after reading the entire input.
Let P =(Q, ∑, Γ, δ, q0, Z, F) be a PDA. The
language acceptable by the final state can
be defined as: L(PDA) = {w | (q0, w, Z) ⊢*
(p, ε, ε), q ∈ F }. 2. Acceptance by Empty
Stack: On reading the input string from the
initial configuration for some PDA, the
stack of PDA gets empty. Let P =(Q, ∑, Γ, δ,
q0, Z, F) be a PDA. The language acceptable
by empty stack can be defined as: N(PDA)
= {w | (q0, w, Z) ⊢* (p, ε, ε), q ∈ Q}
Equivalence of Acceptance by Final State
and Empty Stack →If L = N(P1) for some
PDA P1, then there is a PDA P2 such that L
= L(P2). That means the language accepted
by empty stack PDA will also be accepted Q9.Types Of Turing Machines:
by final state PDA. If there is a language L = Deterministic Turing Machine (DTM)
L (P1) for some PDA P1 then there is a PDA ➔The deterministic Turing machine is a
P2 such that L = N(P2). That means kind of turing machine in which the set of
language accepted by final state PDA is also rules denote the single specific action on
acceptable by empty stack PDA. reading particular input in current specific
state. It is just similar to deterministic finite Deciding whether two context free
automata. Non Deterministic Turing grammars are equivalent. ii) Whether a
Machine (NTM)➔ The non deterministic given program will loop forever on
turing machine is a kind of turing machine particular input. iii) If two CFGS are given
in which the set of rules denote more than GI and G2 then L(G1) ∩ L(G2) = is
one specific action on reading particular undecidable. iv) Whether the language
input in current specific state. This kind of accepted by TM is empty it is not possible
TM just similar to NFA. Universal Turing for a TM to answer "yes" or "no" for above
Machine -→ The universal language Lu is a problems. Hence these problems are
set of binary strings which can be modeled unsolvable by TM.
by a turing machine. • The universal
language can be represented by a pair (M,
w) where M is a TM that accepts this Q11.Post Correspondence Problem → In
languages and w is a binary string in(0 + 1)* this section, we will discuss the
such that w belongs to L(M). Thus we can undecidability of string and not of Turing
say that any binary string belongs to a machines. The undecidability of the string
universal language. • The universal is determined with the help of Post's
language can be represented by Lu = L(U) Correspondence Problem (PCP). Let us
where U is a universal Turing Machine. • In define the PCP. "The Post's
fact U is a binary string. This binary string correspondence problem consists of two
represents various codes Of many Turing lists of string that are of equal length over
machines. • Thus the universal turing the input. The two lists are A = w1, w2, w3,
machine is a Turing machine which accepts .... , wn and B = x1, x2, x3, .... xn then there
many Turing machines. Multi-tape Turing exists a non empty set of integers i1, i2, i3,
Machine ➔The multitape turing machine .... , in such that, w1, w2, w3, .... wn = x1,
is a type of turing machine in which there x2, x3, .... xn" To solve the post
are more than one input tapes. Each tape correspondence problem we try all the
is divided into cells and each cell can hold combinations of i1, i2, i3, .... , in to find the
any symbol Of finite tape alphabet. w1 = x1 then we say that PCP has a
solution.
Q12.P-Class ➔1.The class P consists of
Q10. Limitations Of Turing Machine
those problems that are solvable in
➔Turing machine is a model which can
polynomial time, i.e. these problems can
solve any problem which has some
be solved in time O(n k) in the worst-case,
algorithm. But not all the problems be
where k is constant. 2.These types of
solved by TM. There are some problems
problems are called tractable and others
which cannot be Solved by TM. For
are called intractable or super polynomial.
example : Halting problem cannot be
3.Generally, an algorithm is a polynomial
solved by T M. The Halting problem can be
time algorithm, if there exists a polynomial
stated as follows - "It is not possible to
p(n) such that the algorithm can solve any
determine whether a TM will ever halt on
instance of size n in a time O(p(n)).
particular input". Such a problem is called
4.Problems requiring Ω(n 50) time to solve
unsolvable problem. There some more
are essentially intractable for large n. Most
problems that are not solvable by TM - i)
known polynomial time algorithms run in complement of Lu that is L`u is also
time O(n^k) for a fairly low value of k. 5.The recursive. However, if we have a TM M to
advantage in the class of polynomial-time accept L`u then we can construct a TM Ld.
algorithms is that all reasonable But Ld the diagonalization language is not
deterministic single processor models of RE. Thus our assumption that Lu is
computation can be simulated on each recursive is wrong (not RE means not
other with at most a polynomial slow-d. recursive). Hence we can say that Lu is RE
but not recursive
Q13.NP-Class→ 1.The class NP consists of
problems that are verifiable in polynomial Q16.Decidable Language ➔A language L is
time. NP is a class of decision problems for called decidable if there is a decider M such
which it is easy to check the correctness of that L( M) = L. Given a decider M, you can
a given answer, with the aid of a little extra learn whether or not a string w ∈ L(M). Run
information. Hence, we are not asking for M on w. Although it might take a long time,
a way to find a solution, but only to verify M will accept or reject w. The set R is the
that a solution really is correct. 2.Every set of all decidable languages. L ∈ R if L is
problem in the given class can be solved in decidable.
exponential time using exhaustive search.
Q17.Undecidable Language ➔A decision
Q14.Define Decidable and Undecidable problem P is undecidable if the language L
Language (Recursive and non of all yes instances to P is not decidable. An
recursive)→If a language is recursive then undecidable language may be partially
it is called decidable language and if the decidable but not decidable. Suppose, if a
language is not recursive then such a language is not even partially decidable,
language is called undecidable language. • then there is no Turing machine that exists
The class of decidable problems are also for the respective language.
called as solvable problems and the class of Example→Find whether the problem
undecidable problems is called unsolvable given below is decidable or undecidable.
problems. ➔“Let the given input be some Turing
Machine M and some string w. The
Q15.Undecidability ➔In the theory of
problem is to determine whether the
computation, we often come across such
machine M, executed on the input string w,
problems that are answered either 'yes' or
ever moves its readhead to the left for
'no'. The class of problems which can be
three delta rules in a row.”
answered as 'yes' are called solvable or
Solution→Define M' is a Turing machine
decidable. Otherwise, the class of
that takes a pair (M,w) as input, where M
problems is said to be unsolvable or
is a Turing machine recognized by M' and
undecidable. Undecidability of Universal
w is the input to M. Whenever the head of
Languages: The universal language Lu is a
simulated machine M moves to left while
recursively enumerable language and we
processing input w , M' stops and accepts
have to prove that it is undecidable (non-
(M,w) For a particular input to M' (M,w),
recursive). Theorem: Lu is RE but not
construction the Turing machine P is − P
recursive. Proof: Consider that language
executes M' on (M,w) P stops and accepts
Lu is recursively enumerable language. We
any input if M' accepts (M,w) We have
will assume that Lu is recursive. Then the
tried to reduce the Universal Turing
Machine U to P, because we know that L(U) followed by 0's and 1's Example : (X1v x2) ^
is not decidable, and also we conclude that (x2 v --] X3) is represented as (X1 v X10) ^
L(P) is not decidable. Consequently, M' is (X10 v X11).
not decidable.
Q21.Explain NPDA(non-deterministic
Q18. Diff. Betn Finite automata and Turing PDA)→The non-deterministic pushdown
Machine→ FA →It accepts regular automata is very much similar to NFA. We
languages. It can not be programmed. It will discuss some CFGs which accepts
accepts small class Of language. TM→ It NPDA. The CFG which accepts
accepts recursive and recursively deterministic PDA accepts non-
enumerable languages. It can be deterministic PDAs as well. Similarly, there
programmed. It accepts large class of are some CFGs which can be accepted only
languages. by NPDA and not by DPDA. Thus NPDA is
more powerful than DPDA. Suppose the
Q19.Polynomial Time Reduction →TO
language consists of string L = {aba, aa, bb,
prove whether particular problem is NP
bab, bbabb, aabaa, ......]. The string can be
complete or not we use polynomial time
odd palindrome or even palindrome. The
reducibility. That means if A ---poly----> B
logic for constructing PDA is that we will
and B---poly----> C then A----poly--> C . The
push a symbol onto the stack till half of the
reduction is an important task in NP
string then we will read each symbol and
completeness proofs. Various types of
then perform the pop operation. We will
reductions are : Local replacement - In this
compare to see whether the symbol which
reduction A→B by dividing input to A in the
is popped is similar to the symbol which is
form of components and then these
read. Whether we reach to end of the
components can be converted to
input, we expect the stack to be empty.
components of B. Component design - In
this reduction A→B by building special Q22.Diff. Betn FA and PDA →Finite
component for input B that enforce Automata ::: 1.The Finite Automata (FA)
properties required by A. The reduction has no memory. Hence it can not
can be denoted as A =<T P B. remember already read input. 2.It accepts
regular language. 3.It makes use of states
Q20.The Satisfiability Problems →The
and transitions to model any language. 4.It
boolean expression are created using -
is simple to represent.
1.The variables whose value can be 0 or 1.
2.The operators that are used in expression Pushdown Automata ::: 1.The push-down
can be v, A. The v means OR and A means machine has a capacity of remembering
AND, operators. 3.The unary operator -n already read input by means of stack. 2.It
stands for negation. 4.The parenthesis are accepts regular non-regular and context
used to group the operands and operators free languages. 3.It makes use of push and
in the expression. The highest precedence pop operations to model any language. 4.It
is ---] to , then A, then v. Representing SAT is more powerful than FSM.
Instances: 1.An instance of SAT is a
boolean function. 2.The symbols ^, v, —],
(and) are used in these instances. 3.The
variable Xi is represented by symbol x