3
$\begingroup$

I am aware of the complexity classes $P$, $NP$ and $L$. But I am not clear what $NL$ or Non-deterministic Log Space intuitively means. The part what I am unclear about is what is the meaning of Non-deterministic Space?

A Turing machine in a $L$ case would read an input, read/write on the work tape that is logarithmic in size, update its internal state, move the read write head on the work-tape and read head on the input tape. And at appropriate time it halts.

What does Non-determinism on work tape mean and how does the Turing Machine behave. I am totally lost on this one? An intuitive explanation would help.

$\endgroup$
6
$\begingroup$

Nondeterminism is not about tape or space. It is just a computational model.

One way of thinking of how a nondeterministic TM works is parallel computation. Given an input $x$, a nondeterministic TM may start many parallel (branches of) computation and wait for answers. If all branches terminate then the whole computation terminates. In addition if at least one of them terminates with YES then the TM accepts the input. In particular a nondeterministic TM may run exponentially many branches at the same time. However a deterministic TM is not allowed to run more than one process (branch) at the same, so less powerful in terms of time. But in terms of decidability they are equivalent.

For example consider 3SAT problem with variables $x_1, \dots, x_n$. Then on nondeterministic TM we can check all $2^n$ settings of the variables at the same time, while on a deterministic TM we will have to check each settings one by one in sequence.

NOTE: unlike a deterministic TM a nondeterministic TM is a hypothetical abstract model which is not something we use in our everyday life.

Definition of space complexity for nondeterministic Turing machines:

If $M$is a nondeterministic TM where all branches halt on all inputs then its space complexity is the maximum number of tape cells it scans on any branch of its computation.

In particular if a TM scans at most $O(log(n))$ working tape cells on every input of length $n$ then we say its space complexity is logarithmic. It also worth noting that requiring $O(log(n))$ space does not restrict running time. A TM may decide in exponential time but still use logarithmic space.

Typically, when dealing with sublinear, $log(n)$, space bounds we use Turing machines with two tapes: input read only tape, and working tape which contributes to space complexity.

Then formally $L = SPACE(log(n))$. $L$ is the class of languages that are decidable in logarithmic space on a deterministic TM. That means that a deterministic TM decides using no more than log space. If we switch from a deterministic TM to a nondeterministic TM then we have $NL = NSPACE(log(n))$, that is, the class of languages that are decidable in logarithmic space on a nondeterministic TM.

Thus, meaning, or more formally members, of $NL$ complexity class is all languages decidable:
1) on nondeterministic two tape TM
2) using at most $ O(log(n))$ space on work tape.

Example: the language of the problem deciding for a graph whether or not there is a simple path between nodes $s$ and $t$. This language is in $ NL$ class, but if it is in $L$ class is unknown.

$\endgroup$
  • $\begingroup$ Thanks. A deterministic TM would be able to use the complete log space as it has a single branch. Since a non deterministic TM has exponentially many branches but only log space (just like in deterministic case) as I understand, just like in NP machine(where we assume each branch can parallely guess and then verify an input) each branch has its own copy of the log space where it can guess and verify an input, it can use independent of other branches. correct? $\endgroup$ – J.Doe Jul 9 '17 at 12:33
  • 1
    $\begingroup$ Correct. I recommend also to look at examples of languages which belong to NL. For example a problem of deciding if a graph has a directed path from $s$ to $t$ is in NL but unknown if it is in L. $\endgroup$ – fade2black Jul 9 '17 at 12:51
  • 1
    $\begingroup$ If you had $2^n$ branches, each running in log space, would that be considered log space? $\endgroup$ – DanielV Jul 9 '17 at 20:54
  • 1
    $\begingroup$ @DanielV, yes that would. Please see update. $\endgroup$ – fade2black Jul 9 '17 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.