BU CS 332 – Theory of Computation
Lecture 22:
- NP‐Completeness Example
- Space Complexity
- Savitch’s Theorem
Reading: Sipser Ch 8.1‐8.2
Mark Bun April 22, 2020
BU CS 332 Theory of Computation Lecture 22: Reading: NP - - PowerPoint PPT Presentation
BU CS 332 Theory of Computation Lecture 22: Reading: NP Completeness Example Sipser Ch 8.1 8.2 Space Complexity Savitchs Theorem Mark Bun April 22, 2020 NP completeness Definition: A language is NP complete if 1)
Reading: Sipser Ch 8.1‐8.2
Mark Bun April 22, 2020
Definition: A language is NP‐complete if 1) and 2) Every language is poly‐time reducible to , i.e.,
is NP‐hard”) Theorem: If and
language , then is also NP‐complete
4/22/2020 CS332 ‐ Theory of Computation 2
Definition(s):
,
Ex.
clause contains exactly 3 literals Ex.
is NP‐complete
4/22/2020 CS332 ‐ Theory of Computation 3
4/22/2020 CS332 ‐ Theory of Computation 4
and 𝑊𝐹𝑆𝑈𝐹𝑌 𝐷𝑃𝑊𝐹𝑆 𝐽𝑂𝐸𝐹𝑄𝐹𝑂𝐸𝐹𝑂𝑈 𝑇𝐹𝑈
4/22/2020 CS332 ‐ Theory of Computation 5
4/22/2020 CS332 ‐ Theory of Computation 6
An independent set in an undirected graph 𝐻 is a set of vertices that includes at most one endpoint of every edge.
𝐽𝑂𝐸𝐹𝑄𝐹𝑂𝐸𝐹𝑂𝑈 𝑇𝐹𝑈
independent set
1) 2) Reduce
2. Output 𝐻, 𝑙 , where 𝑙 is the number of clauses in 𝜒.”
4/22/2020 CS332 ‐ Theory of Computation 7
4/22/2020 CS332 ‐ Theory of Computation 8
𝜒 𝑦 ∨ 𝑦 ∨ 𝑦 ∧ 𝑦 ∨ 𝑦 ∨ 𝑦 ∧ 𝑦 ∨ 𝑦 ∨ 𝑦
Let 𝑙 = # clauses and 𝑚 = # literals in 𝜒 Claim: 𝜒 is satisfiable iff 𝐻 has an ind. set of size 𝑙 ⟹ Given a satisfying assignment, select one literal from each
⟸ Let 𝑇 be an ind. set of size 𝑙
way
Runtime: 𝑃𝑙 𝑚 which is polynomial in input size
4/22/2020 CS332 ‐ Theory of Computation 9
4/22/2020 CS332 ‐ Theory of Computation 10
Many other resources of interest: Space (memory), randomness, parallel runtime / #processors, quantum entanglement, interaction, communication, …
4/22/2020 CS332 ‐ Theory of Computation 11
Space complexity of a TM (algorithm) = maximum number
Formally: Let . A TM runs in space if on every input
∗,
halts on using at most cells For nondeterministic machines: Let . An NTM runs in space if on every input
∗,
halts on using at most cells on every computational branch
4/22/2020 CS332 ‐ Theory of Computation 12
Let A language if there exists a basic single‐ tape (deterministic) TM that 1) Decides , and 2) Runs in space A language if there exists a single‐ tape nondeterministic TM that 1) Decides , and 2) Runs in space
4/22/2020 CS332 ‐ Theory of Computation 13
Theorem: Proof: The following deterministic TM decides using linear space On input where is a Boolean formula:
2. Evaluate
, accept. Else, reject.
4/22/2020 CS332 ‐ Theory of Computation 14
Theorem: Let
Then
Proof: The following NTM decides
in linear space
On input where is an NTM: 1. Place a marker on the start state of . 2. Repeat times where is the # of states of : 3. Nondeterministically select . 4. Adjust the markers to simulate all ways for to read 5. Accept if at any point none of the markers are on an accept
4/22/2020 CS332 ‐ Theory of Computation 15
4/22/2020 CS332 ‐ Theory of Computation 16
0,1 ε 2 3 1 1
4/22/2020 CS332 ‐ Theory of Computation 17
How about the opposite direction? Can low‐space algorithms be simulated by low‐time algorithms?
4/22/2020 CS332 ‐ Theory of Computation 18
4/22/2020 CS332 ‐ Theory of Computation 19
A configuration is a string where and
∗
(followed by blanks )
Accepting configuration: = Rejecting configuration: =
4/22/2020 CS332 ‐ Theory of Computation 20
Consider a TM with
How many configurations are possible when this TM is run on an input
when run on input it loops forever Corollary: A TM running in space also runs in time
4/22/2020 CS332 ‐ Theory of Computation 21
Theorem: Let be a function with . Then
CS332 ‐ Theory of Computation 22