Complexity Theory
Theorem: dirPath is NL NL -complete
Let A∈
NL NL
, decided by c·log n space-bounded NTM M Input: w; output: dir.Graph G and vertices s,t such that:M accepts w ⇔ there is a path in G from s to t G=(V,E), V:=all configurations of M of size c·log |w|
(K1,K2)∈E :⇔ K2 is a successor config of K1
s:=start config of M on w; t:=accept.config (wlog unique)
• M accepts w ⇔ there is a path in G from s to t √
• How large is G? Constructible in logarithmic space?
qed
Complexity Theory
Immerman-Szelepcsényi
L = NL ? =
L = NL ? = coNL coNL ? ? = P ? = P ?
Compare „P P
vs.NP NP
“L L
vs.NL NL
:NL NL
-complete dirGraph, 2unSAT, nonBipartiteNL NL
vs.P P
:P P
-complete problems(probably do not admit an efficient parallelization)
NL NL
vs.coNL coNL
: solved in 1987, ACM Gödel Prize 1995 !Theorem (Neil Immerman,
Róbert Szelepcsényi):
NL NL
=coNL coNL
Proof: Show
dirGraph
∈coNL coNL
Theorem: For constructible s(n),
NSPACE
NSPACE(
s(n))
=coNSPACE( coNSPACE
s(n))
.Complexity Theory
Given G=(V,E), s,t∈V={1,…,m}. Goal:
Logspace NTM accepts iff t not reachable from s.
Ai := { v∈V : exists path in G of length ≤i from s to v }, ci := #Ai , i=0,…,m-1. A0={s}, c0=1. Accept iff t∉Am-1 Def: NTM computes (partial multivalued) f:⊆Σ*
⇉
Σ* iff• ∀ inputs x∈dom(f) there is an accepting computation.
• Every accepting computation outputs some y∈f(x).
FNL FNL
is closed under composition! (proof?) Lemma: For each i, Ai∈NL NL
.Given (!) ci, logspace NTM can even enumerate Ai:
• For each v∈V, ‘guess‘ whether v∈Ai (1) or not (0)
• If guessed 1: output, verify (
NL NL
) and increase counter• In the end, accept iff counter=c !!!
dirGraph ∈ coNL coNL
Complexity Theory
Given G=(V,E), s,t∈V={1,…,m}. Goal:
Logspace NTM accepts iff t not reachable from s.
Ai := { v∈V : exists path in G of length ≤i from s to v }, ci := #Ai , i=0,…,m-1. A0={s}, c0=1. Accept iff t∉Am-1
Lemma: For each i, Ai∈
NL NL
.Given (!) ci, logspace NTM can even enumerate Ai. Lemma: Given (!) ci, Ai+1∈
coNL coNL
:Enumerate Ai and, if no edge to v found, accept.
Lemma: Given ci, logspace NTM can compute ci+1:
For each v, ‘guess‘ whether v∈Ai+1 holds, and verify Proof (Theorem): 1=c0 → c1 → c2 → c3 → … → cm-1
dirGraph ∈ coNL coNL
Complexity Theory
NL NL and Parallel Computation
Every problem in NL NL can be solved in parallel time O(log²n) by polynomially many processors!
• dirPath ≼
L
Boolean Matrix powering:
– G=(V,E) → adjacency matrix A ∈ {0,1}
V×Vof G:
– A
u,v>0 : ⇔ v reachable from u in ≤ 1 step
– (A
k)
u,v>0 ⇔ v reachable from u ∈ V in ≤ k steps
• goal: (A
k)
s,tfor some k ≥ |V|=:n.
– rept.squaring: A → A
2→ A
4→ A
8→ …: O(log n)
– each phase = matrix multipl.; n
2dot products
– each dot product in parallel time O(log n)
Complexity Theory
More Parallel Algorithms
Prefix Sum: Given (x
1,…,x
n), calculate all sums
x
1, x
1+x
2, x
1+x
2+x
3, …, x
1+x
2+…+x
n-1, x
1+x
2+…+x
n-1+x
nin logarithmic parallel time?
lo g n
… …
√ √
for any associative operation ⊕
using O(n·log n) gates
Complexity Theory
'generate', 'propagate'