<p>From the question I assume you are talking about exact algorithms and not approximate ones. Since this is the case, you will have to "write" the entire input, using the same space as before, just using a different structure. Although this might provide a speedup in time, the space used will be at least the same, assuming that you use a reasonably efficient representation (e.g. not a unary one).</p>

<p>Using less tape is usually achieved by space re-use or by carefully selecting which cells to overwrite, so that you can use some information later on the computation. However usually you cannot re-use or overwrite the input, since you need it throughout the process of solving the problem.</p>

<p>Even if the above problems were dealt with, the usual model for space complexity has a separate input tape, which is read only and is not measured as used space , so we can have sublinear space complexities and avoid the problems above. Perhaps you are referring to a different model?</p>

CC BY-SA 2.5
2010-12-27T08:01:22.267Z
The input is read only, we don't have to "write" it, just read it, as is the usual case with sublinear space complexity classes. So this is the model I consider. Approximation does not make any sense, as this is a decision problem and not a parameter that we want to compute.
domotorp
CC BY-SA 2.5
2010-12-28T12:39:54.520Z
Since this problem is in NP, the search problem introduces at most a polynomial ( I think it is $O(n^{2})$ ) overhead. I was considering the search problem when talking about approx. Anyway, I still don't understand why we count the input as part of the space used.
chazisop
CC BY-SA 2.5
2010-12-27T07:42:27.787Z
2010-12-27T07:42:27.787Z
chazisop
<p>It seems to me that the problem can be solved in constant space.</p>

<p>We perform a recursive procedure, and store only the parity of the number of negation gates seen on the path from the root to the current node.</p>

<p>At a leaf, if we have a variable and have seen an even number of negation gates, we set the variable to be true. Otherwise, if we have seen an odd number of negation gates, we set the variable to be false.</p>

<p>As before, at an AND or OR gate we first call recusively to the left, and then to the right if the value has not been determined.</p>

<p>Now if there exists a satisfying assignment, then the assignment defined above will satisfy the formula.</p>

CC BY-SA 2.5
2010-12-28T14:53:07.363Z
Brilliant! My next question would be to find a language that separates deterministic and non-deterministic machines, my ultimate amibtious goal would be the following separation:
http://cstheory.stackexchange.com/questions/3963/does-loglog-nloglog
domotorp
CC BY-SA 2.5
2010-12-28T17:35:05.407Z
What a nice solution! I wish that *domotorp* had explained his question better though.
Dai Le
CC BY-SA 2.5
2010-12-28T14:30:41.017Z
2010-12-28T14:30:41.017Z
Kristoffer Arnsfelt Hansen
<p>Suppose that instead of the usual linear work tape the input is given in a binary tree structure with n leaves and log n depth, the initial position being the root. At every node, we can step to its parent, left child or right child.</p>

<p>I am interested in what "tree-languages" can be accepted by what machines. More specifically, take the language where in every non-leaf we have the gate of a boolean circuit (ie. and or not), in the leaves either a constant or a variable (different for each leaf) and such a "tree-word" is in the language if and only if it has a satisfying assignment. Can this language be decided by a turing machine that has an o(log n) space worktape?</p>

<p>Note that it is accepted by a non-deterministic finite state machine and also by a deterministic turing machine with O(log n) space. Similarly, if all the variables are constant, then it can be decided by a deterministic finite state machine. (If there are no constants, then every formula is satisfiable.)</p>

CC BY-SA 2.5
2010-12-27T14:16:46.177Z
Could you please elaborate a bit more why the language accepted by a non-deterministic finite state machine and by a deterministic turing machine with O(log n) space? Even when formulas are balanced, I believe the satisfiability problem for them is still complete for $\mathsf{NP}$.
Dai Le
CC BY-SA 2.5
2010-12-27T19:34:57.620Z
Because we can use that the input is not given on a linear tape, but rather on a tree-structure. Eg. if all the variables are constant, then the following deterministic approach works: Start from the leftmost leaf. Its output is 0 or 1. Suppose it is a 1. Go to the gate above it. If it is an OR gate, we already know it is true, we can go to the gate above. If it is an AND gate, then we have to go down to check the right child of the gate. In general, we only check the right child of the gate, if it is undecided by the left one. This way we never have to store any information.
domotorp
CC BY-SA 2.5
2010-12-27T21:38:25.697Z
@domotorp: Of course, the case of constant inputs is trivial. But you seem to claim that for the not all constant input case that you can still "accept" in deterministic $O(\log n)$. Maybe you meant *verifying* if a truth assignment is a satisfying one? The word "accept" is misleading to me. In any case, the problem of evaluating a *balanced* boolean formula on a given truth assignment is complete for $\mathsf{NC}^1$.
Dai Le
CC BY-SA 2.5
2010-12-28T03:21:22.967Z
I think Dai is right, and moreover evaluating a given balanced Boolean formula without variables (i.e. only using $\land, \lor, \lnot, \top, \bot$) is still $NC^1$-complete. This is true even for monotone case (i.e. without $\lnot$).
Kaveh
CC BY-SA 2.5
2010-12-28T07:49:02.577Z
@Dai Le and Kaveh: It seems we misunderstand each other. I only wrote down this case as the others are similar. If you want to accept in non-det constant space, you simply guess a satisfying evaluation and do as before. If you have a logspace turing machine, then you have to remember the possible left inputs (0, 1, or both) of each gate along the path that you walked down, this takes log n space (you could even use a stack machine). My evaluation problem is not NC^1-complete because the reading head can move on the given tree-structure of the input.
domotorp
CC BY-SA 2.5
2010-12-28T10:34:21.120Z
@Dai: Note that no variables are repeated.
Kristoffer Arnsfelt Hansen
<cc.complexity-theory><space-bounded><circuit-families><formulas>
Is the Balanced Boolean Formula problem solvable in sublogarithmic space if the input has a tree structure?
domotorp
# Is the Balanced Boolean Formula problem solvable in sublogarithmic space if the input has a tree structure?

