# Promise Problems And TWOPATHS

* A promise problem with an interesting upper bound *

Shimon Even was one of the greats of theory, especially algorithms on graphs—his book Graph Algorithms is a classic. Unfortunately, he passed away in 2004 and will always be missed. His legacy includes many great results, many strong Ph.D. students, and among many other ideas the notion of a *promise problem*. He invented the latter in 1984 in joint work with Alan Selman and Yacov Yacobi. See the beautiful survey by Oded Goldreich on Even and the importance of promise problems.

Today I want to raise an interesting “promise problem” that is related to some earlier discussions we have had.

I knew Shimon, but never had the pleasure to write a paper with him. He had a wonderful way about him, he was full of energy, and was a joy to talk to on any topic.

I have a story about Even and me that happened when I was at Berkeley and he was visiting there—this was in 1979.

One fall day Shimon came into my office with a big smile on his face. I asked him to sit down, and he proceeded to explain what he found so amusing. The previous spring I had taught the undergraduate automata theory—at the level of Mike Sipser’s book—except that Mike was taking my class at the time. Not only did Mike take the class but a number of other graduate students did too. One I will call student X. He did okay in my class, and Shimon reminded me that I gave him a B. At Berkeley B was “passing” for a graduate student so I thought nothing much about giving him this grade.

Shimon smiled and told me:

You were the first teacher ever to give him a B. Ever. He had gotten A’s for every class he took since first grade.

I started to say something—but Shimon broke in and said that I had done a great thing. The student was so upset about the B that he was working extremely hard to get his research going. He even had considered leaving Berkeley to go to another department, but decided to stay. In a sense X wanted to prove me wrong.

Shimon thanked me. He said X was probably going to do terrific work and my giving him that single B may have been the spark he needed. I do not recall saying anything back to Shimon, but today X is a superstar. I would like to think that I helped in some small way. Perhaps I should give out more B’s.

Let’s turn to discuss a simple promise problem that I have been looking at recently.

** The Promise Problem **

I will call the problem . A function is given that is computable in polynomial time on bit strings of length . The function is 1-1 but can be “undefined” on some strings, and we also stipulate for all . Let’s use to denote that . In a natural way the function defines a directed graph with as the edge relationship. Every node has out-degree at most because is a function, and in-degree at most because is injective. It also has no self-loops because . Hence the graph is a disjoint union of paths and cycles.

We further stipulate that there are two special start nodes and two special end nodes , which are given as part of the input. The **promise** is the resulting graph has exactly two paths, each starting from an and ending in an .Thus, either

or

The **task** is to determine the end point of the paths: does the path from end in or ?

Notice that the property of being sinks is not part of the “promise.” It does not have to be because it is already decidable in polynomial time: being able to tell that undefined and undefined is considered part of being computable in polynomial time. The property of being sources is not necessarily as easy, because need not be invertible in polynomial time. However, the property of not being a source node belongs to the complexity class , because then there is a unique such that . The class is a subclass of the class into which we will classify this task, so it is unimportant whether being sources is part of the givens or part of the promise.

The property that the graph consists of exactly two paths, however, is the key. If the graph was allowed to consist of many paths, then the problem is easily shown to be polynomial space complete. This makes it all the more surprising that under the *promise* of being in the two-path case, the complexity of the task drops down to a class that is commonly believed to be lower than polynomial space.

** The Complexity of **

I do not know the exact complexity of the problem. The following theorem is the best upper bound that I know:

Theorem:The problem is in .

I find this theorem to be unexpected. The obvious algorithm is to iterate the function on until an end is reached. Since the paths can be exponentially long, this does not run in polynomial time. Yet the problem can be reduced to the counting class . Recall this counts the number of accepting computations modulo .

The proof is based on ideas that I have already discussed, so I will just give a high-level sketch of the proof.

Suppose we are given the graph defined by the function : we know that consists of two paths. The start vertices are and the end vertices are . The key idea is to add the edges and to form the graph . Then there are two cases: If the path staring with ends in we get two cycles; if it ends in we get one cycle. Thus, to solve the problem we need to decide whether consists of one cycle or two.

This we can do by a trick I discussed before. We can view as defining a permutation on the vertices. The number of inversions of a permutation can be used to tell how many cycles the permutation has modulo . But, the number of inversions modulo is easily reduced to a problem that can be computed by .

The number of inversions is defined as follows as follows: for each pair of vertices and they form an inversion provided

