Introduction To Computational Complexity2

advertisement
Introduction To Computational
Compelxity
http://wisdom.weizmann.ac.il/~oded/teaching.html
(please join the google group!)
We will talk about P, NP, and completeness, what is an efficient algorithm?
Search Problems – A binary relation: 𝑅 ⊆ {0,1}∗ × {0,1}∗
(
⏟
π‘₯
,
𝑦
⏟
π‘π‘Ÿπ‘œπ‘π‘™π‘’π‘š π‘ π‘œπ‘™π‘’π‘‘π‘–π‘œπ‘›
“Given instance π‘₯, find a 𝑦 such that (π‘₯, 𝑦) ∈ 𝑅
Or say that none exist.
Natural Restrictions – The solution is not too long.
𝑅 is polynomially bounded.
TODO: Missing text! Fill in from analog notebook!
Topics that will be discussed
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Next lecture on 26/11
Join the Google group
Recalling last lecture
Poly-time
Reductions
Cook reductions
Karp & Levin-reductions
Self-reducibility
NP-Completeness
Self-Reducibility of NP-complete problems
𝑅 ⊆ {0,1}∗ × {0,1}
𝑅(𝑋) = {𝑦: (π‘₯, 𝑦) ∈ 𝑅}
𝑆𝑅 = {π‘₯: 𝑅(π‘₯) ≠ πœ™}
𝑃 = 𝑁𝑃 ↔ 𝑃𝐢(𝐹𝑁𝑃) ⊆ 𝑃𝐹(𝐹𝑃)
𝑆𝑅′ = {⟨π‘₯, 𝑦 ′ ⟩: ∃𝑦 ′′ 𝑠. 𝑑. (π‘₯, 𝑦 ′ , 𝑦 ′′ ) ∈ 𝑅}
)∈𝑅
Reduction of 𝐡 to 𝐴:
Any procedure that performs an efficient algorithm that solves 𝐴 to an efficient algorithm that
solves 𝐡.
Cook Reductions
A cook reduction from 𝐡 to 𝐴 –An efficient algorithm that solves 𝐡 using a black box for solving
𝐴. (Informal definition)
An oracle machine 𝑀 has oracle access to a function 𝑓.
Denoted: 𝑀 𝑓 .
Formal definition:
A polynomial time Turing machine 𝑀 𝐴 that solves 𝐡.
Clique
Clique= {⟨⟨𝐺, π‘˜⟩, 𝐢⟩||𝐢| ≥ π‘˜, 𝐢 𝑖𝑠 π‘Ž π‘π‘™π‘–π‘žπ‘’π‘’}
Given a graph 𝐺 = (𝑉, 𝐸) a clique 𝐢 is a subset of 𝑉 such that all vertices have edges between
each other.
INDEP-SET={⟨⟨𝐺, π‘˜⟩, 𝐼⟩||𝐼| ≥ π‘˜, 𝐼 𝑖𝑠 π‘Žπ‘› 𝑖𝑛𝑑𝑒𝑝𝑒𝑛𝑑𝑒𝑛𝑑 𝑠𝑒𝑑}
An independent set, is a subset of vertices such that no pair have an edge between them.
Karp Reductions
Given two sets 𝑆1 , 𝑆2 ⊆ {0,1}∗, a Karp reduction of 𝑆1 to 𝑆2 is a polynomial time computable
𝑓: {0,1}∗ → {0,1}∗ s.t. ∀π‘₯: π‘₯ ∈ 𝑆1 ↔ 𝑓(π‘₯) ∈ 𝑆2
Levin Reductions
Levin Reductio: 𝑅1 , 𝑅2 ⊆ {0,1}∗ × {0,1}∗.
A levin rediction of 𝑅1 to 𝑅2 is 𝑓: {0,1}∗ → {0,1}∗ , 𝑔: {0,1}∗ × {0,1}∗.
Such that
𝑅1 (π‘₯) ≠ πœ™ ↔ 𝑅2 (𝑓(π‘₯)) ≠ πœ™
𝑔(π‘₯, 𝑦) ∈ 𝑅1 (π‘₯) ↔ 𝑦 ∈ 𝑅2 (𝑓(π‘₯))
Self Reducibility
𝑅 ⊆ {0,1}∗ × {0,1}∗ is self reducible if 𝑅 is cook reducible to the corresponding decision
problem.
Example – SAT
𝑋1 , … , 𝑋𝑛 - Boolean variables
⊒,∧,∨ - operators
SAT = {(πœ™, π‘Ž)|πœ™(π‘Ž) = π‘‘π‘Ÿπ‘’π‘’} where a is an assignment for all variables.
CNF formulas are formula’s of the form:
𝐢1 ∧ 𝐢2 , … ,∧ πΆπ‘˜
𝐢𝑖 = (𝑙1 ∨ 𝑙2 ∨ … ∨ 𝑙𝑛 )
TODO: Write how to self-reduce SAT
NP Hardness
A decision problem 𝑆 ⊂ {0,1}∗ is NP-Hard iff every 𝑆 ′ ∈ 𝑁𝑃 reduces to it.
NP-Completeness: 𝑆 is NP-Complete if it is both in NP and it is NP-Hard.
Bounded-Halting
𝑆 ∈ 𝑁𝑃 ↔ ∃π‘π‘œπ‘™π‘¦π‘‘π‘–π‘šπ‘’ 𝑀 and π‘π‘œπ‘™π‘¦π‘›π‘œπ‘šπ‘–π‘Žπ‘™ 𝑝: β„• → β„•
𝑠 = {π‘₯|∃𝑦 ∈ {0,1}∗ , |𝑦| ≤ 𝑝(|π‘₯|), 𝑀(π‘₯, 𝑦) π‘Žπ‘π‘π‘’π‘π‘‘π‘ }
An instance of bounded halting could be a Turing machine 𝑀, a string π‘₯, and a string 1𝑑 .
Solution: 𝑦 𝑠. 𝑑. 𝑀 π‘Žπ‘π‘π‘’π‘π‘‘π‘  (π‘₯, 𝑦), |𝑦| ≤ 𝑑, in ≤ 𝑑 steps.
Reduction: π‘₯ → ⟨𝑀𝑆 , π‘₯, 1𝑑𝑠 (|π‘₯|+𝑃𝑆(|π‘₯|)) ⟩
Claim: ∀𝑅 𝑠. 𝑑. 𝑆𝑅 is NP-Complete, 𝑅 is cook-reducible to 𝑆𝑅′ .
Proof: 𝑅 cook reduces to 𝑆𝑅′ , 𝑆𝑅′ ∈ 𝑁𝑃 → 𝑆𝑅′ reduces to 𝑆𝑅 .
----- end of lesson 2
Theorem: There exists NP-Complete problems.
π‘…π‘ˆ = {(𝑀, π‘₯, 1𝑑 ), 𝑦|𝑀 π‘Žπ‘π‘π‘’π‘π‘‘π‘  (π‘₯, 𝑦) 𝑖𝑛 π‘Žπ‘‘ π‘šπ‘œπ‘ π‘‘ 𝑑 𝑠𝑑𝑒𝑝𝑠, |𝑦| ≤ 𝑑} ∈ 𝑃𝐢
𝑑 < |(𝑀, π‘₯, 1𝑑 )|
𝑆𝑒 = {(π‘š,
⏟ π‘₯, 1𝑑 ) |∃𝑦 (π‘₯Μ… , 𝑦) ∈ 𝑅𝑒 } ∈ 𝑁𝑃
π‘₯Μ…
Let 𝑅 ∈ 𝑃𝐢 → 𝑆𝑅
Let
𝑃𝑅 - polynomially bound solution length
𝑀𝑅 - Recognizing machine
𝑑𝑅 - Polynomially bounded number true of 𝑀𝑅
βˆ†
π‘₯ → 𝑓𝑅 (π‘₯) = (𝑀𝑅 , π‘₯, 1𝑑𝑅(|π‘₯|←𝑃𝑅(|π‘₯|))
We shall prove: ∀(π‘₯, 𝑦) ∈ 𝑅 ⇔ (𝑓𝑅 (π‘₯), 𝑦) ∈ 𝑅𝑒
Proposition 1: CSAT is NP-Complete.
βˆ†
∀𝑅 ∈ 𝑃𝐢 ∃Levin Reduction of 𝑅 to 𝑅𝐢𝑆𝐴𝑇 = {(𝐢, 𝑦)|𝐢(𝑦) = 1}
Proposition 2: If 𝑅1 is PC-Complete and 𝑅1 Levin Reduces to 𝑅2 ∈ 𝑃𝐢, then 𝑅2 is NP-Complete.
By the first part of the condition: 𝑃𝐢 ∝ 𝑅1 ∝ 𝑅2 , ∀𝑅 ∈ 𝑃𝐢
Proposition 3:
(1) 𝑅𝑆𝐴𝑇 is in PC
(2) 𝑅𝐢𝐴𝑆𝑇 ∝ 𝑅𝑆𝐴𝑇
Proof of proposition 1:
𝑅 ∈ 𝑃𝐢 → 𝑃𝑅 , 𝑀𝑅 , 𝑑𝑅
π‘₯ → 𝐢π‘₯
(𝐢π‘₯ , 𝑦) ∈ 𝑅𝐢𝑆𝐴𝑇
∀π‘₯, 𝑦 (π‘₯, 𝑦) ∈ 𝑅 ⇔ ⏟
𝐢π‘₯ (𝑦)=1
Just as a mental thought, consider the computation of 𝑀𝑅 (π‘₯, 𝑦) up to 𝑑𝑅 (|π‘₯| + 𝑝𝑅 (π‘₯)) steps
TODO: draw drawing…
βˆ†
𝑅𝑆𝐴𝑇 = {(πœ‘, 𝜏)|πœ‘(𝜏) = 1}
𝑅𝐢𝑆𝐴𝑇 ∝ 𝑅𝑆𝐴𝑇
Promise Problems
Promise is easy to verify.
Promise = set of instances.
1. Make invalid instances easy to solve by introducing a trivial solution.
2. Map it to an arbitrary valid instance
βˆ†
𝑅𝑆𝐴𝑇 = {(πœ‘, 𝜏)|πœ‘(𝜏) = 1}
𝑅 ∈ 𝑃𝐢,
𝑆𝑅
Candid search problem of 𝑅:
Promise: Instance π‘₯ ∈ 𝑆𝑅
Task: Find 𝑦 ∈ 𝑅(π‘₯) ≠ 0
Theorem: For every 𝑅 ∈ 𝑃𝐢, ∃polynomial 𝑝 and an algorithm 𝐴0 that solves the candid search
problem or 𝑅 such that ∀ algorithm 𝐴 that solves the candid search problem of 𝑅
∀π‘₯ 𝑑𝐴0 (π‘₯) = 𝑂̃(𝑑𝐴 (π‘₯) + 𝑝(|π‘₯|))
For every 𝑗 = 1 …
For every 𝑖 = 1, … , √2𝑗
𝑗
Enumerate the I’th machine for at most [2 ⁄(𝑖
+ 1)2 ]
Suppose 𝐴 solves the candid search problem in time 𝑇(𝐴)
βˆ†
Let 𝑖𝐴 = 𝑖𝑛𝑑𝑒π‘₯ π‘œπ‘“ 𝐴 𝑖𝑛 π‘‘β„Žπ‘’ π‘’π‘›π‘’π‘šπ‘’π‘Ÿπ‘Žπ‘‘π‘–π‘œπ‘› ≈ 2|𝐴|
1
(𝑖𝐴 + 1)2
The𝑂̃ hides a constant that depends on 𝐴! And probably exponential of 𝐴.
----- End of lesson 3
Circuit Complexity
∗
∗
Infinite family of circuits {𝐢𝑛 }∞
𝑛=1 computes 𝑓: {0,1} → {0,1}
If ∀π‘₯ it holds that 𝐢|π‘₯| (π‘₯) = 𝑓(π‘₯)
{𝐢𝑛 }∞
𝑛=1 has size 𝑆(𝑛) ⇔ ∀𝑛. |𝐢𝑛 | ≤ 𝑆(𝑛)
We want to prove: 𝑁𝑃 ⊈ 𝑃⁄π‘ƒπ‘œπ‘™π‘¦
Prove that 𝑃⁄π‘ƒπ‘œπ‘™π‘¦ can even solve undecidable problems.
𝑆 ′ = {1𝑛 |π΅π‘–π‘›π‘Žπ‘Ÿπ‘¦ 𝑒π‘₯π‘π‘Žπ‘›π‘ π‘–π‘œπ‘› π‘œπ‘“ 𝑛 𝑖𝑠 𝑖𝑛 𝑆}
{𝐢𝑛 }∞
𝑛=1
Just build the infinite series that for every 1𝑛 in 𝑆 returns one and otherwise returns 0.
∗
Turing machine 𝑀 that takes advice {π‘Žπ‘› }∞
𝑛=1 ⊆ {0,1} computes 𝑓 if ∀π‘₯ it holds that
𝑀(π‘₯, π‘Ž|π‘₯| ) = 𝑓(π‘₯) Advice length 𝑙(𝑛) if ∀𝑛 |π‘Žπ‘› | ≤ 𝑙(𝑛)
𝑃⁄
π‘ƒπ‘œπ‘™π‘¦ – 𝑆 that are decided by a circuit family of polynomial size.
Claim: 𝑃⁄π‘ƒπ‘œπ‘™π‘¦ that are decided by poly-time machines that take advice of polynomial length.
𝑆 has poly-size family {𝐢𝑛 }𝑛
Advice {𝐢𝑛 }𝑛
And the machine would be:
𝑀(π‘₯, 𝐢|π‘₯| ) = 𝐢|π‘₯| (π‘₯)
Suppose 𝑆 has poly-time 𝑀 that takes poly-length {π‘Žπ‘› }𝑛
{𝐷𝑛 } 𝐷𝑛 (𝑦) = 𝑀(𝑦)
{𝐢𝑛 }𝑛 𝐢𝑛 (π‘₯) = 𝐷(|π‘₯| +|π‘Ž ) (π‘₯, π‘Ž|π‘₯| )
|π‘₯|
{𝐢𝑛 }∞
𝑛=1 is uniform, if ∃𝑀 that on input 𝑛 outputs 𝑐𝑛 in time polynomial in the size of 𝑐𝑛 .
Describe 𝑃⁄𝑙 - a class of Turing machines that take advice of length 𝑙.
∀𝑆 ⊆ {0,1}∗
Denote 𝑆 = {0,1}∗ \𝑆
∀𝐢 (complexity class), denote by π‘π‘œπΆ the class of complementary set:
π‘π‘œπΆ = {𝑆̅|𝑆 ∈ 𝐢}
𝑆 ∈ Σ2 ⇔ ∃poly time 𝑉 such that 𝑆 = {π‘₯|∃𝑦1 ∀𝑦2 𝑣(π‘₯, 𝑦, 𝑦2 ) π‘Žπ‘π‘π‘’π‘π‘‘π‘ }
𝑆 ∈ Π2 ⇔ ∃poly time 𝑉 such that 𝑆 = {π‘₯|∀𝑦1 ∃𝑦2 𝑣(π‘₯, 𝑦, 𝑦2 ) π‘Žπ‘π‘π‘’π‘π‘‘π‘ }
𝑠 ∈ Σπ‘˜ ⇔ ∃poly time 𝑣 such that 𝑆 = {π‘₯|∃𝑦1 ∀𝑦2 … π‘„π‘˜ π‘¦π‘˜ 𝑣(π‘₯, 𝑦1 , … , π‘¦π‘˜ )}
𝑠 ∈ Ππ‘˜ ⇔ ∃poly time 𝑣 such that 𝑆 = {π‘₯|∀𝑦1 ∃𝑦2 … π‘„π‘˜ π‘¦π‘˜ 𝑣(π‘₯, 𝑦1 , … , π‘¦π‘˜ )}
𝑃 = Σ0 = Π0
𝑁𝑃 = Σ1
π‘π‘œπ‘π‘ƒ = Π1
Ππ‘˜ = π‘π‘œΣπ‘˜
Conjecture:
∀π‘˜ Σπ‘˜ ⊊ Σπ‘˜+1
∀π‘˜ Ππ‘˜ ⊊ Σπ‘˜+1
PH = ∪π‘˜ Σπ‘˜ =∪π‘˜ Ππ‘˜
Σπ‘˜ -Complete Problem:
Given πœ‘π‘¦1 , … , π‘¦π‘˜
Σπ‘˜ − 𝑆𝐴𝑇 − ∃𝑦1 ∀𝑦2 … π‘„π‘˜ π‘¦π‘˜ πœ‘(𝑦1 , … , π‘¦π‘˜ ) = 1
𝑆 ∈ Σπ‘˜+1 ⇔ ∃𝑆 ′ ∈ Ππ‘˜ 𝑆 = {π‘₯|∃𝑦(π‘₯, 𝑦) ∈ 𝑆}
Σπ‘˜ = Ππ‘˜ ⇒ ∀π‘˜ ′ ≥ π‘˜Σπ‘˜ ′ = Σπ‘˜ ′ +1
𝑆 ∈ 𝑁𝑃𝑐
∃poly time 𝑣 ∃𝑆 ′ ∈ 𝐢 such that
′
𝑆 = {π‘₯|∃𝑦𝑣 𝑆 (π‘₯, 𝑦) π‘Žπ‘π‘π‘’π‘π‘‘π‘ }
Σπ‘˜+1 = 𝑁𝑃Σπ‘˜ = 𝑁𝑃Ππ‘˜
Karp-Lipton Theorem
Under the assumption that Σ2 ≠ Π2 ⇒ 𝑁𝑃 ⊈ 𝑃⁄π‘ƒπ‘œπ‘™π‘¦
We will prove the other way: 𝑁𝑃 ⊆ 𝑃⁄π‘ƒπ‘œπ‘™π‘¦ ⇒ Σ2 = Π2
Suppose 𝑁𝑃 ⊆ 𝑃⁄π‘ƒπ‘œπ‘™π‘¦
Take Π2 − 𝑆𝐴𝑇 = {πœ‘|∀𝑦1 ∃𝑦2 πœ‘(𝑦1 , 𝑦2 ) = 1}
∃𝑉 ′ Π2 − 𝑆𝐴𝑇 = {πœ‘|∃𝑦1′ ∀𝑦2′ 𝑉 ′ (πœ‘, 𝑦1′ , 𝑦2′ )}
𝑆 = {⟨πœ‘, 𝑦1 ⟩|∃𝑦2 πœ‘(𝑦1 , 𝑦2 )}
𝑆 ∈ 𝑁𝑃 ⇒ 𝑆 ∈ 𝑃⁄π‘ƒπ‘œπ‘™π‘¦ ⇒ {𝐢𝑛 }∞
𝑛−1 decides 𝑆.
Π2 − 𝑆𝐴𝑇 = {πœ‘|∀𝑦1 𝐢𝑛 (πœ‘, 𝑦1 ) = 1}
A second attempt:
Π2 − 𝑆𝐴𝑇 = {πœ‘|∃𝐢∀𝑦1 𝐢(πœ‘, 𝑦1 ) = 1}
But this is not true since can get any circuit.
We know 𝑆𝐴𝑇 ∈ 𝑁𝑃 ⇒ 𝑆𝐴𝑇 ∈ 𝑃⁄π‘ƒπ‘œπ‘™π‘¦ ⇒ {𝐷𝑛 }𝑛 deciding 𝑆𝐴𝑇.
Denote {𝐷𝑛′ } find satisfying assignments to 𝑆𝐴𝑇 or output ⊥(since 𝑆𝐴𝑇 is self reducible).
So now:
Π2 − 𝑆𝐴𝑇 = {πœ‘|∃𝐷′ ∀𝑦, 𝐷 ′ (πœ‘π‘Œ1 =𝑦1 ) = 𝑦2 ∧ πœ‘(𝑦1 , 𝑦2 ) = 1}
⇔ 𝑣 ′ (πœ‘, 𝐷 ′ , 𝑦1 ) = 1
Π2 − 𝑆𝐴𝑇 = {πœ‘|∃𝐷′ ∀𝑦1 . 𝑣 ′ (πœ‘, 𝐷 ′ , 𝑦1 ) π‘Žπ‘π‘π‘π‘’π‘‘π‘ }
---- end of lesson 4
π·π‘‡π‘–π‘šπ‘’(𝑑) - Class of sets decidable in 𝑑 steps by a 2-tape TM
Is π·π‘‡π‘–π‘šπ‘’(𝑛) ⊊ π·π‘‡π‘–π‘šπ‘’(2𝑛 )?
Is π·π‘‡π‘–π‘šπ‘’(𝑑) ⊊ π·π‘‡π‘–π‘šπ‘’(2𝑑 ) for ∀𝑑: β„• → β„•?
For a nice 𝑑 (nice will be defined soon): π·π‘‡π‘–π‘šπ‘’(𝑑) ⊊ π·π‘‡π‘–π‘šπ‘’(𝑂(𝑑 log 𝑑))
A function 𝑑: β„• → β„• is time-constructible, if it can be computed in time 𝑑.
For circuits all functions are nice.
Time Hierarchy Theorem
∀ Time constructible 𝑑: β„• → β„•, π·π‘‡π‘–π‘šπ‘’(𝑑) ⊊ π·π‘‡π‘–π‘šπ‘’(𝑑 βˆ™ log 𝑑)
We will prove a weaker version: π·π‘‡π‘–π‘šπ‘’(𝑑) ⊊ π·π‘‡π‘–π‘šπ‘’(𝑛 βˆ™ 𝑑 βˆ™ log 𝑑)
Proof:
Denote 𝑋𝑀 - Description of 𝑀
𝑆 = {𝑋𝑀 |𝑀(𝑋𝑀 ) π‘Ÿπ‘’π‘—π‘’π‘π‘‘π‘  𝑖𝑛 t(|X M |) steps}
Suppose 𝑆 is decided by machine 𝑀 in time 𝑑.
What is the result of invoking 𝑀(𝑋𝑀 )?
If 𝑀(𝑋𝑀 ) accepts ⇒ 𝑋𝑀 ∉ 𝑆
If 𝑀(𝑋𝑀 ) rejects ⇒ 𝑋𝑀 ∈ 𝑆
A general fact: The universal machine can simulate a machine M for 𝑑 steps in time
𝑂(𝑋𝑀 βˆ™ 𝑑 βˆ™ log 𝑑)
Time Gap Theorem
For every computable non-decreasing 𝑔: β„• → β„• there exists a computable non decreasing and
non-time constructible 𝑑: β„• → β„• such that π·π‘‡π‘–π‘šπ‘’(𝑑) = π·π‘‡π‘–π‘šπ‘’(𝑔(𝑑))
We can choose 𝑔 to be 𝑔(𝑑) = 2𝑑
Fix 𝑔, Let 𝑀1 , 𝑀2 , … be all Turing Machines
𝑑𝑖 (𝑛) - the time bound of 𝑀𝑖 on inputs of length 𝑛.
𝑑(𝑛) =
max
{𝑑𝑖 (𝑛), 𝑑(𝑛 − 1)} + 1
1≤i≤n,ti (n)≠∞
Let 𝑆 ∈ π·π‘‡π‘–π‘šπ‘’(𝑔(𝑑)), so 𝑆 is decided by some 𝑀𝑖 in time 𝑔(𝑑)
∀𝑛 ≥ 𝑖, it holds that 𝑑(𝑛) > 𝑑𝑖 (𝑛)
So ∀(𝑛 ≥ 𝑖), 𝑀 decides 𝑆 in time 𝑑.
∃𝑀 that decides 𝑆 in time 𝑑 for ∀n
Oded steps in:
There exists a problem 𝑆.
∀ algorithm that solves 𝑆, there exists an algorithm that solves 𝑆 much faster
π‘€π‘Žπ‘₯πΆπ‘™π‘–π‘žπ‘’π‘’(𝐺, π‘˜) = is maximum clique size π‘˜?
is maximum clique size ≥ π‘˜ is 𝑁𝑃 complete!
Is maximum clique size ≤ π‘˜ is π‘π‘œ − 𝑁𝑃 complete!
Space Complexity
Space complexity ~ the number of cells of work device visited during computation.
But since you can increase the alphabeit, we usually multiply it by log 2|Σ| (and we denote it as
binary space).
We also add log 2|𝑄| but this is just a constant…
Focus: Log-Space
Question: What’s the smallest amount of space that is more powerful then constant space?
There is a set: 𝑆 = {π‘€π‘˜ |π‘˜ ∈ β„•} π‘€π‘˜ = 2π‘˜ strings of length π‘˜ 𝑀1 = 0 ∗ 1 𝑀2 = 00 ∗ 01 ∗ 10 ∗ 11
The machine only needs log π‘˜ to check the input is of the form. But π‘˜ = log 𝑛. So the machine
needs log log π‘˜. Also it checks whether the given string is of the right form and if not is uses only
log log π‘˜ space as well.
Time VS Space
In time, if you have a reduction, you can simply execute the reduction, then execute the second
function on the reduction. However, when we’re talking about space, we need to store the
damn thing somewhere.
However, we can recycle space!!
A non obvious ideal:
TODO: A lot of drawings. Baaahhhh…
A connection between space and time:
π·π‘†π‘π‘Žπ‘π‘’(𝑠) ⊆ π·π‘‡π‘–π‘šπ‘’(𝑛 βˆ™ 2𝑠(𝑛) )
Corollary: Define 𝐿 as what can be done in log space – 𝐿 ⊆ 𝑃
Theorem: For any algorithm 𝐴 that halts on each input, it’s time complexity is at most 𝑛 βˆ™
2𝑠(𝑛)+log 𝑛+log 𝑠(𝑛)
Proof: Fix π‘₯, What is needed to store for the configuration?
𝑠(𝑛) + log 𝑛 + log 𝑠(𝑛)
--- End of lesson 5
Theorem: CircuitEval is P-Complete.
Proof: 𝑆 ∈ 𝑃 → 𝑀𝑠 , 𝑑𝑠
Draw Pseudo Cook reduction for circuits
𝑖𝑛 log π‘ π‘π‘Žπ‘π‘’
Reduct: π‘₯ →
π‘π‘œπ‘™π‘¦ π‘‘π‘–π‘šπ‘’
{𝐢𝑛 }𝑛∈β„• 𝑛 →
(𝐢|π‘₯| , π‘₯)
𝐢𝑛
∀𝑆 ∈ 𝑃 ∃ Uniform family of poly-size circuits.
NSpace VS NP
𝑆 ∈ 𝑁𝑃 ⇔ ∃polynomial 𝑝 and ∃ poly-time algorithm 𝐴 such that
∀π‘₯ ∈ 𝑆 ⇔ ∃𝑦 ∈ {0,1}𝑃(π‘₯) 𝐴(π‘₯, 𝑦) = 1
𝐴 runs in time polynomial in |π‘₯|
𝑆 ∈ π‘π‘†π‘π‘Žπ‘π‘’[π‘₯]
Basic model is: Main input π‘₯, aux. input, or “witness”/”proof” 𝑦.
Off-line model: free(read) access to 𝑦 or bidirectional access.
Are these walks (free read access) helpful?
They are very helpful at times.
For instance, look at the following language: 𝑆 = {π‘₯ ∗ π‘₯|π‘₯ ∈ {0,1}∗}
On-line model: There is a unidirectional access to 𝑦.
If we want it or not, this divides the world into two non-deterministic space groups:
π‘π‘†π‘π‘Žπ‘π‘’π‘‚πΉπΉ (𝑠) and π‘π‘†π‘π‘Žπ‘π‘’π‘‚π‘ (𝑠)
π‘π‘†π‘π‘Žπ‘π‘’π‘‚π‘ (𝑠) ⊆ π‘π‘†π‘π‘Žπ‘π‘’π‘‚πΉπΉ (𝑠)
∀𝑠 at least linear: π‘π‘†π‘π‘Žπ‘π‘’π‘‚π‘ (𝑠) = π‘π‘ π‘π‘Žπ‘π‘’π‘‚πΉπΉ (πœƒ(log 𝑠))
Theorem: π‘π‘†π‘π‘Žπ‘π‘’π‘‚π‘ (𝑠) ⊆ π·π‘‡π‘–π‘šπ‘’(2𝑠 βˆ™ 𝑠 βˆ™ 𝑛)
𝑑𝑒𝑓
𝑁𝐿 = π‘π‘†π‘π‘Žπ‘π‘’π‘‚π‘ (𝑂(log 𝑛)) ⊆ 𝑃
Directed Connectivity is 𝑁𝐿 complete.
Undirected Connectivity ∈ 𝐿!
π·πΆπ‘œπ‘›π‘› ≈ 𝑁𝐿
Input: Graph 𝐺 and pair or vertices 𝑠, 𝑑
Question: Is there a directed path between 𝑠 and 𝑑?
Theorem: 𝑠𝑑 − π‘π‘œπ‘›π‘› is NL-Complete (under log space reductions)
π‘™π‘œπ‘˜π‘” π‘ π‘π‘Žπ‘π‘’
∀𝑆 ∈ 𝑁𝐿,
𝑆→
𝑀 on-line log space
𝑆𝑇 − 𝐢𝑂𝑁𝑁
π‘₯ ∈ 𝑆 ⇒ ∃ computation of 𝑀(π‘₯) that accepts.
Theorem: 𝑁𝐿 ⊆ π·π‘†π‘π‘Žπ‘π‘’(log 2 𝑛)
Will show 𝑆𝑇 − 𝐢𝑂𝑁𝑁 ∈ π·π‘†π‘π‘Žπ‘π‘’(log 2 𝑛)
Input: Grah 𝐺, vertices 𝑠, 𝑑
Question: Is there a directed path from 𝑠 to 𝑑.
Length of the path is always smaller of equal to the number of vertices in the graph.
𝑑𝑒𝑓
πœ™πΊ (𝑒, 𝑣, 𝐿) = ∃ a path of length < 𝐿 from 𝑒 to 𝑣.
πœ‘πΊ (𝑒, 𝑣2𝑙) = ⋁ πœ™πΊ (𝑒, 𝑀, 𝑙) ∧ πœ™πΊ (𝑀, 𝑣, 𝑙)
𝑀
For every 𝑀 ∈ 𝑉
𝜎 ← πœ™πΊ (𝑒, 𝑀, 𝑙) - a recursive call
𝜎 ← 𝜎 ∧ πœ™πΊ (𝑀, 𝑣, 𝑙)
π‘†π‘π‘Žπ‘π‘’(2𝑙) = log|𝑉| + 1 + 𝑆𝑃𝐴𝐢𝐸(𝑙)
So we get that we can do it in log 2 𝑛
The general statement is: 𝑁𝑆𝑃𝐴𝐢𝐸(𝑠) ⊆ 𝑁𝑆𝑃𝐴𝐢𝐸(𝑠 2 )
𝑁𝐿 = π‘π‘œπ‘πΏ – {{0,1}∗ \𝑆|𝑆 ∈ 𝑁𝐿}
Equivalent: Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…
𝑆𝑇 − 𝐢𝑂𝑁𝑁 log space reduced to 𝑆𝑇 − 𝐢𝑂𝑁𝑁.
Notion: Non-Deterministically computing a function.
There exists an algorithm 𝐴 such that:
∀π‘₯:
1) ∀𝑦 𝐴(π‘₯, 𝑦) ∈ {𝑓(π‘₯), ⊥} - ⊥∉ {0,1}∗
2) ∃𝑦 𝐴(π‘₯, 𝑦) = 𝑓(π‘₯)
Property: 𝑁𝐿 = π‘π‘œπ‘πΏ iff ∀𝑆 ∈ 𝑁𝐿 such that πœ’π‘† is non-deterministically computable in log space.
Proof:
(1)
𝑁𝐿 = π‘π‘œπ‘πΏ → 𝑆 ∈ 𝑁𝐿 → 𝑅, π‘₯ ∈ 𝑆 𝑖𝑓𝑓 ∃𝑦. (π‘₯, 𝑦) ∈ 𝑅
𝑆̅ ∈ 𝑁𝐿 → 𝑅0 π‘₯ ∉ 𝑆 𝑖𝑓𝑓 ∃𝑦 (π‘₯, 𝑦) ∈ 𝑅
Algorithm (x,𝜎, πœ”)= if (π‘₯, πœ”) ∈ π‘…πœŽ then output 𝜎. Otherwise output ⊥.
(3) 𝐴 non-deterministically computes πœ’π‘† → 𝑆 ∈ 𝑁𝐿 ∩ π‘π‘œπ‘πΏ
Theorem: Log-Space is non-deterministically computing of πœ’π‘†π‘‡−𝐢𝑂𝑁𝑁
Reachability: Input is a directed graph 𝐺(𝑉, 𝐸) and a vertex 𝑆.
Output = the number of vertices reachable from 𝑆 in the graph 𝐺.
Log space reduction to counting the number of reachable vertices.
Fix 𝐺 and 𝑆. Also denote 𝑛 = |𝑉|.
𝑅𝑖 = {𝑣|∃ π‘‘π‘–π‘Ÿπ‘’π‘π‘‘π‘’π‘‘ π‘π‘Žπ‘‘β„Ž π‘œπ‘“ π‘™π‘’π‘›π‘”π‘‘β„Ž 𝑖 π‘“π‘Ÿπ‘œπ‘š 𝑠 π‘‘π‘œ 𝑣}
𝑅0 = {𝑆}
We want to know |𝑅𝑛 |
For 𝑖 = 1 to 𝑛 = |𝑁|
- Guess the size of 𝑅𝑖 , denote my guess by 𝑔.
- Verify that |𝑅𝑖 | ≥ 𝑔 - Loop all vertices and check that it is reachable by 𝑖 steps.
- Verify that |𝑅𝑖 | ≤ 𝑔 ⇔ |𝑉 − 𝑅𝑖 | ≥ 𝑛 − 𝑔 - “enumerate 𝑅𝑖−1 and for each 𝑀 in 𝑅𝑖−1
I verify the following – 𝑒 ≠ 𝑀 and that ⟨𝑒, 𝑒⟩ ∉ 𝐸
𝑁𝑃 ⊆ 𝑃𝑆𝑃𝐴𝐢𝐸,
π‘π‘œπ‘π‘ƒ ⊆ 𝑃𝑆𝑃𝐴𝐢𝐸
We also know 𝑃𝐻 ⊆ 𝑃𝑆𝑃𝐴𝐢𝐸
𝑆 ∈ Σπ‘˜ take the polytime V:
𝑆 = {π‘₯: ∃𝑦1 ∀𝑦2 … π‘„π‘˜ π‘¦π‘˜ 𝑉(π‘₯, 𝑦1 , … , π‘¦π‘˜ ) accepts}
𝑄𝐡𝐹 − quantified Boolean formula.
Input: 𝑄1 π‘₯1 𝑄2 π‘₯2 … π‘„π‘š π‘₯π‘š πœ‘(π‘₯1 , … , π‘₯π‘š )
Output: Yes ⇔ this is a true statement
Theorem: 𝑄𝐡𝐹is PSPACE-complete
Let 𝑆 ∈ 𝑃𝑆𝑃𝐴𝐢𝐸. Let 𝑀 be the machine that decides 𝑆. Let π‘₯ ∈ {0,1}𝑛
𝐺 = 𝐺𝑀,𝑋 - Configuration graph of 𝑀 on π‘₯.
πœ™πΊ (𝑒, 𝑣, 𝑙) – true ⇔ ∃ a path of length ≤ 𝑙 from 𝑒 to 𝑣.
𝐿 = 2⌈log2 |π‘‰πœ™ |⌉
𝑙
𝑙
πœ™πΊ = ∃𝑀 ∈ 𝑉𝐺 . πœ™ (𝑒, 𝑀, ) ∧ πœ™πΊ (𝑀, 𝑣, )
2
2
𝑙
πœ™(𝑒, 𝑣, 𝑙) = ∃𝑀 ∈ 𝑉𝐺 ∀(𝑒′ , 𝑣 ′ ) ∈ {(𝑒, 𝑀), (𝑀, 𝑣)}πœ™πΊ (𝑒′ , 𝑣 ′ , )
2
𝑙
∃𝑀 ∈ 𝑉𝐺 ∀𝑏 ∈ {0,1}∃𝑒′ 𝑣 ′ ∈ 𝑉𝐺 ∧ πœ™πΊ (𝑒′ , 𝑣 ′ , )
𝑠
[(𝑏 = 0) ∧ (𝑒′ = 𝑒) ∧ (𝑣 ′ = 𝑀) ∨ (𝑏 = 1) ∧ (𝑒′ = 𝑀) ∧ (𝑒′ = 𝑣]
Games
∃π‘₯1 ∀π‘₯2 … 𝑄𝑛 𝑋𝑛 πœ‘(π‘₯1 , … , π‘₯π‘š )
--- end of lesson
Standard random variables take real numbers. We will allow ourselves to do whatever we want.
π‘ˆπ‘› – The random variable that takes random strings of length 𝑛 and is uniform.
Δ(𝑋1 , 𝑋2 ) = max{Pr[𝑋1 ∈ 𝑆] − Pr[𝑋2 ∈ 𝑆]}
S
𝑋1 , 𝑋2 are independent iff ∀𝑋1 , 𝑋2 Pr[𝑋1 = π‘₯1 , 𝑋2 = π‘₯2 ] = Pr[𝑋1 = π‘₯1 ] βˆ™ Pr[𝑋2 = π‘₯2 ]
𝑋1 , … , 𝑋𝑛 are π‘˜-wise independent iff every π‘˜ variables of this set are independent.
If 𝑋1 , … , 𝑋𝑛 are pair-wise independent, then 𝑉[𝑋1 + β‹― + 𝑋𝑛 ] = 𝑉[𝑋1 ] + β‹― + 𝑉[𝑋2 ]
𝐸[𝑋 π‘˜ ] is called the π‘˜’th moment of 𝑋.
1
1000 𝑀. 𝑝. 2
𝑋={
1:
−1000 𝑀. 𝑝. 2
Markov Inequality: If 𝑋 is non-negative, then:
1
Pr[π‘₯ > π‘˜πΈ[π‘₯]] <
π‘˜
Or
𝐸[𝑋]
Pr[𝑋 > π‘˜] <
π‘˜
𝐸[𝑋] = ∑ π‘₯ βˆ™ Pr[𝑋 = π‘₯] > ∑ π‘˜ βˆ™ Pr[𝑋 = π‘₯] = π‘˜ βˆ™ Pr[π‘₯ > π‘˜]
π‘₯
π‘₯>π‘˜
Chebyshev Inequality
Pr[|𝑋 − 𝐸[𝑋]| > πœ–] ≤
𝑉[𝑋]
πœ–2
Proof: Pr[|𝑋 − 𝐸[𝑋]| > πœ–] = Pr[(𝑋 − 𝐸[𝑋])2 > πœ– 2 ]
𝐡𝑦 π‘€π‘Žπ‘Ÿπ‘˜π‘œπ‘£
≤
𝐸[(𝑋−𝐸[𝑋])2 ]
πœ–2
=
𝑉[𝑋]
πœ–2
𝑋1 , … , 𝑋𝑛 all have expectations πœ‡ and variance 𝜎 2
1
Pr [| ∑ 𝑋𝑖 − πœ‡| > πœ–] =?
𝑛
𝑖
If 𝑋1 , … , 𝑋𝑛 are pair-wise independent. Then:
1
𝜎
Pr [| ∑ 𝑋𝑖 − πœ‡| > πœ–] ≤ 2
𝑛
πœ– βˆ™π‘›
𝑖
1
1
1
Proof: The variables are pair-wise independent. Thus, 𝑉 [𝑛 ∑ 𝑋𝑖 ] = 𝑛2 ∑𝑖 𝑉[𝑋𝑖 ] = 𝑛2 βˆ™ 𝑛 βˆ™ 𝜎 2 =
Follows by chebyshev.
𝜎2
𝑛
Chernoff/Hoefding Inequality
Let 𝑋1 , … , 𝑋𝑛 totally independent all have expectation πœ‡ and take values in the segment [π‘Ž, 𝑏].
2
2πœ–
1
−
βˆ™π‘›
Pr [| ∑ 𝑋𝑖 − πœ‡| > πœ–] < 2𝑒 (𝑏−π‘Ž)2
𝑛
𝑖
Let 𝑓: {0,1}𝑛 → [0,1]. A (𝛿, πœ–)-sampler 𝐴 is a random algorithm that has a black-box access to 𝑓
and Pr[|𝐴 𝑓 − 𝐸[𝑓(π‘ˆπ‘› )]| > πœ–] < 𝛿
Sample Complexity – how many queries are made to 𝑓?
How many random bits are used.
Deterministic 2𝑛 samples, Randomness 0 samples.
Totally independent: π‘ž = log
1
𝛿
πœ–2
( )
Choose totally independent uniformly distributed 𝑋1 , … , π‘‹π‘ž ∈ {0,1}𝑛
For π‘ž ≈ log
1
𝑠
πœ–2
( )
1
and output π‘ž ∑𝑖 𝑓(𝑋𝑖 )
1
Just like before, but use pairwise independent samples: π‘ž = πœ–2 βˆ™π›Ώ
For the two-wise independent we will have
1
πœ– 2 βˆ™π›Ώ
but we will gain a lot in the randomness.
Let 𝑛 ∈ 𝑁, 𝑆 ⊆ {0,1}𝑛 |𝑆| β‰ͺ 2𝑛
Hash table of 2𝑛 entries.
Idenfity entries with {0,1}𝑛
Choose some function β„Ž: {0,1}𝑛 → {0,1}π‘š
Store π‘₯ ∈ 𝑆 in entry 𝑦 = β„Ž(π‘₯)
One way to do it is choose β„Ž to be a random function.
1
∀π‘₯1 , π‘₯2 ∈ {0,1}𝑛 Pr[β„Ž(π‘₯1 ) = β„Ž(π‘₯2 )] = 2π‘š
Really want: Efficiently computable β„Ž that informally “behaves like a random function”.
Pairwise independent hash functions.
𝑛
π»π‘š
- A family of functions from {0,1}𝑛 to {0,1}π‘š
𝑛
π»π‘š
is pair-wise independent if it satisfies the following:
∀π‘₯1 , π‘₯2 ∈ {0,1}𝑛 ,
∀𝑦1 , 𝑦2 ∈ {0,1}π‘š ,
Pr[β„Ž(π‘₯1 ) = 𝑦1 ∧ β„Ž(π‘₯2 ) = 𝑦2 ] =
1
(2π‘š )2
𝑛
𝑛
Can construct π»π‘š
such that each function in the family β„Ž ∈ π»π‘š
can be represented using 2𝑛 bits
and computed in time poly(n).
|𝑆|
𝐸[#π‘π‘œπ‘™π‘™π‘–π‘ π‘–π‘œπ‘›π‘ ] = ( ) βˆ™ 2−π‘š
2
π‘š ≈ log|𝑆|2
Construction: Suffices to construct 𝐻𝑛𝑛
Let 𝐹2𝑛 the finite field of size 2𝑛
It’s elements can be identified with strings of length 𝑛.
β„Ž = β„Žπ‘Ž,𝑏 ∀π‘₯ ∈ {0,1}𝑛 , β„Žπ‘Ž,𝑏 (π‘₯) = π‘Ž βˆ™ π‘₯ + 𝑏
π‘Ž, 𝑏 ∈ 𝐹2𝑛
Prove it is pairwise independent.
𝑆 ⊆ {0,1}𝑛 , 𝑦 ∈ {0,1}π‘š what is |β„Ž−1 (π‘₯) ∩ 𝑆|
|𝑆|
If β„Ž was totally random, expect 2π‘š
𝑅
𝑛
On the other hand, if β„Ž ∈ π»π‘š
: Pr [|β„Ž−1 (𝑦) ∩ 𝑆| ∈ [(1 − πœ–)
𝐸[𝑋𝑖 ] =
1
,
2π‘š
|𝑆|
2π‘š
, (1 + πœ–)
|𝑆|
2π‘š
1
2π‘š
𝑉[𝑋𝑖 ] = 𝐸[𝑋𝑖2 ] − (𝐸[𝑋𝑖 ]2 ) ≤
Let 𝑆 = {π‘₯1 , … , π‘₯|𝑆| }
𝑋𝑖 - Random Variable that is 1 if β„Ž(π‘₯𝑖 ) = 𝑦 and 0 otherwise.
1
|𝑆|
|𝑆|
∑ 𝑋𝑖
1
1
2π‘š
π‘š
2
Pr [|∑ 𝑋𝑖 − π‘š | > πœ– βˆ™ π‘š ] ≤ Pr [|
− π‘š| > πœ– βˆ™ π‘š] ≤ πœ–
= 2
|𝑆| 2
2
2
2
|𝑆| πœ– βˆ™ |𝑆|
2π‘š βˆ™
Mixing: ∀𝑆 ⊆ {0,1}𝑛 , 𝑇 ⊆ {0,1}π‘š
Pr [|β„Ž−1 (𝑇) ∩ 𝑆| ∈ [(1 − πœ–)
|𝑆|βˆ™|𝑇|
2π‘š
, (1 + πœ–)
2π‘š
|𝑆|βˆ™|𝑇|
2π‘š
]] ≥ 1 − πœ–2 βˆ™|𝑆|βˆ™|𝑇|
Another property:
𝑅
3
1
𝑛
Leftover hash lemma: ∀𝑆 ⊆ {0,1}𝑛 , β„Ž ∈ π»π‘š
, πœ– = √2π‘š
∀𝛼 ∈ (0,1),
Pr [Δ(β„Ž(π‘ˆπ‘› ), π‘ˆπ‘š ) ≤
2βˆ™πœ–
]≥ 1−𝛼
𝛼
2π‘š
]] > 1 − πœ–2 |𝑆|
Download