Pseudodeterministic Constructions in Subexponential Time
Abstract
We study pseudodeterministic constructions, i.e., randomized algorithms which output the same solution on most computation paths. We establish unconditionally that there is an infinite sequence of increasing primes and a randomized algorithm running in expected sub-exponential time such that for each , on input , outputs with probability . In other words, our result provides a pseudodeterministic construction of primes in sub-exponential time which works infinitely often.
This result follows from a much more general theorem about pseudodeterministic constructions. A property is -dense if for large enough , . We show that for each at least one of the following holds: (1) There is a pseudodeterministic polynomial time construction of a family of sets, , such that for each -dense property and every large enough , ; or (2) There is a deterministic sub-exponential time construction of a family of sets, , such that for each -dense property and for infinitely many values of , .
We provide further algorithmic applications that might be of independent interest. Perhaps intriguingly, while our main results are unconditional, they have a non-constructive element, arising from a sequence of applications of the hardness versus randomness paradigm.
1 Introduction
Number theory tells us that a significant fraction of -bit integers are prime, but can we efficiently generate an -bit prime deterministically? This is a fundamental question in computational number theory and cryptography. A naive solution is to test the -bit numbers for primality in order, starting with , using the AKS primality test [2], until we find one that is prime. Known results about the distribution of prime numbers guarantee that this procedure works in time [6]. Despite all the progress that has been made in understanding the behaviour of prime numbers, the best known deterministic algorithm for generating -bit primes runs in time [24], which is not significantly better.
If we are allowed randomness in our generating algorithm, the problem becomes almost trivial: we repeatedly guess an -bit number at random and test it for primality, halting if a prime is found. Using the Prime Number Theorem, we will succeed with probability after tests, each of which can be implemented in time. Thus the efficient deterministic generation problem reduces to derandomizing this algorithm. Under a strong hardness hypothesis, such as the assumption that linear exponential time requires exponential size circuits almost everywhere, this derandomization can be performed using known results from the theory of hardness-randomness tradeoffs [19]. However, we appear to be very far from proving such strong circuit lower bounds.
A few years ago, the Polymath 4 project considered precisely this question of efficient generation of primes, with the goal of using the state of the art in complexity theory and in number theory to obtain better results. It was observed during the project that several famous number-theoretic conjectures, such as Cramer’s conjecture and Schinzel’s hypothesis H, imply better generation algorithms, as do circuit lower bound assumptions, as described above. All of these conjectures seem far beyond our reach at present. The Polymath 4 project established [28] an improved algorithm for determining the parity of the number of primes in a large interval, but this has not yet yielded an unconditional improvement to the best known deterministic generation algorithm. The project posed the following question of interest to complexity theorists: does imply more efficient deterministic generation of primes? This is not clear because the randomized generation algorithm for primes is not an algorithm for a decision problem.
Given the difficulty of finding more efficient deterministic generation algorithms, a natural approach is to relax the question. We know that randomized generation is easy, and we do not know of good deterministic generation algorithms. Is there an intermediate notion that could perhaps be useful?
Such a notion of pseudodeterministic algorithms was defined by Goldwasser and Gat [11], motivated by applications in cryptography and distributed computing, and further studied in [13, 12, 16]. A pseudodeterministic algorithm is a randomized algorithm, but the algorithm generates the same output with high probability. Thus, while the algorithm is not deterministic, the output of the algorithm looks deterministic to a computationally bounded observer. In the context of generating primes, pseudodeterministic generation means that the same prime is output on most computation paths. Note that the naive random generation algorithm does not have this property.
Goldwasser and Gat [11] describe the question of pseudodeterministic generation of primes as “perhaps the most compelling challenge for finding a unique output”. To the best of our knowledge, it is not known how to do better for this problem than to use the fastest deterministic algorithm.
1.1 Main Results
The main application of our techniques is that there is unconditionally a subexponential-time pseudodeterministic algorithm for generating infinitely many primes.
Theorem 1.
Let be any constant. There is an infinite sequence of increasing primes, and a randomized algorithm running in expected time on inputs of length such that for each , on input outputs with probability .
Note that the algorithm is zero-error: on input , it outputs the same prime on all computation paths. In fact, on any input , the algorithm either operates deterministically and halts without output, or else it outputs the same -bit prime on all computation paths.
Using the proof idea of Theorem 1, we answer a variant of the question from Polymath 4: under the assumption that for some fixed (which is much weaker than ), we show that there is a subexponential-time deterministic algorithm for generating infinitely many primes (see Theorem 9 in Section 3.2).
Theorem 1 has some unusual features: we show that an algorithm exists satisfying the described properties, but we are not able to explicitly give such an algorithm. Similarly, while we show the existence of an infinite sequence of primes , we are unable to bound as a function of . These non-constructive features, which are surprising in the context of an algorithmic solution to a natural problem, arise because Theorem 1 is proved as a corollary of the following generic result about explicit constructions.
Theorem 2.
Call a property -dense if for each large enough , . For each at least one of the following holds:
-
1.
There is a deterministic sub-exponential time construction of a family of sets, , such that for each -dense property and for infinitely many values of , .
-
2.
There is a zero-error pseudodeterministic polynomial time algorithm outputting a family of sets, , such that for each -dense property and every large enough , .
We derive Theorem 1 by taking to be the set of primes in Theorem 2, and observing that the statement of Theorem 1 follows both from the first and second item of Theorem 2. The non-constructivity comes from not knowing which of these two items holds, and we discuss this issue in more detail in Section 1.4.
Consider any property as in the statement of Theorem 2, namely with polynomial density and decidable in deterministic polynomial time. For any such property, there is a randomized generation algorithm in polynomial time analogous to the one we described for Primes: generate strings of length at random and test for membership in , halting if a string in is found. What Theorem 2 says is that this randomized generation algorithm can unconditionally be made pseudodeterministic in a generic fashion, albeit at the cost of increasing the running time to subexponential, and only succeeding for infinitely many input lengths .
Theorem 2 is a very general result, and the generality of our techniques enables us to apply them to give unconditional pseudodeterministic algorithms in other contexts. Even if Theorem 1 does not give an explicit algorithm for generating primes of every input length, it does provide evidence that such algorithms might not be out of reach of current techniques. More explicit and more efficient algorithms could perhaps be designed by tailoring them more closely to the property at hand.
Nevertheless, we are interested in the question of whether there is a fundamental bottleneck to constructivity in our proof technique for Theorem 2. By refining some aspects of our approach, we are able to get somewhat explicit algorithms for generating primes as follows.
Theorem 3.
For each , there is a constant , an infinite sequence of increasing primes, and an explicit randomized algorithm halting in time on inputs of length such that for each , outputs with probability , and moreover for each .
The algorithm in Theorem 3 is explicit, but we still cannot say for sure on which input lengths it will succeed. We do have the guarantee that the gaps between successive input lengths on which the algorithm succeeds are not superpolynomially large. Theorem 3 does not strictly improve on Theorem 1 – it is not necessarily true, for example, that the same prime is output on all computation paths. Namely, we get a bounded-error pseudodeterministic algorithm rather than a zero-error one. However, the issue of non-constructivity is somewhat mitigated in Theorem 3.
Theorem 2 yields subexponential-time pseudodeterministic generation algorithms for properties that are both easy and dense. A more general context is polynomial-time sampling. Here we are given a sampler that either outputs a string (with high probability) or aborts, and we wish to design a new sampler that outputs a fixed string with high probability, with the constraint that this fixed string should belong to the range of the original sampler. We show how to adapt our ideas to give an analogue of Theorem 2 for this problem. We refer to Section 3.3 for more details.
We also study the relationship between pseudodeterminism and derandomization. A natural problem associated with derandomization is the Circuit Acceptance Probability Problem (): given a circuit , output a small-error additive approximation to the acceptance probability of . There is a simple randomized polynomial-time algorithm for this problem – sample polynomially many inputs of at random, and output the fraction of these inputs on which accepts. This algorithm outputs different estimations of the acceptance probability of on different computation paths. We show how to get a pseudodeterministic algorithm as in Theorem 2 for infinitely many input lengths, but our algorithm is only guaranteed to succeed distributionally rather than in the worst case. (We refer to Section 4 for a precise formulation of the result.)
Theorem 4.
For any and any polynomial-time samplable sequence of distributions over Boolean circuits, is pseudodeterministically solvable for infinitely many input lengths in time with high probability over .
One of the main questions in the theory of derandomization concerns the relationship between “white-box” and “black-box” derandomization. Black-box derandomization refers to derandomization using a fixed pseudorandom generator, while in white-box derandomization, we are given a circuit and asked to approximate its acceptance probability deterministically. Black-box derandomization implies white-box derandomization of randomized algorithms, and white-box derandomization implies deterministic simulations of languages in . However, it is unknown whether these implications can be reversed in general (cf. [9, 15]), and separations are known in relativized worlds [9].
We prove that these notions are all in fact equivalent in the setting of subexponential-time derandomization that works infinitely often on average over polynomial-time samplable distributions. (While Theorem 4 provides a randomized algorithm, we stress that the algorithms postulated in Theorem 5 below are all deterministic. We refer to Section 4 for definitions.)
Theorem 5.
The following statements are equivalent:
-
1.
For each polynomial-time samplable distribution of Boolean circuits and each , there is an i.o.PRG on average over with seed length that is computable in time .
-
2.
For each polynomial-time samplable distribution over Boolean circuits and each , is solvable infinitely often in time on average over .
-
3.
For each polynomial-time samplable distribution over input strings and each , is solvable infinitely often in time with bits of advice on average over .
-
4.
For each , is solvable infinitely often in time on average over .
Therefore, in order to establish all these items it is necessary and sufficient to turn the (unconditional) pseudodeterministic algorithm from Theorem 4 into a deterministic algorithm.
1.2 Related Work
There has been a lot of work on explicitly constructing combinatorial objects that can be shown to exist by the probabilistic method. Vadhan [31] surveys known unconditional constructions of such objects, and connections to the theory of pseudorandomness. There are important properties, such as the Ramsey property, for which optimal explicit constructions are still not known, though there has been much recent progress (cf. [8, 7]). However, in many cases, such constructions do exist if the notion of explicitness is weakened or if a sufficiently strong derandomization hypothesis is made [29, 26].
The techniques used to show explicit constructions of combinatorial objects do not seem to be directly relevant to constructions of algebraic objects such as irreducible polynomials or number-theoretic objects such as primes. Shoup [27] shows how to deterministically construct an irreducible polynomial of degree over the field in time polynomial in and . This is useful for constructions of irreducible polynomials over fields of small characteristic, but the large-characteristic case is still open – ideally we would like the construction algorithm to operate in time .
For primes, known results are even weaker. The fastest known algorithm generates -bit primes in time , for [24]. There are algorithms that achieve an arbitrarily small constant , but assume certain number-theoretic conjectures. Faster running times can be obtained under stronger conjectures, and we refer to the introduction of [28] for more information.
Assuming standard (but hard to prove) derandomization hypotheses, stronger explicit constructions are known. It is folklore that the existence of hitting sets against a class of algorithms yields explicit deterministic constructions for every dense property computed by -algorithms. References that discuss this include [29, 26, 15]). As an example, the assumption that requires exponential-size Boolean circuits implies polynomial-time explicit constructions of irreducible polynomials and of primes. However, in this work, we are interested in unconditional, albeit pseudodeterministic, constructions for properties decidable in polynomial time. (While there are unconditional pseudorandom generators against restricted classes of algorithms such as small-depth polynomial size circuits, it is known that such circuits cannot decide several properties of interest, such as prime numbers [3].)
Perhaps the most closely related result is a certain unconditional derandomization of one-sided polynomial time randomized algorithms in subexponential time established in [22]. However, the focus there is on decision problems, and as remarked above, such results do not immediately imply pseudodeterministic constructions. The easy witness method from [22] is an important tool in some of our proofs.
The investigation of the power and limitations of pseudodeterministic algorithms is fairly recent. A sequence of works [11, 13, 12, 16] has started the development of a more general theory of pseudodeterministic computation. These papers give pseudodeterministic algorithms that are faster than their known deterministic counterparts for various concrete search problems of interest, and also give some structural results.
Connections between black-box derandomization, white-box derandomization and deterministic simulation of are explored by Fortnow [9], who shows relativized separations between these notions. Goldreich [15] shows an equivalence between white-box derandomization and black-box derandomization in the average-case setting; however he consider pseudo-random generators that work against uniform algorithms, rather than against non-uniform circuits. Implagliazzo, Kabanets and Wigderson [17] give an equivalence between white-box and black-box derandomization in the setting where we allow the derandomization to be done non-deterministically with a small amount of advice, and the derandomization is only required to be correct for infinitely many input lengths.
1.3 Techniques
Suppose we wish to pseudodeterministically generate strings satisfying some property that is dense and is decidable in polynomial time, such as .333For concreteness, we let . It is well-known that using standard hardness-randomness tradeoffs, efficient deterministic generation can be done under a strong enough circuit lower bound assumption for (linear exponential time).
Our first observation is that efficient pseudodeterministic generation follows from weaker circuit lower bound assumptions, namely circuit lower bounds for the probabilistic classes (bounded-error linear exponential time) and (zero-error linear exponential time). Pseudodeterministic algorithms come in two flavours: zero-error, where the algorithm outputs a fixed string (with high probability) or else aborts, and bounded-error, where it outputs a fixed string on most computation paths but might output other strings on exceptional computation paths. It turns out that strong enough circuit lower bounds for imply efficient bounded-error pseudodeterministic generation, and strong enough circuit lower bounds for imply efficient zero-error pseudodeterministic generation. This is because a hard function in (resp. a hard function in ) yields a bounded-error (resp. zero-error) pseudodeterministic construction of a discrepancy set (see Section 2). In turn, once such a discrepancy set is obtained, its elements can be checked in some fixed order for membership in , and the first such element belonging to can then be output pseudodeterministically.
Note that circuit lower bounds for do not seem useful for decision problems: using a sufficiently hard function in in a pseudorandom generator would merely yield the tautologous inclusion . However, such circuit lower bounds are useful for pseudo-derandomization of search problems.444It is natural to wonder if there are techniques tailored to and lower bounds. We refer the interested reader to the approaches outlined in [25].
To turn our conditional pseudodeterministic generation algorithms into unconditional ones, we use the uniform hardness-randomness tradeoffs of [20, 30] and win-win analysis, showing that both the success and the failure of certain pseudorandom generators can be exploited to give non-trivial pseudodeterministic constructions. The specific win-win analysis we use depends on the intended application. In order to make some constructions zero-error, we further combine the arguments with the easy witness method [22].
We describe next the main conceptual ideas behind the proof of each main result stated in Section 1.1.
Theorem 1 (Non-constructive zero-error pseudo-deterministic algorithm for ). Recall that Theorem 1 is a straightforward consequence of Theorem 2. In each case, it follows that there is a pseudodeterministic subexponential time algorithm which simply outputs the lexicographic first -bit prime in the hitting set. The non-constructive aspect of Theorem 1 arises because we do not know which of items (1) and (2) holds in Theorem 2.
Theorem 2 (Unconditional pseudo-deterministic hitting set generators). Here we use a win-win-win analysis. We try two different candidate hitting set generators and , both computable in deterministic subexponential time. The first generator is based on the easy witness method of Kabanets [22], and the second is the generator of Trevisan-Vadhan [30]. If either of the corresponding hitting set families intersects infinitely often, we have that the first item of Theorem 2 holds. If not, then we show that we have the complexity collapse . We exploit this collapse to derive strong circuit lower bounds in , and are then able to use our conditional argument for efficient pseudodeterministic generation to conclude the second item.
Theorem 3 (Constructive bounded-error pseudo-deterministic algorithm for ). The proof for Theorem 2 gives no information on the sparsity of input lengths for which the construction succeeds, nor does it give us an explicit algorithm. An important reason for this is that we prove item (2) to hold in Theorem 2 only if the candidate hitting set generators in item (1) fail almost everywhere. We first show a refinement of the main technical lemma which allows us to derive a consequence for item (2) from a failure of item (1) for all input lengths in a polynomially large range of input lengths. We then crucially use the fact that item (1) gives deterministically generatable hitting sets which can be checked for correctness somewhat efficiently to guarantee that either item (1) or item (2) must hold in every large enough polynomial range of input lengths.555The possible sparsity of the sequence of primes produced by our algorithm is an artifact of our complexity-theoretic techniques. In contrast, constructions using standard number-theoretic techniques typically use analytic methods and succeed for every large enough input length (James Maynard, personal communication). The details are somewhat technical, and we provide a more intuitive explanation in Section 3.4.
Theorem 4 (Pseudodeterministic algorithm for ). We use a win-win analysis once again, relying on the fact that pseudo-random generators can be employed to approximate the acceptance probability of circuits in a deterministic fashion. If the candidate pseudo-random generator we use succeeds infinitely often, we can solve deterministically infinitely often; if it fails in an average-case sense, we adapt the arguments used in the proof of Theorem 2 to show how to solve pseudodeterministically in polynomial time.
Theorem 5 (Equivalences for deterministic algorithms in the average-case ). The most interesting implications rely on results from previous works. The simulation in (3) assuming (2) introduces advice, and this advice is eliminated in item (4) as follows. Under assumption (3), it follows by diagonalization that . In turn, [20] showed that this hypothesis provides sub-exponential time simulations of , as required in (4). Perhaps a more surprising connection is that (4) implies (1). Our argument is based on another win-win analysis, and relies on results from [5, 20, 30]. Under (4), it can be shown that , and that this implies that either , or . In each case, we argue that any samplable distribution admits an average-case pseudo-random generator satisfying the conditions in (1).
1.4 Constructivity: PSEUDO versus SPARSE
Note the quantification in the statement of Theorem 2: there is a pseudodeterministic polynomial time algorithm producing a hitting set family which works for every sufficiently dense easy property, or there is a deterministic subexponential time algorithm producing hitting set families which work infinitely often for every sufficiently dense easy property. Thus we provably live in one of two worlds:666Inspired by the worlds of Impagliazzo [18]. a world PSEUDO where there is a generic hitting set family for sufficiently dense easy properties that is computable in zero-error pseudodeterministic polynomial time, or a world SPARSE where generic hitting set families are computable deterministically but only in subexponential time, and moreover the hitting sets only work infinitely often. These two worlds could co-exist. Indeed many complexity theorists believe that linear exponential time requires exponential size circuits on almost all input lengths, which would imply the co-existence of the two worlds. However, given the available techniques at this point in time, we are only able to establish that we live in one of the two worlds.
The fact that we can show that we live in one of these two worlds, but don’t know which one, leads to a certain non-constructivity in our results, which is ironic given that we are motivated by explicit constructions! We can show that we live in one of the worlds PSEUDO or SPARSE, and in the latter case, our proof provides an explicit algorithm witnessing that we live in that world, namely the algorithm producing the union of the hitting set families and . However, in the former case, the proof does not provide an explicit algorithm witnessing that we live in that world. This is because the proof relies on the existence of an easy dense property which acts as distinguisher for the hitting set families, and we do not know a priori which property this is.
A further element of non-constructivity in Theorem 2 is that in case we live in the world SPARSE, we have no information on the set of input lengths for which the hitting set works, except that this set is infinite. This set could be arbitrarily sparse. The reason is that we can only show the second item based on the hitting set families and failing to work on all large enough input lengths.
We partially address both issues in Section 3.4, and we refer to that section for further discussions on PSEUDO and SPARSE.
2 Preliminaries
2.1 Basic Definitions and Notation
We refer to algorithms in a sufficiently strong computational model, such as the 2-tape Turing Machine over the alphabet . We use standard encodings of objects such as numbers and finite sets by strings. For convenience, we let . Given a string , we let denote its leftmost bits.
Properties and Density. A property777We use the term “property” rather than “language” or “Boolean function” to highlight that in our setting, we are more interested in the efficient constructibility of positive instances than in efficient recognizability. is an arbitrary set . Let , and . Given a function , we say that is -dense if for every large enough . We say that is dense if there is such that is -dense with for every sufficiently large . We say that is easy if is decidable in deterministic polynomial time.
Hitting Sets and Discrepancy Sets. Let be a sequence, where for each , and let be a property. We say that is a hitting set for at length if . Given a set of input lengths, we say that is a hitting set family for on if it is a hitting set for at length for each . We say that is a hitting set family for in case it is a hitting set family for on some co-finite set , and we say that is an i.o. hitting set family for if it is a hitting set for on some infinite set .
Let be an arbitrary function. We say that a sequence of (multi-) sets is a -discrepancy set for at length if . The notions of being a -discrepancy set family at a set of input lengths, an i.o. -discrepancy set family and a -discrepancy set family are defined in analogy to the previous paragraph. Note that if is -dense, then a -discrepancy set family for is also a hitting set family for .
Pseudodeterministic Algorithms. By default, we consider randomized algorithms whose input and output are both strings. Let be a real-valued parameter. A randomized algorithm is said to be a bounded-error pseudodeterministic algorithm with success probability if there is a function such that with probability at least over the random choices of . We call such a function a -canonical function for , and an output of the function a -canonical output of . A randomized algorithm is said to be a zero-error pseudodeterministic algorithm with success probability if there is a function such that on each computation path, outputs either or , and with probability at least over the random choices of .
Given a set of inputs, we say that an algorithm is pseudodeterministic on if the pseudodeterministic promise is only required to hold for inputs in . When the algorithm takes a unary input, we sometimes identify subsets of inputs with subsets of , in the natural way.
For any bounded-error pseudodeterministic algorithm with success probability or any zero-error pseudodeterministic algorithm with success probability , there is a unique -canonical function, defined in the former case by the unique output produced with probability , and in the latter case by the unique non- output. In both cases, we simply call the function and the corresponding output canonical.
Let be a property, a real-valued parameter, and be a time function. We say that there is a bounded-error pseudodeterministic construction with success probability for in time if there is a bounded-error pseudodeterministic algorithm with success probability such that for all large enough , halts in time and has a -canonical output in . Similarly, we say that there is a zero-error pseudodeterministic construction with success probability for in time if there is a zero-error pseudodeterministic algorithm with success probability , such that for all large enough , halts in time and has a -canonical output in .
As with hitting sets and discrepancy sets, given a set , we can generalize the notion of a pseudodeterministic construction to the notion of a pseudodeterministic construction on , which means that has a -canonical output in for each . An i.o. pseudodeterministic construction is a pseudodeterministic construction on some infinite set .
When the parameter for a pseudodeterministic algorithm is omitted, it is taken by default to be . For such a pseudodeterministic algorithm on input of length , for a large enough , we will sometimes abuse notation and use to refer to the canonical output of on . Indeed, as observed next, bounded-error pseudodeterministic constructions and zero-error pseudodeterministic constructions are largely robust to variations in the success probability.
Proposition 1.
Let be a property, and be a time function.
-
(i)
There exists a bounded-error pseudodeterministic construction for with success probability in time if and only if there is a bounded-error pseudodeterministic construction for with success probability in time .
-
(ii)
There exists a zero-error pseudodeterministic construction for with success probability in time if and only if there is a zero-error pseudodeterministic construction for with success probability in time .
Proof.
The proof is a simple adaptation of the proof of error amplification for bounded-error and zero-error algorithms which recognize languages. Hence we just give a sketch.
We show the equivalence for bounded-error constructions first. We only need to show the forward implication, as the backward implication is trivial. By assumption, there is a bounded-error pseudodeterministic algorithm with success probability such that the canonical output of belongs to for large enough. We amplify the success probability of by running it times independently, and outputting the string that is produced most often as an output among these runs, breaking ties arbitrarily. Using standard concentration bounds, it is easy to show that this new algorithm is bounded-error pseudodeterministic with success probability at least , and has the same canonical output as .
The proof is similar for zero-error constructions. Given a zero-error pseudodeterministic algorithm with success probability , we amplify the success probability by running times independently where the number of runs is chosen large enough depending on the success probability, outputting the canonical output of if it is produced on any of the runs, and otherwise. Simply by independence of the runs, the canonical output of is produced by this new algorithm with success probability , and the new algorithm is still zero-error pseudodeterministic. ∎
As opposed to Theorem 1, the algorithm from Theorem 3 might generate different primes on inputs for which it is not the case that for some . It is not excluded that on some inputs of this form each prime is generated with approximately equal and non-negligible probability. This can be partially addressed using the following simple proposition.
Proposition 2 (Purifying infinitely-often pseudo-deterministic constructors).
Let be arbitrary, and let be a bounded-error pseudodeterministic construction for with success probability on every input with . Then there is a bounded-error pseudodeterministic construction for for which the following holds:
-
(i)
On every input with , outputs the same canonical solution with high probability.
-
(ii)
On an arbitrary input with , there exists a set satisfying such that with high probability.
-
(iii)
The running time of is at most a polynomial factor larger than the running time of .
Proof.
On input , simulates executions of on input . Let be random variables supported over representing the output of on each such computation. outputs the lexicographic first string in that appears more than times among . If no such string exists, outputs .
Clearly, satisfies (iii). It is easy to see that it also satisfies (i) by a standard concentration bound, since on each such input algorithm outputs a fixed solution with probability . To establish (ii), note that on an arbitrary input , there is at most one element such that . Take if such element exists, and set otherwise. In the latter case, the probability that any fixed string in appears times among is exponentially small, and by a union bound with high probability outputs . Similarly, in the former case no string that belongs to will appear more than times among , except with exponentially small probability. By a union bound, the output of must be in with high probability. ∎
Complexity Classes. We use the standard definitions for classes such as , , , , and . We will also use , and . We refer to standard textbooks such as [1, 14] for more information about complexity theory.
Boolean Circuits and Pseudorandom Generators. We consider Boolean circuits consisting of fan-in two gates over the standard basis, and measure circuit size by the number of wires in the circuit. The precise details will not be important here, and we refer to [21] for more background in circuit complexity. Given a size function , is the class of properties such that has Boolean circuits of size , for each .
We say that a function -fools algorithms (circuits) of running time (circuit size) if for every such algorithm (circuit) ,
Otherwise, we say that -distinguishes (on seed length ).
We will consider a sequence of generators , which we also view as a single function . The function is the stretch of . We say that a generator with stretch is quick if on every input , can be computed in time , where is a fixed constant independent of the remaining parameters. Finally, we say that an algorithm is a -distinguisher for if runs in time at most , and on every sufficiently large , -distinguishes .
2.2 Technical Results
We make use of the following “hardness versus randomness” results.
Theorem 6 (Impagliazzo and Wigderson [19]).
There is a function , computable in polynomial time, for which the following holds. For every , there exist constants such that for every ,
and if is the truth-table of a function of circuit complexity , then
is a (quick) pseudorandom generator that -fools size- circuits.
The next generator is based on a downward-self-reducible and self-correctable -complete language described in [30], and the corresponding result can be seem as a uniform “low-end” version of Theorem 6. The following formulation is sufficient for our purposes.
Theorem 7 (Impagliazzo and Wigderson [20], Trevisan and Vadhan [30]).
For every integers , there exists an integer and a function with restrictions
such that can be computed in time when given oracle access to , and the following holds. If the output of can be -distinguished from random for every large enough by an algorithm running in time , then .
3 Pseudodeterministic Constructions
3.1 Conditional Constructions
Lemma 1.
If there is an and a Boolean function (resp. ) that requires circuits of size on all large enough input lengths , then for each constant , there is a bounded-error (resp. zero-error) pseudodeterministic algorithm running in polynomial time such that is a -discrepancy set family for every property decidable in deterministic time .
Proof.
We give the proof for the case that ; the case that is exactly analogous. Assume without loss of generality that the probabilistic exponential-time machine computing has failure probability on any input of length .
We define the behaviour of pseudodeterministic algorithm on input using Theorem 6 as follows. We apply this result with constants and corresponding to the choice . Let . The algorithm first computes the truth table of the function on input size by evaluating on every input of size using the probabilistic exponential-time machine . (We assume here that is a power of ; if not, the same argument works by setting to be the smallest power of larger than .) Note that by a union bound, computes the entire truth table correctly with probability , and runs in time . then computes for each string , using the polynomial-time algorithm for guaranteed by Theorem 6, and forms a multi-set composed of the union of these strings. It then forms the (multi-) set , and outputs .
Note that the same set is output whenever the correct truth table is computed, which happens with probability as argued before. Hence is a pseudodeterministic algorithm with success probability . Let be the canonical output of .
It remains to argue that is a -discrepancy set for for large enough , where is any property decidable in time for large enough. Let be a deterministic machine deciding with a running time of this form, and let be the Boolean circuit of size obtained by translating ’s computation on inputs of length into a circuit, as in the proof of the Cook-Levin theorem. Let be the circuit of size on input of size , which simulates on and outputs the answer. Finally, let be large enough that requires circuits of size at least on inputs of size for any that is a power of two. By Theorem 6, -fools . It follows that is a -discrepancy set for for large enough, using the facts that accepts a string of length if and only if accepts , and that accepts a string if and only if . ∎
Remark 1.
We note that the conclusion of Lemma 1 holds even for properties decidable by Boolean circuits of size , since we do not take advantage of uniformity in the argument above.
Corollary 1.
Let be any property that is easy and dense. If there is an and a Boolean function (resp. ) that requires circuits of size on all large enough input lengths , then there is a bounded-error (resp. zero-error) pseudodeterministic construction for in polynomial time.
Proof.
Again we give the proof for the case that ; the case that is exactly analogous. Let be any property that is easy and dense. Let be a polynomial-time Turing machine deciding . Let be a constant chosen large enough such that is -dense and runs in time at most for large enough. Using Lemma 1, we have that there is a bounded-error pseudodeterministic algorithm running in polynomial time such that the canonical output of is a -discrepancy set for . Hence, by the density condition on , we have that is a hitting set for for large enough.
We define a bounded-error pseudodeterministic algorithm running in polynomial time, whose canonical output on input belongs to for large enough. first simulates to obtain a subset of ; if the output of is not such a subset, it outputs an arbitrary string. With probability , is the canonical output of , which is the hitting set of size . then orders the strings in in lexicographic order to obtain a list , where , and each , , is an -bit string. simulates on each of the ’s, in order, until it finds a on which accepts. If it finds such a , it outputs , otherwise it rejects.
For large enough, let be the smallest element of in lexicographic order which belongs to . Since is a hitting set for for large enough, such a string exists. It is easy to see that outputs with probability , and hence that is the canonical output of . This is because with probability , and whenever , the string is output by . Clearly runs in time and is a pseudodeterministic algorithm with success probability whose canonical output is in for large enough. ∎
The proof of Corollary 1 can easily be adapted to give a bounded-error pseudodeterministic construction in polynomial time even when the condition on easiness of is relaxed to , and a zero-error pseudodeterministic construction in polynomial time even when the condition on easiness of is relaxed to . There is also a natural tradeoff between the hardness assumption and the running time of the corresponding pseudodeterministic construction, which can be obtained by using a generalization of Theorem 6 giving a hardness-randomness tradeoff based on circuit lower bounds varying from superpolynomial to exponential.
Note that the easiness assumption on is used twice to obtain Corollary 1, the first time in the proof of Lemma 1 to obtain pseudodeterministic algorithms outputting discrepancy sets based on the hardness assumption, and the second time in the proof of Corollary 1 to obtain a pseudodeterministic construction for from the discrepancy set. The first use of the assumption can be eliminated by using a stronger hardness assumption with respects to circuits that have oracle access to , but the second use seems essential.
3.2 Unconditional Constructions that Work Infinitely Often
By using in addition uniform hardness-randomness tradeoffs, we obtain unconditionally that there are pseudodeterministic constructions for easy dense sets in polynomial time, or else there are deterministic constructions for easy dense sets in subexponential time which work infinitely often. In fact, we obtain the following stronger result stating that in either case, there is a generic hitting set family that works simultaneously for all easy dense sets where the easiness and density parameters are fixed in advance.
Theorem 8 (Restatement of Theorem 2).
Let be any constant. At least one of the following is true:
-
1.
There is a pseudodeterministic algorithm running in polynomial time such that is a hitting set family for every -dense property decidable in time .
-
2.
For each , there is a deterministic algorithm running in time , such that is an i.o. hitting set family for every -dense property decidable in time .
We now give the proof of Theorem 8. Informally, the proof is a “win-win-win” argument using uniform hardness-randomness tradeoffs. We will describe two candidate hitting set families and computable in sub-exponential time, the first based on the “easy witness” method of Kabanets [22], and the second based on the uniform hardness-randomness tradeoffs of Impagliazzo-Wigderson and Trevisan-Vadhan [20, 30]. We will show that if there is a sufficiently easy dense property such that is not an i.o. hitting set family for , then . We will also show that if there is a sufficiently easy dense property such that is not an i.o. hitting set family for , then . Thus, in each of these cases, we either “win” for each sufficiently easy dense property by computing an i.o. hitting set family in sub-exponential time, or we have a complexity collapse. Finally, we show how to “win” in the case that both complexity collapses occur, by using Lemma 1. The win in this case is in the form of a polynomial-time pseudodeterministic algorithm which outputs a hitting set family for each sufficiently easy dense property. When either of the first two wins occur, item 2 of Theorem 8 holds, and when the third win occurs, item 1 holds.
Fix a as in the statement of Theorem 8, and let be any constant. The candidate hitting set families and depend on , but we work with a fixed arbitrarily small through the proof, and therefore do not need to formalize this dependence.
We first define the candidate hitting set family . Consider the set of all Boolean circuits on input variables and of size at most , where . Each circuit computes a Boolean function , and its truth-table is a string of length . We consider the following family obtained from :
By our choice of and a standard upper bound on the number of small circuits (cf. [1]), there are at most strings in . Furthermore, an ordered list containing all such strings can be printed in time .
The following lemma is key to our analysis of .
Lemma 2.
If there is a -dense property decidable in deterministic time such that is not an i.o. hitting set family for , then .
Proof.
Let , and be a polynomial time verifier that decides in time , where . In other words, if then , while if we have . By assumption, there is a -dense property decidable in deterministic time such that whenever , where is a fixed constant. Let be a deterministic Turing machine running in time for large enough, and deciding .
The following zero-error algorithm decides in polynomial time. Let be the input string of . If , outputs the correct answer by storing it on its code. Otherwise, consider the Boolean circuit of size at most obtained from by fixing its first input to . In order to decide on it is enough to estimate the acceptance probability of with additive error at most .
Let , , and assume from now on that . Let be the polynomial time computable function from Theorem 6, and be the respective constants for our choice of . Finally, set , and .
Algorithm samples independent uniformly distributed strings . Let be the first string on this list such that , if such string exists. Otherwise, aborts its computation. Using the hypothesis that is -dense, we get that whenever is sufficiently large, algorithm succeeds with high probability in finding a string of this form. By redefining , we can assume without loss of generality that succeeds whenever .
Since and , it follows from our previous discussion that . In other words, is not the leftmost segment of the truth-table of a Boolean function of circuit complexity at most .
Let be the Boolean function encoded by the string completed with zeroes until the next power of two. The previous paragraph implies that has circuit complexity greater than . It follows from Theorem 6 that is a generator that -fools circuits of size at most . Since and are efficiently computable in , can compute on every input in time . Moreover, the seed length of is . By standard methods, i.e. by trying all possible seeds of and taking a majority vote using , it follows that can efficiently decide whether is in . In addition, it is clear that decides with zero-error, since it aborts (with a small probability) when a good string is not found. Consequently, , which completes the proof of Lemma 2. ∎
Next we define the candidate hitting set family . Assume that the -complete language from Theorem 7 can be decided in space , where . Let . Consider the function obtained from an application of Theorem 7 with stretch parameter and the parameter set as in the statement of Theorem 2. This gives a sequence of functions computable with oracle access to in time , where each . Consider a seed function , and let . Since , we have
In addition, can be computed in time without access to an oracle. This is because the oracle answers to can be computed within this running time due to our choice of parameters and the fact that bounded-space algorithms run in time at most exponential.
Each set is obtained from as follows:
The following lemma is key to our analysis of .
Lemma 3.
If there is a -dense property decidable in deterministic time such that is not an i.o. hitting set family for , then .
Proof.
If is not an i.o. hitting set family for , it must be the case that for every large enough . Equivalently, , where . Since is surjective as a function in , for every large enough ,
On the other hand, is a -dense property, and for large enough ,
using as in Theorem 7. Furthermore, by assumption there is a deterministic Turing machine running in time at most on inputs of length for large enough , and deciding . Therefore, it can be used as a distinguisher against , matching the parameters of Theorem 7. Thus , completing the proof of Lemma 3. ∎
We complete the proof of Theorem 8 using a third and final application of the hardness versus randomness paradigm. If is an i.o. hitting set family for every -dense property decidable in deterministic time , the second item of Theorem 8 holds by letting be the deterministic algorithm which, on input , outputs in time . If not, then we have by Lemma 2. If is an i.o. hitting set family for every -dense property decidable in deterministic time , then again, the second item of Theorem 8 holds by letting be the deterministic algorithm which, on input , outputs in time . If not, then we have by Lemma 3. Thus, if the second item of Theorem 8 fails to hold, we have the complexity collapse . This facilitates a zero-error pseudodeterministic construction of an unconditional hitting set in polynomial time as follows.
First, it follows by direct diagonalization that there is a language computed in that requires circuits of size for every large . From , a standard padding argument implies that this language can be computed in . In other words, there is a function in that for every large cannot be computed by circuits of size .
Now, by setting in Lemma 1, we have that there is a pseudodeterministic algorithm running in polynomial time such that is a -discrepancy set family for every property decidable in deterministic time , and consequently a hitting set family for every -dense property decidable in deterministic time . This completes the proof of Theorem 8. ∎
Remark 2.
Observe that the argument presented above provides a stronger discrepancy set in the first case of Theorem 8. While this is not needed in our applications, it might be helpful elsewhere.
The generic Theorem 8 can be used to show unconditionally the existence of certain kinds of explicit constructions for easy dense properties.
Corollary 2.
Let be any easy dense property. Then for each , there is an i.o. zero-error pseudodeterministic construction for in time .
To establish Corollary 2, note that if the first item of Theorem 8 holds, a zero-error pseudodeterministic construction for in polynomial time follows exactly as Corollary 1 follows from Lemma 1. On the other hand, if the second item of Theorem 8 holds, for every , there is an i.o. deterministic construction for in time , just by computing the i.o. hitting sets for and outputting the lexicographically first element of the hitting set in , if such an element exists, and an arbitrary fixed string otherwise. Thus, in either case, for every there is an i.o. zero-error pseudodeterministic construction for in time .
We could trade off the parameters of items (1) and (2) of Theorem 8 to obtain a stronger bound on the running time of the construction in Corollary 2 by using a more general version of Theorem 6, but we do not pursue this direction here, as a polynomial-time bound for the construction does not appear to be provable using such an approach.
Corollary 2 also has a non-constructive element. We know that for any easy dense , there is an i.o. zero-error pseudodeterministic construction, but we are unable to say explicitly what this construction is, as we do not which of the worlds PSEUDO or SPARSE we live in. Also, similarly to Theorem 8, we do not have any information on the set of input lengths for which the construction works, except that it is infinite. This can be a somewhat unsatisfactory situation where explicit constructions are concerned, and we show how to address both issues in Section 3.4.
Corollary 3 (Restatement of Theorem 1).
For each , there is an i.o. zero-error pseudodeterministic construction for in time .
Corollary 3 follows from Corollary 2 because is -dense by the Prime Number Theorem, and is in deterministic polynomial time by the Agrawal-Kayal-Saxena algorithm [2].
Using the ideas of the proof of Theorem 8, we can partially answer a question of the Polymath 4 Project on generating primes. The following question was posed there: does imply a polynomial-time algorithm for generating primes? We consider a much weaker assumption, namely that for some fixed constant . Under this assumption, we show that there is a subexponential-time deterministic algorithm for generating infinitely many primes.
Theorem 9.
If there is a such that , then for each there is a deterministic algorithm running in time such that for infinitely many , is an -bit prime.
Proof.
We just give a sketch, as the argument largely relies on the proof of Theorem 8. The proof of Theorem 8 establishes that if , there is a subexponential-time algorithm for generating an i.o. hitting set family for sufficiently easy dense properties, and hence an i.o. deterministic construction for primes in subexponential time.
Now consider the case that . Either we have that admits polynomial-size circuits, or it does not. In the latter case, by using Theorem 6, we again have subexponential-time generatable hitting sets for properties that are easy and dense, and hence an i.o. deterministic construction for primes in subexponential time. In the former case, by standard Karp-Lipton theorems [23], , and hence . But in this case, the assumption that gives a contradiction to the almost-everywhere deterministic time hierarchy theorem. This concludes the argument. ∎
As an example of how the generic nature of Theorem 8 is useful, consider the question of generating incompressible strings. Let be a polynomial time computable function. We say that is a compression scheme if is an injective function and on every , . We use to denote the set of -almost incompressible strings.
Corollary 4.
Let be an arbitrary polynomial time compression scheme. For every , there is a zero-error pseudodeterministic algorithm running in time such that on infinitely many values of , outputs an -almost incompressible string of length .
Proof.
Observe that can be decided in polynomial time, since is a polynomial time computable function. Let . By a simple counting argument that uses the injectivity of , for every we have . Consequently, is a dense language. The result now follows immediately from Corollary 2. ∎
3.3 Pseudodeterministically Sampling Distributions
In order to state the main result of this section we will need the following additional definition.
Samplable Distributions. Let be an ensemble of probability distributions, where each is supported over . For a string , we let denote the probability of under . We say that is polynomial time samplable if there exists a polynomial time computable function for which the following holds:
-
•
There exists an integer such that for every , .
-
•
There exists such that for every , .
-
•
For every and , . In other words, and are equally distributed conditioned on the output of being different from the error symbol “”.
Observe that the support of each is not required to be efficiently computable.
We define the computational problem of generating a canonical sample from in the natural way. In other words, given , the algorithm must produce a “canonical” string in the support of . Since every dense and easy property is polynomial time samplable, this setting provides a generalization of the explicit construction problem associated with such properties. (Observe that the difficulty of producing a canonical sample comes from the fact that the polynomial time function can fail with high probability. Of course, if never fails, it is enough to output, say, .)
Theorem 10 (Pseudodeterministic Samplers in Subexponential Time).
Let be a polynomial time samplable ensemble. Then admits subexponential time randomized algorithms that output a canonical sample from for infinitely many values of .
(We stress that the pseudodeterministic sampler from Theorem 10 is not zero-error: it will output on every input where it succeeds a fixed sample in the support of with very high probability, but it might output a different sample in with negligible probability. On the input lengths where it fails, it will never output a sample.)
Proof.
The argument is a reduction to Theorem 8, or more precisely, to Corollary 2. First, we partition into infinitely many sets , where is the positive integer provided by the definition of the polynomial time samplable ensemble , and . Let be the polynomial time computable function associated with . For convenience, given a string and an interval , we use to denote the substring of with coordinates in . Next we define a property via the following polynomial time algorithm . On an input , let be the unique positive integer such that . computes , and accepts if and only if .
We claim that is dense and efficiently computable. First, observe that , since . Consequently, , and since is polynomial time computable, so is . Similarly, using that has a non- output with inverse polynomial probability and that and are polynomially related, it follows that is a dense property.
Using the claim from the previous paragraph and Corollary 2, it follows that for every , admits a zero-error pseudodeterministic constructor running in zero-error time that succeeds on infinitely many values of . We argue next that each can be used to sample a canonical string from for infinitely many values of , where and are polynomially related.
Fix an arbitrary algorithm as above. Since is a zero-error algorithm, we can assume without loss of generality and increase of running time that on every input where it succeeds, its output is with probability at most . We define from a randomized algorithm that computes as follows. Given an input of the form , we run on every using independent random strings of length . Let be the smallest element in such that among such executions, if it exists, and let be the random variable denoting the first bits of the output of for . We set the output of to in this case, and to if no such exists. This completes the construction of from and .
First, observe that is a randomized algorithm that runs in time , since each is of size , there are polynomially many simulations of on input , each running in time at most , and is polynomial time computable. In order to argue the correctness of , recall that each succeeds on infinitely many values of , and that the sets form a partition of into infinitely many classes of finite size. Therefore, for infinitely many values of , there will be some where succeeds. Furthermore, using that whenever succeeds it does so except with an exponentially small failure probability, we have that with very high probability will be the smallest such on each interval where succeeds somewhere. Consequently, either fails with probability on a bad interval (where fails everywhere), or it outputs with high probability a fixed sample from . The last conclusion relies also on the definition of and on the fact that is a (infinitely often) zero-error pseudodeterministic constructor for . (We observe that is not zero-error because may succeed on more than one input length in , and it can happen with negligible probability that will use a different substring of length during its computation.)
Finally, by taking arbitrarily small and using that is constant, it follows that admits subexponential time randomized algorithms that output a canonical sample from for infinitely many values of . ∎
We describe here an immediate application of Theorem 10 that might be of independent interest in complexity theory, in certain situations where one has to select a hard function among a family of efficiently representable functions.
Suppose there is a polynomial time randomized algorithm that on input outputs some Boolean circuit with non-negligible probability, and fails otherwise (the algorithm is allowed to output different circuits among different executions). Let be the random variable that denotes either “” or the polynomial size circuit output by this algorithm, and be the corresponding Boolean function whenever .
It follows from Theorem 10 that there is a subexponential time randomized algorithm that selects a canonical circuit for infinitely many values of , and that outputs a circuit computing, say, the constant function on the remaining values of . In particular, if every circuit in the support of the original algorithm computes a Boolean function with a certain desired property, there is a fixed Boolean function in that has the same property infinitely often. (Observe though that if on every only most functions have some property, but not all of them, we cannot guarantee that will share this property on infinitely many input lengths.)
3.4 Unconditional Constructions that are Explicit
In this section, we show how to make our constructions for easy dense properties explicit, in the sense that the algorithm implementing the construction is an explicit algorithm. Consider for instance the problem of pseudodeterministically generating primes. Since Theorem 1 establishes that some algorithm runs in sub-exponential time and outputs a canonical prime infinitely often, a natural approach would be to employ a universal search procedure that runs all algorithms with short descriptions until a prime is produced. Unfortunately, this idea does not seem to work when the algorithms involved are randomized and we would like to maintain pseudodeterminism.
We will employ a different strategy which will actually give us a bit more. In addition to addressing the issue of explicitness, we also control the gaps between input lengths on which the construction succeeds. However, this comes at the cost of tailoring the construction to a specific easy dense property, and the proof becomes more intricate. For simplicity, we will focus on bounded-error pseudodeterministic constructions for . This corresponds to a simpler version of Theorem 8, where we not consider the hitting set family obtained using the easy witness method, and do a win-win analysis based on the hitting set family rather than a win-win-win analysis. In this variant setting, we will consider bounded-error pseudodeterministic polynomial time constructions for , rather than zero-error ones.
Recall that a fundamental issue with obtaining an explicit algorithm using the proof of Theorem 2 is that we do not know which of the worlds PSEUDO and SPARSE we live in (Section 1.4). There is an explicit algorithm corresponding to the world SPARSE, but we only obtain an explicit algorithm corresponding to the world PSEUDO if the algorithm for SPARSE fails on all large enough input lengths, and we do not know a priori if this is the case.
Imagine the following ideal situation: the win-win analysis we carry out works input length by input length. Namely, for each large enough input length , a given candidate hitting set constructible in deterministic subexponential time works, or else a different candidate hitting set constructible in pseudodeterministic subexponential time works. If we were in this ideal world, we would get an explicit construction for each large enough length as follows. We first test each element in for primality, in some fixed order. If at least one of the tests succeed, we output the first element satisfying a test. If not, we generate and again test the elements in some fixed order for primality. Now we are guaranteed to succeed by the assumption that the win-win analysis succeeds on each large enough input length, and as is generated pseudodeterministically, we will output a fixed prime with high probability.
However, we are quite far from being in this ideal situation. Indeed, our argument that a pseudodeterministic algorithm succeeds relies on the hitting set family failing for all large enough input lengths, rather than on a single input length . This enables us to obtain the complexity collapse and apply Lemma 1.
If we are to have any hope of controlling the set of input lengths on which the construction succeeds using such an argument, we need to mitigate this issue. Note that if we are only interested in a pseudodeterministic construction in subexponential time, the collapse is overkill; it is enough to have .
Consider the -complete language in the statement of Theorem 7. The first element of our new argument is a refined version of Theorem 7, which for any , yields a probabilistic algorithm solving correctly on inputs of length in time assuming that the hitting set family fails at all input lengths , where is some constant depending on . Thus we now only need the failure of the hitting set family on some polynomially bounded range of input lengths to obtain a complexity collapse consequence, albeit a milder one than before.
We also observe that this refined version can be used in an alternative argument for generating primes pseudodeterministically, by reducing the search version of on input length to the -complete language on some polynomially larger input length . Hence, if we knew that the probabilistic algorithm based on the failure of the hitting set family for a polynomially bounded range of input lengths solved correctly at some fixed input length , we would be able to construct primes pseudodeterministically at length in subexponential time.
However, we have no easy way of knowing this. The straightforward method would be to explicitly test the success of the hitting set family on the appropriate range of input lengths, but this could take more than exponential time.
Imagine instead the pseudodeterministic algorithm we wish to define being given a single advice bit per input length. If this advice bit is at length , it indicates to the algorithm that the hitting set family does indeed fail on all input lengths in ; if the advice bit is , it indicates that the hitting set family succeeds somewhere on that range. The point is that the requisite information is just a single bit depending on the input length . The advice bit can be thought of as information for the algorithm about whether the world looks locally like PSEUDO or SPARSE, even if we do not know what the global picture is.
If the algorithm somehow had access to this advice bit, it could act as follows: if the advice bit were , it would know that the probabilistic algorithm given by the refined version of Theorem 7 solves correctly at input length , and by using the reduction from the search version of to and simulating the probabilistic algorithm when needed, it could pseudodeterministically output a prime in subexponential time. If the advice bit were , “all bets are off”, and the algorithm simply halts without an output.
For those readers familiar with the work on hierarchies for probabilistic polynomial time with advice [4, 10], the use of a advice bit here might be reminiscent of that work. The similarity is that the advice bit is a way around constructibility issues, but the details are different.
An advantage in our setting is that while the advice bit might be conceptually useful, it is not really needed. The reason is that while the algorithm might not have the time to check if the hitting set family fails on all input lengths in a polynomially large range around , it certainly can check if is a hitting set for in deterministic subexponential time. If it is, the algorithm outputs the first prime in , and we are done. If not, then the algorithm behaves as if the advice bit were . The algorithm with this behaviour will not always be correct, but it will always succeed on some input length in any polynomially large enough interval of input lengths. Moreover, the algorithm is explicit. We are exploiting here the fact that the world SPARSE is a deterministic world, and that we can check deterministically and not too inefficiently whether a given hitting set works at an input length.
We now give details, but first some extra notation.
Polynomial Gaps. We call a set polynomially gapped if is non-empty and there is a constant such that for any , there is , .
We require the following refinement of Theorem 7, which holds for the same language discussed before.
Theorem 11.
For any integers , there exists an integer and a function with restrictions
such that can be computed in time when given oracle access to , and the following holds. For every , there is a and a probabilistic algorithm such that for any large enough for which the output of can be -distinguished from random for every by an algorithm running in time , when given access to , and to the description of , runs in time , and computes with error at most over its internal randomness.
Proof.
We give only a sketch, as the proof refines the proof of Theorem 7. The proof of Theorem 7 proceeds by showing that a distinguisher for the output of can be used to learn circuits for on input length polynomially related to . By using the random self-reducibility and downward self-reducibility properties of and hardness amplification, a distinguisher implies a polynomial-time probabilistic oracle algorithm that outputs circuits for , where the oracle algorithm only makes -queries of length . By using the distinguishing property for each length , circuits for can be learned iteratively in probabilistic polynomial time for input lengths from to , and thus can be decided in probabilistic polynomial time on any input of length .
Suppose that we wish to compute on inputs of length . The main idea in our refinement here is to begin the iteration at input length , where is chosen depending on , so that a circuit of size for at length can be computed in time using brute-force search and the fact that is in polynomial space. Now we use the distinguishing property for each length to obtain learners for corresponding input lengths for , and thus iteratively build circuits for for all input lengths up to . Then it is enough to run the circuit for length to evaluate on any input of that length. The total time taken is , if we choose sufficiently small as a function of . ∎
Theorem 12 (Restatement of Theorem 3).
For every , there is a polynomially gapped set and a (bounded-error) pseudodeterministic construction for on , running in time .
Proof.
Let be any constant. We show that there is a polynomially gapped set and a pseudodeterministic algorithm on such that for each , the canonical output of is an -bit prime, and moreover always halts in time .
Define the language to consist of all tuples such that the ’th bit of the lexicographical first -bit prime is , where . By Bertrand’s Postulate, is well-defined. It is easy to see that this language is decidable in polynomial space, as follows. Enumerate the -bit integers in order and check each one for primality until an integer is found that passes the primality test. Accept on input iff the ’th bit of is . Since is in and is -complete, there is a constant such that reduces to in deterministic time .
Let be an integer to be determined later. We partition into intervals , where for , and . We define the algorithm and show that it satisfies the required properties for at least one input length in each , when is large enough. The algorithm operates in two phases, the first of which is deterministic and the second probabilistic.
Let be a constant such that is computable in deterministic time on inputs of length , and let be a constant such that the Primality algorithm of [2] runs in deterministic time . operates as follows on input . It first invokes the generator from Theorem 11 using parameters and as chosen above, on input length . It computes in time , exploiting the efficiency guarantee for from Theorem 11 and the fact that is computable in deterministic time . It checks each element of in lexicographic order for primality, outputting the first -bit prime in that it finds, if such a prime exists. Given , the total time required for this testing is , which is .
If no element of is prime, commences its probabilistic phase. It sets in the second part of Theorem 11; let be the corresponding constant given by the theorem. attempts to compute an -bit prime in probabilistic time as follows. It tries to determine for each satisfying , whether by using the reduction from to , which produces instances of length . It answers each query to by assuming that -distinguishes from random for each , where is as defined in the previous para, and running the corresponding algorithm on , , and the code of the AKS primality algorithm. By Theorem 11, if does indeed distinguish the output of the generator from random for the given range of input lengths, the algorithm decides correctly with error at most , since . Hence, in this case, by a simple union bound, all queries of to are answered correctly with probability at least , using the fact that , and hence correctly determines all the bits of the lexicographically first -bit prime with error at most . Thus, in this case, a fixed prime is output with probability at least , which fulfils the bounded-error pseudodeterministic guarantee for . Using that and the bound on the running time of given by Theorem 11, it follows that halts in time .
We argue that for each interval of input lengths for large enough, there is such that either one of the elements of is prime, or outputs a fixed prime with high probability using the reduction to as in the previous para. Note that in the first case, the deterministic phase of the algorithm has an output and the algorithm does not enter its probabilistic phase, while in the second case, the probabilistic phase has a fixed output with high probability. In either case, operates pseudodeterministically on input and outputs a prime.
We set to be , where and are as above. If there is no in such that at least one of the elements of is prime, and if is large enough, then it is indeed the case that -distinguishes from random for each , where , just using the fact that is -dense for large enough . Hence, in this case, does output the lexicographically first prime on bits with probability , which concludes the argument. ∎
To compare Theorem 12 to Corollary 3, the advantages of the former are that the algorithm is explicit, and that the input lengths for which it is guaranteed to produce primes are not too far apart. However, a somewhat subtle advantage of Corollary 2 is that the construction is guaranteed never to output two different primes on any input length – it either outputs a fixed prime with high probability, or does not output a prime at all. With the construction of Theorem 12, this might not be the case. The algorithm has the bounded-error pseudodeterministic guarantee on at least one input length in each large enough interval, but there is no guarantee on the behaviour of the algorithm for other input lengths in the interval. This situation can be improved using Proposition 2.
Finally, we remark that one of the difficulties involved in proving a zero-error version of Theorem 12 is that it seems one would need to convert a sub-exponential time bounded-error randomized computation into a zero-error computation, as opposed to the relevant simulation behind the proofs of Theorem 8 and Corollary 3, which is concerned with polynomial-time computations.
4 Pseudodeterminism and Derandomization
In order to state the results of this section we will need a few additional definitions. Here we work with ensembles of distributions, where we assume that each is supported over . Moreover, we say that such a sequence of distributions is polynomial-time samplable if there is a randomized polynomial-time algorithm (the sampler) such that for each and each , , where . As usual, we use to refer to the uniform distribution on -bit strings, which is clearly polynomial-time samplable. In some cases we view elements of as descriptions of Boolean circuits of size at most , under some natural encoding. We may informally refer to as a distribution instead of as an ensemble of distributions.
We define various notions of derandomization on average over polynomial-time samplable distributions . Our setting closely mirrors that of Impagliazzo-Wigderson [20], and our proofs are inspired by their ideas.
Average-Case Definitions. Let be a function. We say that a sequence , where each , is a PRG (resp. i.o.PRG) on average over a distribution of Boolean circuits if for each and for large enough (resp. for infinitely many ), -fools with probability at least over . We call the seed length of the PRG.
Let be a time bound. We say that the Circuit Acceptance Probability Problem () is solvable in time (resp. solvable infinitely often in time ) on average over if for all there is a deterministic algorithm running in time such that for all (resp. for infinitely many ), .
Let a language. We say that is solvable in time (resp. solvable infinitely often in time ) on average over if for all there is a deterministic algorithm running in time which for all (resp. infinitely many ) solves with success probability at least over . Given a function , we also use the notion of being solvable in time with bits of advice on average over – here the algorithm solving gets access to an auxiliary advice string of length which depends only on the input length.
We say that is solvable pseudodeterministically in time (resp. solvable infinitely often pseudodeterministically in time ) on average over if for all there is a randomized algorithm running in time such that for all (resp. infinitely many ), with probability at least over , outputs the same number with probability over its internal randomness, and is a -additive approximation to the acceptance probability of .
The lemma below is implicit in [30], which itself uses a variation of the argument in [20]. We omit the proof because it is almost identical to the proof of Theorem 7.
Lemma 4.
We prove the following unconditional result on the (randomized) pseudodeterministic complexity of .
Theorem 13 (Restatement of Theorem 4).
For each and polynomial-time samplable distribution , is solvable infinitely often pseudodeterministically in time on average over .
Proof.
Let be any polynomial-time samplable distribution and be any constant. We show that at least one of the following holds: (1) is solvable pseudodeterministically in time in the worst case, or (2) is solvable infinitely often deterministically in time on average over .
Let be the sequence of generators given by Lemma 4, and consider the algorithm that works as follows given a input circuit represented by a string of length . counts the fraction of outputs of accepted by , and outputs this fraction. If is an i.o.PRG on average over , the algorithm solves infinitely often on average over , since does not output a -approximation for if and only if -distinguishes the output of from a random -bit string. The algorithm can be implemented in time using the fact that is computable in time . Thus item (2) holds in this case.
If is not an i.o.PRG on average over , then we can apply Lemma 4 to get . In this case, by a simple translation argument, we have that , and since requires circuits of size on all large enough by direct diagonalization, we have that requires circuits of size on all large enough . Now by Lemma 1 and Remark 1, we have a pseudodeterministic polynomial time algorithm which outputs a discrepancy set family which works for any circuit of size for large enough , and hence again by outputting the fraction of elements in the discrepancy set which belong to , we get a worst-case pseudodeterministic polynomial time algorithm solving . ∎
Finally, we establish the following equivalences. Note that all algorithms mentioned below are deterministic.
Theorem 14 (Restatement of Theorem 5).
The following statements are equivalent:
-
1.
For each polynomial-time samplable distribution of Boolean circuits and each , there is an i.o.PRG on average over with seed length that is computable in time .
-
2.
For each polynomial-time samplable distribution over Boolean circuits and each , is solvable infinitely often in time on average over .
-
3.
For each polynomial-time samplable distribution over input strings and each , is solvable infinitely often in time with bits of advice on average over .
-
4.
For each , is solvable infinitely often in time on average over .
Proof.
The equivalence is established by the following chain of implications.
: Fix a distribution , and let be some PRG for that is guaranteed to exist by item (1). The algorithm for on a circuit of size simply runs on all seeds of size and counts the fraction of seeds for which accepts. It outputs this fraction. Clearly, the algorithm can be implemented in time , as is computable in that amount of time. The correctness of the algorithm follows immediately from the guarantee on the PRG given by (1).
: Fix a distribution , let , where is a fixed constant, and let be a bounded-error probabilistic Turing machine solving in time with error for large enough. To solve infinitely often in time on average over , we invoke the algorithm given by item (2) for the distribution specified below, and parameter .
To sample from the distribution on -bit strings, we first determine . We sample an input of length from , then compute the randomized circuit obtained by applying the standard translation of randomized algorithms to circuits to the computation of on . We then pad in a standard way to an equivalent circuit of size . has input of length , but we can simply pad the input length to using dummy input bits. Clearly is polynomial-time samplable, and hence there is an algorithm as above solving infinitely often on average over in time , which is at most .
We show how to solve infinitely often in time with bits of advice on average over . We define a deterministic machine taking bits of advice as follows. On input of length , uses its advice to determine a length such that . finds a randomized circuit corresponding to the computation of on by performing the standard translation, and then pads this circuit in the standard way to a circuit on input bits. It applies the algorithm to , accepting if and only if outputs a number greater than .
We are given that solves infinitely often in subexponential time on average over , and we would like to conclude that solves infinitely often in subexponential time on average over . Indeed, let be an infinite sequence of input lengths on which solves in subexponential time on average over . It is not hard to see that is an infinite sequence of input lengths on which solves in subexponential time with logarithmic advice on average over .
: It follows immediately from item (3) that for each , is solvable infinitely often in time with advice on average over , simply because is polynomial-time samplable. Corollary 7 and Corollary 9 of [20] then imply that for each , is solvable infinitely often in time on average over .
: Here we use Lemma 4. By diagonalization (cf. Theorem 6 in [20]), we have that (4) implies . Now there are two cases: either does not have polynomial-size circuits, or . Indeed, if both were false, we would have that (by the Karp-Lipton theorem for ) and that , which would together imply , contradicting our assumption.
In the first case, by the hardness-randomness tradeoff of [5], it follows that for each there is an i.o.PRG with seed length , which is computable in time . Note that this i.o.PRG works even in the worst case, without a distributional assumption on circuits it fools. In the second case, we use Lemma 4 to conclude that for each polynomial-time samplable sequence of distributions and for each , there is an i.o.PRG with seed length on average against , computable in time . Hence in either case (1) follows, concluding our proof. ∎
5 Further Directions
We propose some directions for further research:
-
1.
Theorem 1 is proved using general complexity-theoretic considerations, using no information about the set apart from its polynomial density and its decidability by a polynomial-time algorithm. The primes have been intensively studied, and a lot is known about their structure. Can this structural information be leveraged to prove stronger results about generating primes? Perhaps the technique of using complexity-theoretic pseudorandomness applied here could be combined with earlier ideas for generating primes deterministically to show stronger results.
-
2.
Can other kinds of probabilistic algorithms be made pseudodeterministic? In very recent work, we use our ideas to give such algorithms unconditionally for various approximate counting problems.
-
3.
Are black-box derandomization, white-box derandomization and equivalent in the standard setting? Here, by the standard setting, we mean that we are interested in worst-case polynomial-time simulations that work for all large enough input lengths. As a first step toward this goal, it would be interesting to get the equivalence for average-case simulations, where we are even prepared to relax the “works almost everywhere” condition on the simulation to “works infinitely often”.
6 Acknowledgements
We acknowledge useful discussions with Scott Aaronson, Valentine Kabanets, Jan Krajíček, James Maynard, Toni Pitassi and Amnon Ta-Shma. Part of this work was done while the first author was visiting the second, funded by the second author’s ERC Consolidator Grant no. 615075.
References
- AB [09] Sanjeev Arora and Boaz Barak. Complexity Theory: A Modern Approach. Cambridge University Press, 2009.
- AKS [02] Manindra Agrawal, Neeraj Kayal, and Nitin Saxena. PRIMES is in P. Ann. of Math., 2:781–793, 2002.
- ASS [01] Eric Allender, Michael E. Saks, and Igor E. Shparlinski. A lower bound for primality. J. Comput. Syst. Sci., 62(2):356–366, 2001.
- Bar [02] Boaz Barak. A probabilistic-time hierarchy theorem for ”slightly non-uniform” algorithms. In 6th International Workshop on Randomization and Approximation Techniques, pages 194–208, 2002.
- BFNW [93] László Babai, Lance Fortnow, Noam Nisan, and Avi Wigderson. BPP has subexponential time simulations unless EXPTIME has publishable proofs. Computational Complexity, 3:307–318, 1993.
- BHP [01] Roger Baker, Glyn Harman, and Janos Pintz. The difference between conseuctive primes, II. Proceedings of the London Mathematical Society, 83(3):532–562, 2001.
- Coh [16] Gil Cohen. Two-source dispersers for polylogarithmic entropy and improved Ramsey graphs. In Symposium on Theory of Computing (STOC), pages 278–284, 2016.
- CZ [16] Eshan Chattopadhyay and David Zuckerman. Explicit two-source extractors and resilient functions. In Symposium on Theory of Computing (STOC), pages 670–683, 2016.
- For [01] Lance Fortnow. Comparing notions of full derandomization. In Conference on Computational Complexity (CCC), pages 28–34, 2001.
- FS [05] Lance Fortnow and Rahul Santhanam. Hierarchy theorems for probabilistic polynomial time. In Proceedings of 45th Symposium on Foundations of Computer Science, pages 316–324, 2005.
- GG [11] Eran Gat and Shafi Goldwasser. Probabilistic search algorithms with unique answers and their cryptographic applications. Electronic Colloquium on Computational Complexity (ECCC), 18:136, 2011.
- GG [15] Shafi Goldwasser and Ofer Grossman. Perfect bipartite matching in pseudo-deterministic RNC. Electronic Colloquium on Computational Complexity (ECCC), 22:208, 2015.
- GGR [13] Oded Goldreich, Shafi Goldwasser, and Dana Ron. On the possibilities and limitations of pseudodeterministic algorithms. In Innovations in Theoretical Computer Science (ITCS), pages 127–138, 2013.
- Gol [08] Oded Goldreich. Computational Complexity - A Conceptual Perspective. Cambridge University Press, 2008.
- Gol [11] Oded Goldreich. In a world of P = BPP. In Studies in Complexity and Cryptography, pages 191–232. 2011.
- Gro [15] Ofer Grossman. Finding primitive roots pseudo-deterministically. Electronic Colloquium on Computational Complexity (ECCC), 22:207, 2015.
- IKW [02] Russell Impagliazzo, Valentine Kabanets, and Avi Wigderson. In search of an easy witness: exponential time vs. probabilistic polynomial time. J. Comput. Syst. Sci., 65(4):672–694, 2002.
- Imp [95] Russell Impagliazzo. A personal view of average-case complexity. In Structure in Complexity Theory Conference (CCC), pages 134–147, 1995.
- IW [97] Russell Impagliazzo and Avi Wigderson. P = BPP if E requires exponential circuits: Derandomizing the XOR lemma. In Symposium on Theory of Computing (STOC), pages 220–229, 1997.
- IW [01] Russell Impagliazzo and Avi Wigderson. Randomness vs time: Derandomization under a uniform assumption. J. Comput. Syst. Sci., 63(4):672–688, 2001.
- Juk [12] Stasys Jukna. Boolean Function Complexity - Advances and Frontiers. Springer, 2012.
- Kab [01] Valentine Kabanets. Easiness assumptions and hardness tests: Trading time for zero error. J. Comput. Syst. Sci., 63(2):236–252, 2001.
- KL [80] Richard M. Karp and Richard J. Lipton. Some connections between nonuniform and uniform complexity classes. In Symposium on Theory of Computing (STOC), pages 302–309, 1980.
- LO [87] J. C. Lagarias and Andrew M. Odlyzko. Computing pi(x): An analytic method. J. Algorithms, 8(2):173–191, 1987.
- OS [16] Igor C. Oliveira and Rahul Santhanam. Conspiracies between learning algorithms, circuit lower bounds and pseudorandomness. Available on arXiv:cs.CC/1611.01190, 2016.
- San [12] Rahul Santhanam. The complexity of explicit constructions. Theory Comput. Syst., 51(3):297–312, 2012.
- Sho [90] Victor Shoup. New algorithms for finding irreducible polynomials over finite fields. Mathematics of Computation, 54(189):435–447, 1990.
- TCH [12] Terence Tao, Ernest Croot, III, and Harald Helfgott. Deterministic methods to find primes. Math. Comp., 81(278):1233–1246, 2012.
- Tre [06] Luca Trevisan. Pseudorandomness and combinatorial constructions. In International Congress of Mathematicians. Vol. III, pages 1111–1136. Eur. Math. Soc., Zürich, 2006.
- TV [07] Luca Trevisan and Salil P. Vadhan. Pseudorandomness and average-case complexity via uniform reductions. Computational Complexity, 16(4):331–364, 2007.
- Vad [12] Salil P. Vadhan. Pseudorandomness. Foundations and Trends in Theoretical Computer Science, 7(1–3):1–336, 2012.