Finally, why is this only a promise-problem solution? The predicate for counting inversions yields an implicit odd/even number of witnesses for all kinds of graphs. For graphs that did not arise from the promise, the implication for permutations is null and void. Thus the language arising from this predicate belongs to , but is not restricted to graphs in the *promise set *. An ordinary language reduces to the promise problem if it reduces to , provided the range of the reduction is entirely within . Thus we can say that promise problems are hard for, and even complete for, ordinary complexity classes.

** Open Problems **

What is the complexity of ? Can we prove it is complete for some known class? Can the bound of the theorem be improved? It seems hard to believe that the problem is in, for example, NP. How would guessing help “follow” a path that can be exponentially long?

[fixed typo: bad link]

Interesting problem. I don’t have time to check the definitions carefully right now (flight to catch!), but what about the following possible proof of Parity-P hardness:

All nodes are of form (x, 0) or (x, 1), where x is a number between 0 and (2^n – 1). Suppose we’re given a polytime-computable Boolean function g on n input bits. Define the function f by

f((x, b)) = (x+1, b) if g(x)=0,

else, f((x, b)) = (x+1, not(b)).

The sources are (0, 0) and (0, 1), and we get a path from (0, 0) to (2^n – 1, 0) iff g has an even number of 1s.

So who is Mr. X?

Seems like you can simulate an exponentially long width 2 permutation branching program (which would give two paths) which means TWOPATHS is Parity-P complete.

By a similar logic, the FIVEPATHS program should be PSPACE-complete via Barrington’s theorem.

Right you are, thanks! To explain as as in the post, instead of thinking of f as the next-configuration function of a space-bounded TM, instead think of a poly-time witness predicate R(x,y). Let the node set be {(y,0),(y,1)} for all y \in {0,1}^m (where m is poly in the length n of x), plus the start nodes s_1 and s_2. Cycle thru each y in order. If R(x,y) holds, crossover the two paths; if not, let them go straight ahead. For the last y, things go to t_1,t_2. Then s_1 goes to t_2 iff the number of y such that R(x,y) holds is odd.

This reduction has range completely within 2-path graphs, so the promise problem is indeed complete for Parity-P. A source for the basic observation is Borodin-Dolev-Fich-Paul, 1986; in particular, this meets their definition of “strict width-2″.

The link in “ideas that I have already discussed _here_” is broken. There’s a trailing “bbb”.

Follow up to previous link-related comment—it looks like that first link shouldn’t be in the post at all, and that it’s the _before_ link that follows that’s intended.

I don’t quite understand the analysis. “But, the number of inversions modulo 2 is easily reduced to a problem that can be computed by parity P.” Isn’t the time here in terms of the size of the graph? Isn’t the the size of the graph (whose vertices are bit strings of length n) exponential in n?

An exponential-sized graph has nodes u,v,w,… whose names are polynomial in length, so it is possible for the edge relation E(u,v) to be “served” in polynomial time. Here we are doing so because E(u,v) is represented as “f(u) = v” for a polynomial-time computable function.

Parity-P, like NP, also involves a nondeterministic Turing machine, or equivalently a polynomial-time decidable witness predicate R(x,y) [with |y| = poly(|x|)]. Such a machine can have a “global” acceptance criterion that depends on the overall number of “locally” accepting computation paths, or equivalently the number of y such that R(x,y) holds. That’s how we can talk about polynomial time in this generally-exponential domain.

The link in “The proof is based on ideas that I have already discussed here” seems broken.

Thanks, I fixed the link.

Well, another predicate became quite interesting to me now :)

LIPTON_Graded_B_in_1979_AND_NOW_SUPERSTAR ( X)

x = ?

Well, Wikipedia lists a prominent cryptographer as a former PhD student of Shimon Even…

There is a notable X for REGAN_Graded_B… —in interest of privacy I’ll say no more :-).

Yet another instantiation of

Student X:“Indeed, only once during his primary and secondary school career did young Kurt [Gödel] ever receive less than the highest mark in any subject (mathematics!)”I received that B !

And now I am a superstar!

Sorry, that was just a joke, to relax. Don’t take it too seriously…

Your blog is wonderful, indeed.

This reminds me on the celebrity clique, a problem I know from Richard Bird. In a digraph G=(V,E) a celebrity clique is a subset V’\subseteq V such that the subgraph induced by V’ is complete and there is an edge from every node in V\V’ to every node in V’. Given G checking whether V\subseteq V’ is a celebrity clique needs quadratiy time, however, given G and the assertion that G contains a celebrity clique computing it needs only linear time. Sharon Curtis also did work on this little nice problem: http://cms.brookes.ac.uk/staff/SharonCurtis/publications/index.html

Is there a relation between Parity P and integer factorization?