Esercitazione 5
Probabilit`a e Statistica
2015-2016
Claudio Agostinelli
Michele Filosi
2 maggio 2016
1
Sia X una variabile aleatoria con funzione di distribuzione continua F . Trovare lespressione delle distribuzioni delle seguenti variabili aleatorie:
1.

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

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

Esercitazione 1
Probabilit`a e Statistica
2015-2016
Claudio Agostinelli
Michele Filosi
2 maggio 2016
1
Nellassemblaggio delle ruote di bicicletta vengono effettuati due controlli per
verificarne la funzionalit`a. Il primo controllo `e effettuato sulla cam

Esercitazione 2
Probabilit`a e Statistica
2015-2016
Claudio Agostinelli
Michele Filosi
2 maggio 2016
1
Da unindagine svolta presso una certa scuola `e emerso che nel tempo libero
il 10% degli studenti studia musica, il 20% pratica sport, il 5% studia una

Esercitazione 3
Probabilit`a e Statistica
2015-2016
Claudio Agostinelli
Michele Filosi
2 maggio 2016
1
Un dado bilanciato viene lanciato consecutivamente fino a che non esce la
faccia con il 6 per la prima volta.
Qual `e la probabilit`a di fare almeno 3

Esercitazione 4
Probabilit`a e Statistica
2015-2016
Claudio Agostinelli
Michele Filosi
2 maggio 2016
1
Un dado bilanciato viene lanciato consecutivamente fino a che non esce la
faccia con il 6 per la prima volta. Dato che il 6 non appare al primo lancio,

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

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

3. Programming with TMs (Exercises)
Exercise 1
Write a program for a TM that writes a symbol at the current head position,
and shifts the contents of the tape to the right of the head one position to
the right
Outline
States: q0, one state for each inpu

12. NP-complete problems (solutions)
Exercise 1
Give a direct reduction from SAT to 3-SAT
Solution
Let the given instance of SAT contain the clauses C = cfw_c1, . . . , cm
of clauses over the variables cfw_x1, . . . , xn
We construct a instance C of 3

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?
Given a program and an input, does the program ever produce an
output?
Given two programs and an in

13. Space complexity, Complement Classes, and Counting
Space complexity
PSPACE: Problems that can be solved in polynomial space
Easy result: NP PSPACE
Proof: Check one by one all possible computations of a polynomialtime NDTM
Note that each iteration