Skip to content

Commit e6010ea

Browse files
committed
added more lecs
1 parent 098c09a commit e6010ea

File tree

6 files changed

+286
-0
lines changed

6 files changed

+286
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
## html
1515
*.html
1616

17+
*.pyc
18+
1719
## Intermediate documents:
1820
*.dvi
1921
*-converted-to.*

4.do.txt

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
========= Lecture 4: Reductions, Cook-Levin Theorem and NP-Completeness =========
3+
4+
The notes are mostly from Section 7.4, 7.5 in the Sipser book.
5+
6+
======= Polynomial Time Reductions =======
7+
8+
Last lecture, we showed that for some problems, the search problem can be solved in polytime,
9+
if the corresponding desciion problem can be solved in polytime. In this lecture,
10+
we will show that many desicion problems can be solved by solving one particular
11+
desciion problem called $3$-SAT.
12+
13+
For this we need first define a reduction. The following problems were defined previously
14+
o $3$-SAT = $\{ \phi : \phi \text{ is a 3CNF formula that is satisfiable} \}$.
15+
o CLIQUE = $\{ (G,k) : G \text{ has a clique of size } k \}.$
16+
17+
We will say that $f$ is a (poly time) reduction from $3$-SAT to CLIQUE, if it maps $3$-CNF formulas $\phi$
18+
to a tuple $(G,k)$ where $G$ is a graph and $k$ is a number such that
19+
o $f$ can be computed by a polynomial time TM.
20+
o $\phi$ is satisfiable if and only if $G$ has a $k$ clique.
21+
22+
If we have such an $f$, any polynomial time algorithm for CLIQUE can be used to
23+
design a polynomial time algorithm for $3$-SAT.
24+
25+
26+
Verify that: If we have such an $f$, give a polynomial time algorithm for $3$-SAT,
27+
assuming there is a polynomial time algorithm for CLIQUE.
28+
29+
30+
The algorithm for computing $f$ is as follows:
31+
o For every clause in $\phi$, put $3$ new verticies correponding to each literal in the clause.
32+
o Put all edges in the graph except:
33+
o between the 3 veritices correponding to the same clause.
34+
o $x_i$ an $\bar x_i$ for all $i$.
35+
o Set $k$ to be equal to the number of clauses.
36+
37+
38+
Verify the following:
39+
o $f$ is polynomial time.
40+
o Show that if $\phi$ is satisfiable $G$ has a $k$ CLIQUE.
41+
o Show that if $G$ has a $k$ CLIQUE then $\phi$ is satisfiable.
42+
43+
44+
Such a reduction says that CLIQUE is a harder problem than $3$-SAT, because an algo for
45+
CLIQUE gives an algo for $3$-SAT and we dont know if the reverse is True. Hence it is denote as
46+
$$ \text{CLIQUE} \geq_p 3\text{-SAT}.$$
47+
48+
49+
======= Cook-Levin Theorem =======
50+
The Cook-Levin Theorem tells that the reverse reduction also exists. In fact,
51+
it states that any language in NP can be reduced to SAT
52+
53+
__Cook-Levin Theorem.__
54+
For any language $L \in NP$, SAT $\geq_p $ L.
55+
56+
For doing this, for any language $L$, that has a nondeterministic polynomial time TM,
57+
we need to come up with a polynomial time reduction, which satisfies the conditions,
58+
given in the previous section.
59+
60+
61+
See Theorem 7.37 for the proof of Cook-Levin Theorem.
62+
63+
!bu-problem
64+
Show that $3$-SAT $\geq_p$ SAT.
65+
!eu-problem
66+
67+
======= NP Compeleness / Hardness =======
68+
69+
Vertex Cover 3SAT Reduction.
70+
71+
!bu-problem
72+
Solve Problem 7.21 in Sipser book
73+
!eu-problem
74+
75+
!bu-problem
76+
Solve Problem 7.23 in Sipser book
77+
!eu-problem
78+
79+
80+
!bu-problem
81+
Solve Problem 7.27 in Sipser book
82+
!eu-problem

