5. Undecidability (Exercises)
Exercise 1
Which strings are
1. w27
2. w109
Exercise 2
Write one of the codes for the TM for the language cfw_0n1n
Exercise 3
Prove the following languages undecidable
1. The set of all wi such that wi is not accepted by mach
5. Undecidability (Solutions)
Exercise 1
Which strings are
1. w27
0010
2. w109
011000
Exercise 2
Write one of the codes for the TM for the language cfw_0n1n
The states will be q1, . . . , q5; the symbols in the order 0, 1, X, Y , B
Each transition, wi
15. Randomness
How to deal with NP-complete problems
Suppose we have an NP-complete problem to solve. What can we
do?
Give up
Implement an exponential algorithm and hope it works on our data
Study average-case complexity, and hope it is better
We hav
5. Undecidability
Introduction
The proof we shall now see is similar in principle to our hello, world
example
By focussing on Turing machines, we prove results that apply to
any model of computation, not just to C programs
We give a formal proof of the
7. The Post Correspondence Problem (Exercises)
Exercise 1
Do the following instances of PCP have solutions?
1. A = (01, 001, 10); B = (011, 10, 00)
2. A = (01, 001, 10); B = (011, 01, 00)
3. A = (ab, a, bc, c); B = (bc, ab, ca, a)
Exercise 2
Show that PCP
Computability and computational complexity
Written exam
January 12, 2015
Name:
Surname:
ID number:
Instructions
To pass the exam you need to solve at least five exercises: two exercises from the Computability part, two exercises from the NPcompleteness p
15. Randomness
Exercise 1
Consider a symbolic matrix of the form
x w z
z x w
y z 0
Describe a randomized algorithm for testing whether the determinant is always zero
Which class does your algorithm belong to?
Solution
Algorithm: Guess values for the
Computability and computational complexity
Written exam
January 12, 2015
Name:
Surname:
ID number:
Instructions
To pass the exam you need to solve at least five exercises: two exercises from the Computability part, two exercises from the NPcompleteness p
Computability and computational complexity
Lecturer: Prof. Gabriel Kuper
Hours: Monday and Thursday 9:00-11:00 (A107)
Overview
Computability: What can be computed
Computational complexity: What can be computed efficiently
Computability: Overview
We
10. Formal Definitions
Objects
Objects are strings over cfw_0, 1
cfw_0, 1n is the set of all strings of length n
cfw_0, 1 = nNcfw_0, 1n
For x cfw_0, 1, |x| is the length of x
xy is the concatenation of x and y
Numbers
Natural numbers are usually en
12. NP-complete problems (Exercises)
General comments
Proving a problem NP-complete consists of
Proving it is in NP
Reducing it from some known NP-complete problem
Proving the reduction works
Proving that it can be computed in polynomial time
These
17. Cryptography
Introduction
In complexity theory, we are usually looking for an efficient solution to
a problem
Complexity theory tells us when we are unlikely to be able to find
such an algorithm
In cryptography, on the other hand, the situation is
14. Solutions
Exercise 1
Show the following, for arbitrary k 0
k P Pk P k+1P
For the first part, simply use one oracle call
The second part follows from the fact that P NP
k P Pk P k+1P
This is the same as the previous exercise
k P k+1P and k P k+1
8. Other Undecidable Problems
Properties of programs
We can show an analogue of Rices Theorem for any programming
language:
Any nontrivial property of what a program does is undecidable
Are there examples of real problems that are undecidable?
We show
2. Turing Machines (Exercises)
Exercise 1
Show the IDs of the TM for cfw_0n1n for the following input tapes
00
000111
00111
Exercise 2
Design Turing machines for the languages
The set of strings with an equal number of 0s and 1s
cfw_anbncn | n 1
cfw
13. Space complexity, reductions etc. (Exercises)
Exercise 1
Definition: A linear-time reduction R computes R(x) in O(|x|) steps
Show that there are no P-complete problems under linear reductions
Exercise 2
Prove that the following are all closed under
15. Randomness
Exercise 1
Consider a symbolic matrix of the form
x w z
z x w
y z 0
Describe a randomized algorithm for testing whether the determinant is always zero
Which class does your algorithm belong to?
Exercise 2
Prove that RP NP
Why does a si
4. Restricted Turing Machines
Introduction
We study restrictions of the TM model that do not reduce expressive
power
This means we can prove undecidability results on a simpler model
This helps us focus on precisely what is important for computation
Se
16. Approximation
Approximation
Suppose problem is an NP-complete problem
This means that there is no efficient algorithm for finding a precise
solution
But how about looking for an approximate solution?
For example, a nearly maximal clique, or a near
1. Undecidability
Exercise 1
Give informal reductions from the hello-world problem to the following
Given a program and an input, does the program stop?
Modify the program so that:
When it would halt, make it output hello, world
Replace any other out
2. Turing Machines
Motivation
Consider finite automata and regular expressions
This is a model for computation, but is not powerful enough
For example, we cannot recognize strings of the form 0n1n
Such a pattern is clearly recognizable by a computer
12. NP-Complete Problems
SAT is NP-complete
The problem: Given a Boolean formula in conjunctive normal form
(CNF), does it have a satisfying assignment
What is the difference between Boolean circuits and formulae?
A Boolean circuit is a DAG (directed a
11. NP Completeness
P versus NP
Intuitively, this is the difference between verifying and finding a solution
to a problem
Alternatively, the difference between checking and finding a proof
The latter seems to be much harder than the former
Search prob
18. Parallelism
Parallel computation
By using multiple processors, we can solve some problems faster
Example: matrix multiplication
Given two n n matrices A and B, wen want to compute their
product C = A B
The obvious algorithm takes O(n3) (there are
19. Lower bounds
Lower bounds
Lower bounds: Proofs that a problem cannot be solved faster that this
Ideally: Proof that an NP-complete problem cannot be solved in polynomial time
Such proofs have not been found
We see some, much weaker, results on the
6. Reductions
Reductions
We now study undecidability questions about Turing Machines
Proving each result directly, on the lines of our previous proof,
would be very hard work
We therefore introduce the notion of a reduction, which is a way
to use our e
7. The Post Correspondence Problem
The Post Correspondence Problem
The Post Correspondence Problem (PCP) is
Historically significant: One of the first problems to be proved
undecidable
Originated from an early model of computation
It is easier to redu
17. Approximation
Exercise 1
Prove the main theorem:
Theorem: If there is an L-reduction (R, S) from A to B with constants
and , and there is a polynomial-time -approximation algorithm for B,
-approximation algorithm for A
then there is a polynomial-time
13. Space complexity, reductions etc. (Solutions)
Exercise 1
Definition: A linear-time reduction R computes R(x) in O(|x|) steps
Show that there are no P-complete problems under linear reductions
Solution
Suppose there is such a P-complete problem
It