You are on page 1of 3

CS_701 Paper

There were 10 MCQs 10 Marks

Q17
A Turing machine with stay put instead of left is similar to an ordinary Turing machine,
but at each Point the machine can move its head right or let it stay in the same position.
Show that this Turing machine variant is not equivalent to the A Turing machine with
stay. What class of languages do these machines recognize? 15 Marks (PROBLEM 3.13
of Sipser book)
Ans;
There are many variations on the definition of a Turing machine which do not change the
languages that can be recognized. Well-known variations include doubly-infinite tapes, a
stay-put option, non-determinism, and multiple tapes. Turing machines can also be built
with very small alphabets by encoding symbol names in unary or binary

Allow the head to stay in the same place


Allowing the read/write head to stay in the same place is clearly not a significant
extension, since we can easily simulate this ability by moving the head to the right,
and then moving it back to the left. Formally, we allow transitions to be of the form
(q, c) = (q 0 , d, S), where S denotes the command for the read/write head to stay
where it is (rewriting the character on the tape from c to d).
Q16
PATH ={< G,s, t>) I G is a directed graph that has a directed path from s to t}. Prove that
PATH P.
15 Marks (Theorem 7.14 of Sipser book)

Ans:
THEOREM 7.14

.................................................

PATH c P.
PROOF IDEA We prove

this theorem by presenting a polynomial time algorithm

that decides PATH. Before describing that algorithm, let's observe that a
brute-force algorithm for this problem isn't fast enough.
A brute-force algorithm for PATH proceeds by examining all potential paths
in G and determining whether any is a directed path from s to t. A potential path
is a sequence of nodes in G having a length of at most m, where m is the number
of nodes in G. (If any directed path exists from s to t, one having a length of at
most m exists because repeating a node never is necessary.) But the number of

such potential paths is roughly mm, which is exponential in the number of nodes
in G. Therefore this brute-force algorithm uses exponential time.
To get a polynomial time algorithm for PATH we must do something that
avoids brute force. One way is to use a graph-searching method such as
breadthfirst
search. Here, we successively mark all nodes in G that are reachable from s
by directed paths of length 1, then 2, then 3, through m. Bounding the running
time of this strategy by a polynomial is easy.
PROOF A polynomial time algorithm M for PATH operates as follows.

M = "On input (G, s, t) where G is a directed graph with nodes s and t:

1. Place a mark on node s.


2. Repeat the following until no additional nodes are marked:
3. Scan all the edges of G. If an edge (a, b) is found going from
a marked node a to an unmarked node b, mark node b.
4. If t is marked, accept. Otherwise, reject."
Now we analyze this algorithm to show that it runs in polynomial time. Obviously,
stages 1 and 4 are executed only once. Stage 3 runs at most m times
because each time except the last it marks an additional node in G. Thus the
total number of stages used is at most 1 + 1 + m, giving a polynomial in the size
of G.
Stages 1 and 4 of M are easily implemented in polynomial time on any reasonable
deterministic model. Stage 3 involves a scan of the input and a test of
whether certain nodes are marked, which also is easily implemented in polynomial
time. Hence M is a polynomial time algorithm for PATH.
............................................... I.............................................I...........................................................................

Q15
In the silly Post Correspondence Problem, SPCP, in each pair the top string has the same
length as the bottom string. Show that the SPCP is decidable. 10 Marks (PROBLEM 5.15
of Sipser book)

Ans:
Exercise 3 (compulsory) Consider the problem silly Post correspondence problem
(SPCP). An instance P of SPCP is P = { t1 b1 , t2 b2 , . . . , tk bk } where ti , bi
and moreover |ti | = |bi | for all i, 1 i k. In other words in each pair the top string has
the same length as the bottom string. The question is whether P contains a match (like in
standard PCP). Is the problem SPCP decidable or undecidable? Give a precise proof of
your claim.

Solution: The SPCP problem is decidable. It follows from the following claim. Claim: A
given SPCP instance has a match if and only if there is a domino ti bi such that ti = bi .
Proof of the claim: : If a SPCP instance has a match it has to start with some domino.
Because the length of the top and the bottom string is the same in all dominos, the first
domino in the match must surely have the same top and bottom string. : If there is a
domino with the same top and bottom string then this single domino forms a trivial match
of SPCP. Finally, checking whether there is a domino with the same top and bottom string
is easily decidable by examining the SPCP instance. E
Q 14
The collection of provable statements in Th(N,+,x) is Turing-recognizable. 10 Marks
(Theorem 6.15 of Sipser book)

Ans:
The collection of provable statements in Th(AY, +, x) is Turing-recognizable.
PROOF The following

algorithm P accepts its input X if X is provable. Algorithm


P tests each string as a candidate for a proof 7r of p, using the proof
checker assumed in provability property 1. If it finds that any of these candidates
is a proof, it accepts.
Q13 Let MORE= {<A,B>} the language of A is larger than B. Prove that A or B is
decideable. Consider either case. 10 Marks (Note : Wording of this question is not 100%)
Q12 Find a match.
05 Marks
Q11 Consider the following pairs of numbers. Show that they are relatively prime or not.
64 and 32965 05 Marks
Ans:

Let's turn to another example of a polynomial time algorithm. Say that two
numbers are relatively prime if 1 is the largest integer that evenly divides them
both. For example, 10 and 21 are relatively prime, even though neither of them
is a prime number by itself, whereas 10 and 22 are not relatively prime because
both are divisible by 2.

You might also like