5.do.txt

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
========= Lecture 5: More Time Complexity =========
3+
4+
======= NP-completeness of Vertex Cover and Subset Sum =======
5+
See Section 7.5 in Sipser 2nd Edition
6+
7+
======= EXP and Time Heirachy Theorem =======
8+
EXPTIME is the set of languages for which there is a poly time determinitic
9+
TM that runs in $2^{n^k}$ for some integer $k$.
10+
11+
Clearly $\text{P} \subseteq \text{NP} \subseteq \text{EXPTIME}$.
12+
13+
As we discussed, the question if P=NP or P $\subsetneq$ NP is an open problem.
14+
But what about P $\subsetneq$ EXP?
15+
16+
This is easy to prove using diagonalization. Let DTIME($f(n)$), be the
17+
set of languages that can be decided in time $f(n)$ by a determinitic TM.
18+
Note that P $\subseteq$ DTIME($2^n$). We will design a language that is
19+
different from all languages in DTIME($2^n$) by can be decided in EXPTIME.
20+
21+
We define the language by giving a TM $D$. $D$ takes encodings of TMs as
22+
input $\langle M \rangle$. D simulates M on $\langle M \rangle$ for $2^n$ steps.
23+
If M halts in $2^n$ steps, it gives the opposite answer. Otherwise it rejects.
24+
Due to
25+
the overheads involved in simulating a TM, the TM $D$ will take more time
26+
than $2^n$, however halts in less than $2^{n^2}$ steps. Hence the
27+
language decided by $D$ is in EXPTIME.
28+
29+
But can the language decided by $D$ be in DTIME($2^n$). That is their
30+
another TM $D'$ that decided this language in $2^n$ steps. If so
31+
what is the output of $D$ on the input $\langle D' \rangle$.
32+
33+
You can see that this results in a contradiction and hence the
34+
language decided by $D$ is not in P. So P $\subsetneq$ EXPTIME.
35+
36+
The question of whether NP = EXPTIME is again open.
37+
38+
======= coNP and Map of Complexity classes =======
39+
The complement of a language $L$ is
40+
$$ \bar L = \{ x : x \not in L \}.$$
41+
Let coNP $= \{ L : \bar L \in \text{NP} \}$.
42+
43+
Another way of defining coNP is: it is the set of languages $L$ for which
44+
there is a determinitic TM $M$ that takes 2 inputs $x,y$ such that
45+
o If $x \in L$ then for every $y$, $M(x,y)$ accepts.
46+
p If $x \notin L$ then there exist a $y$, for which $M(x,y)$ rejects.
47+
48+
!bu-problem
49+
Show that these two definitions gives the same set of languages.
50+
!eu-problem
51+
52+
coNP is a set of languages for which there is a certificate for non membership.
53+
Similar to NP-complete, we can define:
54+
$$\text{coNP-complete} = \{ L \in \text{coNP} : \forall L' \in \text{coNP}, L' \leq_p L \}$$
55+
56+
57+
!bu-problem
58+
Show that UNSAT = $\{ \phi : \phi \text{ is a boolean formula that is unsatisfiable} \}$,
59+
is coNP-complete
60+
(a formula is unstatisfiable when for all assignments to the variable, the formula evaluates to False).
61+
!eu-problem
62+
63+
Note that P = coP.
64+
65+
66+
Map of complexity classes
67+
68+
69+

