tcs-theory-tcs-lecture-notes_copy
tcs-theory-tcs-lecture-notes_copy
By Shri
By Shri
By Shri
Q.7. Write Short Note On: Recursive and Recursively Enumerable Languages
(May 14,Dec 16) OR
Difference between Recursive and Recursively Enumerable Languages:
By Shri
Q.8. State and prove Halting Problem or Short note on Halting Problem
(Dec15, Dec16)
Ans:
Input − A Turing machine and an input string w.
Problem − Does the Turing machine finish computing of the string w in a finite number
of steps? The answer must be either yes or no.
Proof − At first, we will assume that such a Turing machine exists to solve this problem
and then we will show it is contradicting itself. We will call this Turing machine as a
Halting machine that produces a ‘yes’ or ‘no’ in a finite amount of time. If the halting
machine finishes in a finite amount of time, the output comes as ‘yes’, otherwise as ‘no’.
The following is the block diagram of a Halting machine:
By Shri
iv) PDA consists of finite set of states, i/p tape, read head and stack.
v) Depending on the stack, i/p symbol and stack top symbol:
- PDA can change the stack/remain in the same stack.
- PDA moves the head to right of current cell.
- PDA can perform some stack operations.
vi) PDA can be represented mathematically as follows: (7 tuples)
M = ( Q, ∑, Γ, δ, q0 , Z0 , F)
Q: the finite set of states
∑: input alphabet
Γ: stack alphabet
q0 : initial state
Z0: initial stack top symbol
F: finite set of final states
δ: transition function
δ: Q × ∑ × Γ → Q × Γ*
By Shri
Q.10. State and explain power and limitation of turing machine. (Dec16)
Ans:
Power of Turing Machine:
➢ The turing machine has a great computational capabilities. So it can be used
as a general mathematical model for modern computers.
➢ Turing machine can model even recursively enumerable languages. Thus the
advantage of turing machine is that it can model all the computable
functions as well as the languages for which the algorithm is possible.
Limitations of turing machine:
➢ Computer scientists believe that a Turing machine encapsulates the idea of
computability. That is, if a function can be computed by any physical process, it
can be computed by a Turing machine. (This is known as the Church-Turing
thesis.)
➢ But we do know that many important functions are uncomputable. For
example:
- Determining if a program will ever halt on a given input
- Determining if two programs compute the same output
- Determining the size of the smallest program that computes a given
output (formally, this is known as Kolmogorov complexity)
Since none of these can be computed by a Turing machine, we believe that
they are uncomputable under any realizable model of computation.
By Shri
OR
S.NO Pushdown automata finite automata
1. PDA is more powerful than FA FA is less powerful as compare to PDA
2. It has additional memory in form of stack It has no memory
3. PDA accepts CFG(Context Free Grammar) FA accepts RL(Regular Language)
4. PDA is useful for parsing phase of FA is useful for lexical analysis phase of
compiler compiler
5. PDA transition based on current input or FA transition based on current input and
current stack on the top of stack symbol current state.
By Shri
→It has a set of states and rules for moving from one state to another but it depends upon
the applied input symbol.
→ The following figure shows some essential features of general automation.
By Shri
Q.15. Difference between DPDA and NPDA (explain npda – dec 18)
Ans:
S. DPDA (Deterministic Pushdown NDPA (Non-deterministic Pushdown
No Automata) Automata)
1. It is less powerful than NPDA. It is more powerful than DPDA.
2. It is possible to convert every DPDA to It is not possible to convert every NPDA to a
a corresponding NPDA. corresponding DPDA.
3. The language accepted by DPDA is a The language accepted by NPDA is not a
subset of the language accepted by subset of the language accepted by DPDA.
NDPA.
4. The language accepted by DPDA is The language accepted by NPDA is called
called DCFL (Deterministic Context- NCFL (Non-deterministic Context-free
free Language) which is a subset of Language).
NCFL (Non-deterministic Context-free
Language) accepted by NPDA.
Q. 16. Give formal definition of regular language. (Every year they ask this
question)
Ans:
By Shri
By Shri
By Shri
Q.18. Closure properties of regular language (State and explain any 5 --- 5 marks)
Ans:
Closure properties on regular languages are defined as certain operations on regular
language which are guaranteed to produce regular language.
Closure properties of regular languages are as follows:
1. Union
2. Intersection
3. Concatenation
4. Kleen closure
5. Complement
6. Reversal
7. Let difference operator
8. Homomorphism
9. Inverse homomorphism
1.Union:
If L1 and If L2 are two regular languages, their union L1 U L2 will also be regular.
2.Intersection:
If L1 and If L2 are two regular languages, their intersection L1 ∩ L2 will also be regular.
By Shri
3.Concatenation:
If L1 and If L2 are two regular languages, their concatenation L1.L2 will also be regular.
4.Kleen closure:
If L1 is a regular language, its Kleene closure L1* will also be regular.
5.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.
By Shri
By Shri
The problem over an alphabet belongs to a class of yes / no problems and is stated as follows
:
Consider the two lists x = (x1 . . . . xn), y = (y1......... yn) of nonempty strings over
an alphabet = (0, 1). The PCP is to determine whether or not there exist i1 .
. . .., im, where o ij n, such that xi1, . . . . xim = yi1, ........ yim
Note :
1) The indices ij’s need not be distinct and m may be greater than n.
2) if there exists a solution to PCP, there exists infinitely many solutions
3) PCP is undecidable.
By Shri