Sei sulla pagina 1di 38

Theory of Computation

Lecture #42
Sarmad Abbasi
Virtual University

Sarmad Abbasi (Virtual University)

Theory of Computation

1 / 38

Space Complexity

Let us now consider some new complexity classes. Let us define


L = SPACE(log n)
and
NL = NSPACE(log n).
These turn our to be very interesting space complexity classes.

Sarmad Abbasi (Virtual University)

Theory of Computation

2 / 38

Space Complexity

Notice that to count upto n we need a log n-bit counter. Thus you
should think of L as the set of problems that can be solved using a
fixed number of counters. NL is offcourse the non-deterministic
analogue of this class.

Sarmad Abbasi (Virtual University)

Theory of Computation

3 / 38

Space Complexity

We know that
L NL P.

Sarmad Abbasi (Virtual University)

Theory of Computation

4 / 38

Space Complexity

Furthermore, we know from Savatichs theorem that


NL SPACE(log2 n).
However, Savatichs theorem does not show us that
NL = L.

Sarmad Abbasi (Virtual University)

Theory of Computation

5 / 38

Space Complexity

To study L and NL polynomial time reductions are useless. Thus we


define a new reduction. Let us make some definitions.

Sarmad Abbasi (Virtual University)

Theory of Computation

6 / 38

Space Complexity

A LOGSPACE transducer is a TM with an input tape, a work tape and


an output tape. The input tape is read only. The output tape is write
only. The machine on input x of length n is allowed to use
O(log n)
work tape and produce its output.

Sarmad Abbasi (Virtual University)

Theory of Computation

7 / 38

Space Complexity

Note that
1

The input is not counted as space used by the TM.

Only the space used on the worktape is counted as space used by


the TM.

Sarmad Abbasi (Virtual University)

Theory of Computation

8 / 38

Space Complexity

Let us design a LOGSPACE transducer that on input x compute


1( |x|2 ). This is very easy.

Sarmad Abbasi (Virtual University)

Theory of Computation

9 / 38

Space Complexity

On input x

Set counter=0;

for each character of the input increment the counter.

for i = 1 to counter.

5
6

for j = 1 to counter.
print 1.

This machine uses only three counters. They need to be log n bit
counters on input of length n. The output is clearly n2 bits.

Sarmad Abbasi (Virtual University)

Theory of Computation

10 / 38

Space Complexity

It is easy to argue that if a log space transducer produces an output


f (x) then
|f (x)| |x|k
for some k .

Sarmad Abbasi (Virtual University)

Theory of Computation

11 / 38

Space Complexity

We say that a language A is LOGSPACE reducible to B if and only if


there is a LOGSPACE transducer that computes a function f (x) such
that
x A
if and only if
f (x) B.
In this case we will write
A L B.

Sarmad Abbasi (Virtual University)

Theory of Computation

12 / 38

Space Complexity

We would like to show the following theorem.

Theorem
If B L and A L B then
A L.
This is not trivial. Let us try to give a simple solution for this problem
and see why does it not work.

Sarmad Abbasi (Virtual University)

Theory of Computation

13 / 38

Space Complexity
We know that
A L B
thus there is a log space transducer N computing f such that
x A
if and only if
f (x)
is in B.
Furthermore, we know that B L so there is a TM M that uses
O(log n)
space and accepts B.

Sarmad Abbasi (Virtual University)

Theory of Computation

14 / 38

Space Complexity

Let us consider the following TM T


1

Input x.

Using N compute y = f (x).

Run M on y and accept if M accepts y .

Sarmad Abbasi (Virtual University)

Theory of Computation

15 / 38

Space Complexity

It is clear that T accepts x if and only if x A. But how much is the


space used by T .

Sarmad Abbasi (Virtual University)

Theory of Computation

16 / 38

Space Complexity

The first step is to compute f (x) and write it down. Although, it takes
O(log n) space to compute f (x) but writing down f (x) can require a lot
of space. Thus this is NOT a log space TM. We need a new idea.

Sarmad Abbasi (Virtual University)

Theory of Computation

17 / 38

Space Complexity

The new idea is to use what I call the man in the middle attack! Let us
see what the man in the middle attack is. Talk about man in the middle
attack.

Sarmad Abbasi (Virtual University)

Theory of Computation

18 / 38

Space Complexity

We observe that a TM reads one character at a time and then