6.do.txt

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
========= Lecture 5: Space Complexity =========
3+
4+
======= Space Complexity classes and some Relationships =======
5+
6+
Let SPACE$(f(n))$ be the set of languages that can be decided in space $f(n)$,
7+
then
8+
$$\text{TIME}(f(n)) \subseteq \text{SPACE}(f(n)) \subseteq \text{TIME}(2^{cf(n)}).$$
9+
10+
Let coSPACE$(f(n))$ be the complements of languages in SPACE$(f(n))$, then
11+
$$\text{coSPACE}(f(n)) = \text{SPACE}(f(n)).$$
12+
13+
Let L be the set of languages that can be decided in space $c\log n$ for some constant $c$,
14+
and PSPACE the set of languages that can be deciding in polynomial space. Then
15+
$$ \text{L} \subsetneq \text{PSPACE}.$$
16+
17+
18+
!bu-problem
19+
Show that
20+
o $\text{L} = \text{coL} \subseteq \text{P} \subset \text{PSPACE} \subseteq \text{EXPTIME}.$
21+
o $\text{L} \subsetneq \text{PSPACE}.$
22+
!eu-problem
23+
24+
25+
26+
======= Non Determinism and Space : NL-complete, Savith's Theorem =======
27+
28+
Just like we defined NP, we can define NL as the set of languages that
29+
is decided by a non deterministic log-space TM. Whether L = NL is again
30+
a well known open problem like P = NP. We can do reductions in NL.
31+
As we will see later $NL \subseteq P$. Therefore any two languages
32+
in NL are polynomial time reducible (in fact a polytime machine solve the problem
33+
itself). Hence for defining NL-complete langauges, we use log-space reductions
34+
that runs in $O(\log n)$ space (denoted by $\leq_l$). That is
35+
$$\text{NL-complete} = \{ R : R \text{ is a language such that for all other languages R' } \in L, R' \leq_l R \}.$$
36+
37+
!bu-problem
38+
Show that
39+
o $\text{REACHABILITY} \in \text{NL-complete}.$
40+
o $\text{NL} \subseteq \text{P}.$
41+
!eu-problem
42+
43+
Actually all languages is NL can be decided by a deterministic $O(\log^2 n)$ space TM.
44+
This theorm is known as Savitch's Theorem.
45+
46+
Savitch's theorem says that $\text{NPSPACE}(f(n)) \subseteq \text{SPACE}(f^2(n))$.
47+
See proof in proof of Theorem 8.5 in Sipser book.
48+
49+
50+
======= Overview of next part of course =======
51+
52+
Streaming algorithms for Well paranthesised expressions.
53+
Lowerbound using communication complexity.
54+
55+
56+
57+
======= Readings =======
58+
Chapter 8, Introduction to Theory of Computation by Micheal Sipser, Edition 2.
59+
60+
Chapter 4, Computational Complexity: A Modern Approach
61+
Sanjeev Arora and Boaz Barak
62+
http://theory.cs.princeton.edu/complexity/book.pdf
63+

7.do.txt

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
========= Lecture 5: Space Complexity =========
3+
4+
======= Space Complexity classes and some Relationships =======
5+
6+
Let SPACE$(f(n))$ be the set of languages that can be decided in space $f(n)$,
7+
then
8+
$$\text{TIME}(f(n)) \subseteq \text{SPACE}(f(n)) \subseteq \text{TIME}(2^{cf(n)}).$$
9+
10+
Let coSPACE$(f(n))$ be the complements of languages in SPACE$(f(n))$, then
11+
$$\text{coSPACE}(f(n)) = \text{SPACE}(f(n)).$$
12+
13+
Let L be the set of languages that can be decided in space $c\log n$ for some constant $c$,
14+
and PSPACE the set of languages that can be deciding in polynomial space. Then
15+
$$ \text{L} \subsetneq \text{PSPACE}.$$
16+
17+
18+
!bu-problem
19+
Show that
20+
o $\text{L} = \text{coL} \subseteq \text{P} \subset \text{PSPACE} \subseteq \text{EXPTIME}.$
21+
o $\text{L} \subsetneq \text{PSPACE}.$
22+
!eu-problem
23+
24+
25+
26+
======= Non Determinism and Space : NL-complete, Savith's Theorem =======
27+
28+
Just like we defined NP, we can define NL as the set of languages that
29+
is decided by a non deterministic log-space TM. Whether L = NL is again
30+
a well known open problem like P = NP. We can do reductions in NL.
31+
As we will see later $NL \subseteq P$. Therefore any two languages
32+
in NL are polynomial time reducible (in fact a polytime machine solve the problem
33+
itself). Hence for defining NL-complete langauges, we use log-space reductions
34+
that runs in $O(\log n)$ space (denoted by $\leq_l$). That is
35+
$$\text{NL-complete} = \{ R : R \text{ is a language such that for all other languages R' } \in L, R' \leq_l R \}.$$
36+
37+
!bu-problem
38+
Show that
39+
o $\text{REACHABILITY} \in \text{NL-complete}.$
40+
o $\text{NL} \subseteq \text{P}.$
41+
!eu-problem
42+
43+
Actually all languages is NL can be decided by a deterministic $O(\log^2 n)$ space TM.
44+
This theorm is known as Savitch's Theorem.
45+
46+
Savitch's theorem says that $\text{NPSPACE}(f(n)) \subseteq \text{SPACE}(f^2(n))$.
47+
See proof in proof of Theorem 8.5 in Sipser book.
48+
49+
50+
======= Immerman-Szelepcsenyi Theorem =======
51+
52+
In time complexity, we didnt have a proof of NP = coNP. This remains an open problem.
53+
However in space complexity, we know that NL = coNL. This theorem is known as the
54+
Immerman-Szelepcsenyi Theorem.
55+
See Section 8.6 in Sipser book.
56+
57+
58+
======= Readings =======
59+
Chapter 8, Introduction to Theory of Computation by Micheal Sipser, Edition 2.
60+
61+
Chapter 4, Computational Complexity: A Modern Approach
62+
Sanjeev Arora and Boaz Barak
63+
http://theory.cs.princeton.edu/complexity/book.pdf
64+

full.do.txt

+6
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ TOC: on
77
# #include "1.do.txt"
88
# #include "2.do.txt"
99
# #include "3.do.txt"
10+
# #include "4.do.txt"
11+
# #include "5.do.txt"
12+
# #include "6.do.txt"
13+
14+
15+

0 commit comments

Comments
 (0)