These problems all concern complexity measures and complexity classes. Question text is in black, answers in blue.
The set of strings is r.e. because we can design a TM that semi-decides it.
That is, on input w it will output "yes" if w is in the set, and never halt
if it is not. Assuming that the original Γ is r.e., this machine can
both search for w being in the original Γ and (in parallel) run the
Augment procedure repeatedly until or unless w shows up as one of the augmented
strings.
Sorry, this question was not well-drafted at all, and I will take that
fact into consideration when I grade your answers.
I should have been more specific about initializing Γ, for one thing.
If the original Γ is recursive and Augment has the property that
its added strings keep getting longer, than the given language is
recursive.
The question about "why isn't this a counterexample to Godel" is also
vague. Of course there can't be a counterexample to Godel because Godel
is true. The point I was trying to get at was that even if you apply
Augment infinitely many times to add infinitely many strings, you can't have
gotten all the true but unprovable strings because one could apply the proof
of Godel to the r.e. set of strings provable from the original axioms or
from the new statements added by Augment.
By the well-known Path-Matrix Theorem, if A is the adjacency matrix of a
directed graph, there exists a path from s to t iff the s-t entry of the
matrix (A+I)n-1 is 1, where n is the number of vertices in the
graph and the powering is done with boolean matrix multiplication.
Given a graph, therefore, and vertices s and t, and given the assumption,
successive logspace transformations can produce (1) A, (2) a sequence of n-1
copies of A+I, (3) the product of this sequence, the matrix
(A+I)n-1, and (4) the s-t entry of this matrix. Each of these
operations is logspace (using the assumption for (3)), and because constantly
many logspace functions may be composed to get a logspace function the whole
operation can be performed in logspace.
This is essentially just a recasting of the middle-first search algorithm
of Savitch's Theorem, since the transformation from REACH to iterated
matrix multiplication from Question 2 is fully reversible. But it's easy
to describe a solution to this problem without even mentioning graphs.
Assume that we have the n matrices A1,...,An,
each n by n, in the read-only input, and assume without loss of generality
that n is a power of two. (We can pad the product with enough
identity matrices to make this happen, without changing the value of the
product.) Let P be the product we are trying to compute, and let Q and R
be the product of the first half and second half of the sequence
respectively. By definition, for every i and j the i-j entry of P is
the OR, over all k, of the AND of the i-k entry of Q and the k-j entry
of R. If we had Q and R in read-only memory, then, we could compute
all the entries of P in logspace (as we would need only to remember i, j, and
k).
What we do, then, is to compute P from Q and R, and use recursion to
calculate each entry of Q and R on demand. To get an entry of Q, we use a
logspace algorithm that access the product of the first quarter of the
sequence of matrices, and the product of the second quarter. Each of these
products is computed recursively from products of specific eighths of the
sequence, and so on. When we need an entry of a single matrix, at
the base level of the recursion, we simply look it up.
The depth of the recursion is log n, since each time we halve the size
of the subsequence of matrices we are multiplying. Each activation
record is O(log n) bits, so we use O(log2) space as desired.
The formula simply asserts that three distinct vertices exist with the edges
needed to make them a directed triangle:
∃x:∃y:∃z:(x≠y)∧(x≠z)∧(y≠z)∧E(x,y)
∧E(y,z)∧E(z,x)
The test is easy to code from this -- assume that the vertices are
numbered from 0 through n-1 and that the This method uses O(log n) space because the only variables not in the
readonly input are x, y, and z, which use log n bits each.
edge
predicate is
available as a boolean method:
public boolean directedTriangle()
{Returns true if calling graph has a directed triangle
for (int x=0; x < n; x++)
for (int y=0; y < n; y++) if (x != y)
for (int z=0; z < n; z++) if ((x != z) && (y != z))
if (edge(x,y) && edge(y,z) && edge (z,x))
return true;
return false;}
We need a logspace function f that takes as input an n-vertex directed graph
G and vertices s and t, and outputs a levelled graph H and vertices x and y,
such that there is a path from s to t in G iff there is a path from x to y
in H.
H will have n2 vertices, each named by a pair of numbers in the
range from 0 through n-1. (We will assume that the vertices of G are numbered
in this range.) H will have an edge from (u,i) to (u,i+1) for every u and
every i < n-1. For every pair of vertices u and v such that G has an edge
from u to v, and every i < n-1, H will have an edge from (u,i) to (v,i+1).
We will define the vertex x to be (s,0) and the vertex t to be (t,n-1).
We must prove that there is a path from s to t in G iff there is a path from
x to y in H. First assume that there is a k-step path from s to t in G.
We can construct a path from (s,0) to (t,k) by following the H-edges
made from each of the G-edges in the path, in order. Then we can follow the
path from (t,k) through (t,k+1), (t,k+2),..., to (t,n-1) and we have found a
path from x to y.
Conversely, assume that there is a path from x = (s,0) to y = (t,n-1).
Look at the sequence of first components of the vertices along this path.
This is a sequence of vertices of G, u0,..., uk, where
each ui+1 is either equal to ui or at the end of an
edge from ui. Pruning duplicates from this sequence, then, we
get a path in G from s to t.
The function f is computable in logspace because we can easily take any
pair of vertices of H and determine whether they have an edge: They don't
unless they are of the form (u,i) and (v,i+1) and either u=v or there is
an edge from u to v in G. This can be checked in logspace with access to
G in read-only input. We can thus produce an adjacency list or adjacency
matrix for H in logspace by looping throught the pairs of vertices and
testing each one to see whether it has an edge.
Last modified 9 December 2004