performs one step. Thus in order to simulate the TM M we need to
know what is the current symbol under the tape head. Not the entire y .

Sarmad Abbasi (Virtual University)

Theory of Computation

19 / 38

Space Complexity

We can now simulate M as follows. We find out what is the current


symbol of y that is being scanned by M. To perform one step of the
simulation we can rerun N on x to compute the symbol of y that is
needed to take one step of M.

Sarmad Abbasi (Virtual University)

Theory of Computation

20 / 38

Space Complexity

Thus if M needs the i-th symbol of the y we can run N on x and


everytime it produces a counter we increment it. We discard the output
by erasing it if the counter is less than i. This way the output does not
use any space. When the i-th bit is produced we use it to do one step
in our simulateion.

Sarmad Abbasi (Virtual University)

Theory of Computation

21 / 38

Space Complexity

This way by using a few extra counters the space requirement of this
TM is
O(log n) + O(log y ).
The lenght of y is at most nk thus the whole procedure takes
log-space.

Sarmad Abbasi (Virtual University)

Theory of Computation

22 / 38

Space Complexity

Thus we have proved our theorem.

Theorem
If B L and A L B then
A L.
Notice that we would not be able to prove this theorem if we were
using polynomial time reducibility.

Sarmad Abbasi (Virtual University)

Theory of Computation

23 / 38

Space Complexity

Thus log-space reducibility is what is needed to study L and NL.

Sarmad Abbasi (Virtual University)

Theory of Computation

24 / 38

Space Complexity

A central question in space complexity is if


L = NL.
This is a major unresolved question in space complexity. Solution to
this problem means instant fame and glory!

Sarmad Abbasi (Virtual University)

Theory of Computation

25 / 38

Space Complexity

This problem is very interesting we can define the classes


co P = {L : L P}.
co NP = {L : L NP}.

Sarmad Abbasi (Virtual University)

Theory of Computation

26 / 38

Space Complexity

It is easy to see that


P = co P.
However, many people conjecture that
NP 6= co NP.

Sarmad Abbasi (Virtual University)

Theory of Computation

27 / 38

Space Complexity
It is easy to see that

Theorem
If co NP 6= NP then P 6= NP.
Thus
NP 6= co NP
is a stronger conjecture than
P 6= NP
conjecture.

Sarmad Abbasi (Virtual University)

Theory of Computation

28 / 38

Space Complexity

One way to resolve the P vs. NP conjecture is to show that


NP 6= co NP.

Sarmad Abbasi (Virtual University)

Theory of Computation

29 / 38

Space Complexity

On the other hand if someone proves that


NP = co NP
that would be a great insight but would not resolve the P vs. NP
conjecture.

Sarmad Abbasi (Virtual University)

Theory of Computation

30 / 38

Space Complexity

We can play the same game with space complexity. Define,


co L = {L : L L}.
co NL = {L : L NL}.

Sarmad Abbasi (Virtual University)

Theory of Computation

31 / 38

Space Complexity

It is easy to see that


L = co L.
However, it is not clear if
NL = co NL.

Sarmad Abbasi (Virtual University)

Theory of Computation

32 / 38

Space Complexity
It is easy to see that

Theorem
If co NL 6= NL then L 6= NL.
Thus
NL 6= co NL
is a stronger conjecture than
L 6= NL
conjecture.

Sarmad Abbasi (Virtual University)

Theory of Computation

33 / 38

Space Complexity

One way to resolve the L vs. NL conjecture is to show that


NL 6= co NL.
However, there is a twist in the tale.

Sarmad Abbasi (Virtual University)

Theory of Computation

34 / 38

Space Complexity

We will prove that


NL = co NL.
This is a major result in space complexity.

Sarmad Abbasi (Virtual University)

Theory of Computation

35 / 38

Space Complexity

However, the question


L = NL
is still wide open!

Sarmad Abbasi (Virtual University)

Theory of Computation

36 / 38

Space Complexity

Lets first start by looking at a problem


Reach = {< G, s, t >: there is a path from s to t in G }.

Sarmad Abbasi (Virtual University)

Theory of Computation

37 / 38

Space Complexity

Lets first observe that Reach in NL. We have to give a


non-deterministic algoirithm for Reach.

Sarmad Abbasi (Virtual University)

Theory of Computation

38 / 38

Potrebbero piacerti anche