# TDDD65 Example Exam 2 ```2012-09-28
Institutionen för Datavetenskap
Gustav Nordh
TDDD65 Example Exam 2
Outline of the proposed solutions for selected problems.
1.
(4 p)
(a) P=NP
(1)
(b) The algorithm starts with “Find a satisfying assignment to ϕ...”, but since ϕ is a
3CNF it is not clear how this can be done in polynomial-time (if P6=NP, this is indeed
impossible). Hence, the claim that the reduction runs in polynomial time is unsupported.
(3)
2. //(a + b + / + \)∗ \\
(2 p)
a, b, c
3.
(2 p)
q
a, b, c
a, b, c
b
a
p
r
a, b, c
c
a
s
4.
(2 p)
→p
F qr
∅
a
qr
qr
∅
b
∅
p
∅
5. Here there are of course many correct answers.
(3 p)
(a) Ladner’s Theorem states that if P6=NP, then there are infinitely many problems of intermediate complexity (neither in P nor NP-complete). On the contrary, such problems
seems to be very rare, out of the thousands of problems in NP that have been investigated we have found very few candidates (FACTORING and Graph Isomorphism) that
seems to be neither NP-complete nor in P. Furthermore, it is know that large subsets
of NP lacks problems of intermediate complexity.
(1)
(b) If P=NP, then it is no more difficult to invent a solution (or mathematical proof) than
to verify that a solution/proof is correct. But our experience tells us that it seems much
harder to invent something than to just verify that something is correct.
(1)
1
(c) If P6=NP, then we must rule out the existence of every polynomial-time algorithm for
some problem in NP. This seems to be very difficult, as there are many different types
of very powerful and clever polynomial-time algorithms (some of which we have not
even yet invented).
6.
(1)
(4 p)
(a) S ⇒ AA ⇒ A ⇒ ε
S ⇒ BB ⇒ B ⇒ ε
(2)
(b) S → Sa | Sb | ε
(2)
7. Assume that L is regular and consider the string s = ap+2 bp+1 cp ∈ L, where p is the pump
length given by the pumping lemma. The pumping lemma says that there is a partition of
s into xyz such that |xy| ≤ p, |y| &gt; 0, and xy i z ∈ L for all i ≥ 0. In any such partition of
s we must have that y is a nonempty string of a’s (since s starts with p + 2 a’s, |xy| ≤ p,
and |y| &gt; 0. Hence, taking i = 0 we see that xy 0 z = ap+2−|y| bp+1 cp and thus xy 0 z ∈
/ L since
the number of a′ s in xy 0 z is less than or equal to the number of b′ s in xy 0 z. We have a
contradiction with the pumping lemma and L is not regular.
(4 p)
8. Since B is not Turing recognizable and B ≤m D, we know that D is not Turing recognizable
(and hence not decidable).
(3 p)
The reductions C ≤m A and E ≤m C tells us that E is decidable, since A is a regular language we know that C is decidable.
The information given is not enough to draw a conclusion about the decidability of
F.
2
```