 # 1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith.

## Presentation on theme: "1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith."— Presentation transcript:

1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith

2 Definition of L and NL  L is the class of languages that are decidable in logarithmic space on a deterministic TM. L=SPACE(logn) NL is the class of languages that are decidable in logarithmic space on a nondeterministic TM. NL=NSPACE(logn)

3 NL-Completeness  Analogous to the question of whether P=NP, we have the question of whether L=NL.  We can exhibit certain languages that are NL-complete.  NL-complete language is the one which is in NL and any other language in NL is reducible.

4 Reducing Problems We have seen that polynomial time reducibility is a very useful concept for classifying problems in NP. In particular, it allowed us to identify the class of the hardest problems in NP － NP complete problems  But we will see this concept is not suitable for classifying problems in NL  So we need a weaker version of reducibility……..

5 Log Space Reducibility  Log Space Transducer  A log space transducer is a TM with a read-only input tape a write-only output tape and a read/write work tape that may contain O(logn) symbols  A log space transducer M computes a function f:∑* → ∑* where f(w) is the string remaining on the output tape after M halts when it started with w on the input tape.  In this case f is said to be Log space computable function

6 Log Space Reduction  Definition: Language L1 is log space reducible to L2, denoted L1≤ L L2, if a log-space computation function f exists such that x∈L1 ⇔ f(x)∈L2  Recall that a TM that uses f(n) space runs in time. So a function computable in log space is computable in polynomial time,so L1≤ L L2 ⇒ L1≤ L2

7 Definition of PATH  PATH={ | G is a directed graph that has a directed path from s to t }  PATH ∈ NL  Proof Idea: we prove it by showing a nondeterministic log space algorithm for PATH  This TM starts at node s and nondeterministically guesses the steps of a path form s to t.  It records only the position of the current node at each step on the work tape, not entire path and nondeterministically selects the next node from among those pointed at by the current node.  Repeat this action until reaches node t and accepts, or until it has gone on for m steps and rejects.

8 Definition of NL-Completeness  Like the definition of NP-complete  A language B is NL-complete if 1. B ∈ NL, and 2. every A in NL is log space reducible to B

9 Theorem: PATH is NL-Complete  Proof Idea:  We have showed PATH is in NL, we only need to show PATH is NL-hard.  For any nondeterministic log-space machine, and any input w, construct, in log space, a graph G whose nodes are the possible configurations, and whose edges are the possible transitions.  Then the machine accepts w iff some path from the node corresponding to the start configuration leads to the node corresponding to the accepting configuration.

10 Definition of coNL  coNL is the class of all languages L such that belongs to NL.  Trivially, all deterministic complexity classes are closed under complementation. With nonderterministic complexity classes, the situation is complicated.  NL?=coNL

11 Theorem: NL=coNL  Proof Idea:  Exactly as for NP and coNP, we have: if L is NL complete then is coNL complete if a coNP complete problem belongs to NL then NL=coNL.  We already proves PATH is NL complete, so it suffices to show is in NL.  Must find a nondeterministic algorithm which uses log space, and which has an accepting computation whenever the input graph G does not contain a path from s to t.

12 Proof:

13

14 Construct M: Calculate c We’re going to do this inductively, Define A(i) = the collection of nodes reachable from s in i steps, c(i) = |A(i)|. Now the c we’re looking for is c(m) where m is the number of nodes in the graph Base case: A(0) = {s} and c(0) = 1.  For each node v in G  Go through all nodes and guess whether each node is in A(i)  For each u verified to be in A(i), test if (u, v) is an edge of G. If it is, v is in A(i+1) Count nodes number verified to be in A(i), computation branch rejects if is not c(i). Repeat until we get c(m) = |A(m)| v u A(i)

15 From c(i) to c(i+1) For every node v in G, Go through all the nodes of G and guess whether each one is in A(i). For each node u that is guessed to be in A(i), verify it by guessing a path from s to u in i steps. If the verification fails, reject that branch of the computation. Count all nodes verified to be in A(i). If the number counted is not c(i), which means not all of A(i) have been found, then reject this branch of the computation. Now we find all the nodes in A(i), count them, and check whether each on has an edge to v. We keep a running tally of the nodes in A(i) and compare each one with v as we go, deleting each one before writing the next, and somewhere keeping a number of how many of the nodes of G we’ve checked for membership in A(i).

16 How M runs after obtaining c? Is u verified reachable from s? Yes No Is u = t? reject Increase d, Go to next node Yes No Is d = c? Accept Reject Yes No

17 Construct M: Guess reachable nodes from s for each node u in G, M non-deterministically guesses if u is reachable from s. If it guesses it is, then it verifies by guessing a path of length m from s to u. If the verification fails, reject that computation branch. If, at any point, we guess that t is reachable from s, we reject. Keep counting how many nodes have been verified as d  – again, we have to delete them after checking them to avoid linear space. After checking and guessing all nodes of G, we compare d with c. If d is not equal to c, we did not guess all reachable nodes from s, so we reject this branch of computation. If d = c, and t has not been guessed, then we have guessed all the nodes reachable from s on the graph G, and t was not among them, so we accept.

18 Algorithm  On input  Let c(0) = 1  For I = 0 to m – 1: Let c(i+1)=0 Let d=0 For each node v in G:  For each node u in G Nondeterministically either perform or skip these steps:  Nondeterministically follow a path of length i from s and if none of the nodes encountered are u, reject.  Increment d  If (u, v) is an edge of G, increment c(i + 1). Repeat for next node v If d is not equal with c(i), reject  For each node u in G: Nondeterministically either perform or skip these steps:  Nondeternimistically follow a path of length m from s and if none of the nodes encountered are u, reject  If u = t, the reject  Increment d  If d is not equal with c(m), reject; otherwise, accept.

19 Space Complexity  At any time, this algorithm only needs to store c(i), d, i, m and a pointer to the head of a path.  It runs in log space. Conclusion: NL= coNL

20 Questions?

Download ppt "1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith."

Similar presentations