(Asked by: username_0 on 2010-12-26)

Suppose that instead of the usual linear work tape the input is given in a binary tree structure with n leaves and log n depth, the initial position being the root. At every node, we can step to its parent, left child or right child.

I am interested in what "tree-languages" can be accepted by what machines. More specifically, take the language where in every non-leaf we have the gate of a boolean circuit (ie. and or not), in the leaves either a constant or a variable (different for each leaf) and such a "tree-word" is in the language if and only if it has a satisfying assignment. Can this language be decided by a turing machine that has an o(log n) space worktape?

Note that it is accepted by a non-deterministic finite state machine and also by a deterministic turing machine with O(log n) space. Similarly, if all the variables are constant, then it can be decided by a deterministic finite state machine. (If there are no constants, then every formula is satisfiable.)

**Tags:** cc.complexity-theory, space-bounded, circuit-families, formulas
> **Comments:**
> **username_1**: Could you please elaborate a bit more why the language accepted by a non-deterministic finite state machine and by a deterministic turing machine with O(log n) space? Even when formulas are balanced, I believe the satisfiability problem for them is still complete for $\mathsf{NP}$.  
> **username_0**: Because we can use that the input is not given on a linear tape, but rather on a tree-structure. Eg. if all the variables are constant, then the following deterministic approach works: Start from the leftmost leaf. Its output is 0 or 1. Suppose it is a 1. Go to the gate above it. If it is an OR gate, we already know it is true, we can go to the gate above. If it is an AND gate, then we have to go down to check the right child of the gate. In general, we only check the right child of the gate, if it is undecided by the left one. This way we never have to store any information.  
> **username_1**: @domotorp: Of course, the case of constant inputs is trivial. But you seem to claim that for the not all constant input case that you can still "accept" in deterministic $O(\log n)$. Maybe you meant *verifying* if a truth assignment is a satisfying one? The word "accept" is misleading to me. In any case, the problem of evaluating a *balanced* boolean formula on a given truth assignment is complete for $\mathsf{NC}^1$.  
> **username_2**: I think Dai is right, and moreover evaluating a given balanced Boolean formula without variables (i.e. only using $\land, \lor, \lnot, \top, \bot$) is still $NC^1$-complete. This is true even for monotone case (i.e. without $\lnot$).  
> **username_0**: @Dai Le and Kaveh: It seems we misunderstand each other. I only wrote down this case as the others are similar. If you want to accept in non-det constant space, you simply guess a satisfying evaluation and do as before. If you have a logspace turing machine, then you have to remember the possible left inputs (0, 1, or both) of each gate along the path that you walked down, this takes log n space (you could even use a stack machine). My evaluation problem is not NC^1-complete because the reading head can move on the given tree-structure of the input.  
> **username_3**: @Dai: Note that no variables are repeated.  

---

## 2 answers

### Answer by username_3 on 2010-12-28. Score: 7 | Accepted answer

It seems to me that the problem can be solved in constant space.

We perform a recursive procedure, and store only the parity of the number of negation gates seen on the path from the root to the current node.

At a leaf, if we have a variable and have seen an even number of negation gates, we set the variable to be true. Otherwise, if we have seen an odd number of negation gates, we set the variable to be false.

As before, at an AND or OR gate we first call recusively to the left, and then to the right if the value has not been determined.

Now if there exists a satisfying assignment, then the assignment defined above will satisfy the formula.

> **Comments:**
> **username_0**: Brilliant! My next question would be to find a language that separates deterministic and non-deterministic machines, my ultimate amibtious goal would be the following separation: http://cstheory.stackexchange.com/questions/3963/does-loglog-nloglog  
> **username_1**: What a nice solution! I wish that *domotorp* had explained his question better though.  

---

### Answer by username_4 on 2010-12-27. Score: -1

From the question I assume you are talking about exact algorithms and not approximate ones. Since this is the case, you will have to "write" the entire input, using the same space as before, just using a different structure. Although this might provide a speedup in time, the space used will be at least the same, assuming that you use a reasonably efficient representation (e.g. not a unary one).

Using less tape is usually achieved by space re-use or by carefully selecting which cells to overwrite, so that you can use some information later on the computation. However usually you cannot re-use or overwrite the input, since you need it throughout the process of solving the problem.

Even if the above problems were dealt with, the usual model for space complexity has a separate input tape, which is read only and is not measured as used space , so we can have sublinear space complexities and avoid the problems above. Perhaps you are referring to a different model?

> **Comments:**
> **username_0**: The input is read only, we don't have to "write" it, just read it, as is the usual case with sublinear space complexity classes. So this is the model I consider. Approximation does not make any sense, as this is a decision problem and not a parameter that we want to compute.  
> **username_4**: Since this problem is in NP, the search problem introduces at most a polynomial ( I think it is $O(n^{2})$ ) overhead. I was considering the search problem when talking about approx. Anyway, I still don't understand why we count the input as part of the space used.  

---

