Manuscript Offprint
arXiv:2609.35326and a Random-Oracle Proof of Toda's Theorem
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Almost- P = BP P and a Random-Oracle Proof of Toda's Theorem
Lance Fortnow
September 2026
Abstract
Using the recent exponential correlation bounds of Chattopadhyay, Hatami, Lee, Lovett, Tal and Viola between -polynomials and the XOR of majorities, we show that Almost- P = BP P = BPP P, where Almost- P is the class of languages in P for a random oracle with probability one. Combined with the easy fact that PH P relative to a random oracle, an idea going back to Regan and Royer, this gives a proof of the first half of Toda's theorem, PH BP P, in which no probabilistic quantifier ever has to be moved through an oracle. We compare the argument with the simple proof of Toda's theorem in Fortnow (2009).
where is chosen by putting each string in independently with probability . Bennett and Gill [BG81] and Ambos-Spies [AS86] characterized BPP as Almost-P, and Nisan and Wigderson [NW94], using a pseudorandom generator built from the hardness of parity for constant-depth circuits, showed Almost-PH = PH. The natural analogue for parity computation, Almost-P = BP P, requires a pseudorandom generator that fools polynomials over of degree poly on variables with seed length poly. Earlier generators for low-degree polynomials [Bog05, Lov09, Vio09] have seed length exponential in the degree and are useless here. The breakthrough correlation bound of Chattopadhyay, Hatami, Lee, Lovett, Tal and Viola [CHLLTV26] supplies exactly the generator we need.
Theorem 1.1. Almost- P = BP P = BPP P.
The motivation is Toda’s theorem [Tod91]. Relative to a random oracle , the polynomial hierarchy collapses into by nothing more than Valiant–Vazirani [VV86] and Papadimitriou–Zachos [PZ83] applied level by level; this observation is due to Regan and Royer [RR95], who showed that is properly contained in for a random oracle . Since every language in PH is in , Theorem 1.1 then yields .
2 Preliminaries
We identify an oracle with its characteristic sequence in and use the uniform (Lebesgue) measure . For a finite string let be the cylinder of oracles whose characteristic sequence begins with . All oracle machines are clocked, so a machine running in time queries only strings of length at most .
A language is in if there is a polynomial-time nondeterministic oracle machine such that if and only if has an odd number of accepting paths; we write for this parity. A language is in if there are and a polynomial with for every .
Fact 2.1 (Papadimitriou–Zachos [PZ83]). For every oracle , , and hence .
In particular is closed under polynomial-time Turing reductions, so can be amplified to error for any polynomial by taking majority votes, and [Tod91].
Fact 2.2 (Valiant–Vazirani [VV86]). Let be nonempty. Choose uniformly and a random affine map from to . Then . The choice uses random bits.
3 The generator
We need the generator of [CHLLTV26, Theorem A.1], whose analysis rests on their main theorem: for every polynomial of degree at most ,
where consists of blocks of bits and is odd. The construction in [CHLLTV26] uses a combinatorial design computed in time polynomial in the number of outputs. We have exponentially many outputs, so we substitute a polynomial-based design in which each set can be computed locally. The analysis is unchanged, and we include it for completeness.
Lemma 3.1. There is a polynomial s and, for each , a map such that
-
given and with , the bit can be computed in time , and
-
for every polynomial p over in the variables of degree at most ,
where Y is uniform on .
Proof. Let be the number of strings of length at most , and set , , , . Let be the least odd integer with , and let be the least power of two with , so .
Design. Fix a set of size , ordered. For a string with , write the string , padded on the left with zeros to length , as and let . Distinct give distinct polynomials of degree at most . Set . Then , and for we have since is a nonzero polynomial of degree at most .
Generator. The seed consists of blocks , so . Define
Computing takes poly(T) field operations, so item 1 holds.
Analysis. Order the strings of length at most as , and let consist of the first outputs of followed by independent uniform bits. Fix of degree at most and . Fix all seed bits outside in every block, together with the last bits. The remaining seed bits form uniform blocks , and output is . For , output is an XOR over of functions of , each depending on fewer than variables, so it is a polynomial of degree less than . For , let be with these outputs, the bit in position , and the fixed later bits substituted; then . Viewing bits as reals, the conditional difference between the acceptance probabilities under and is
by (1) and . Averaging over the fixed bits and summing over the hybrids bounds the total difference by .
4 Almost- P
Lemma 4.1 (Degree). Let be a nondeterministic oracle machine running in time . For every there is a polynomial over in the variables of degree at most such that for every oracle .
Proof. Let . Fix a sequence of nondeterministic choices. The computation along is a decision tree of depth at most in the oracle bits. The indicator of reaching a given accepting leaf is a product of at most literals or , and at most one leaf is reached, so the indicator that path accepts is the -sum of these products. Summing over all gives .
Lemma 4.2 (Uniformization). Let be a P oracle machine with . Then there is a P oracle machine with for every .
Proof. Let , an intersection of clopen sets and hence measurable. By outer regularity there is an open with . Write as a disjoint union of cylinders . Since , some has .
For an oracle let agree with on the first strings and with elsewhere. Let simulate , answering queries among the first strings from a hard-wired table. If is uniform then is uniform on , so , and in particular for each .
Proposition 4.3. Almost- P BP P.
Proof. Let . There are countably many oracle machines, so one of them, , has . Let be given by Lemma 4.2, with running time .
Fix of length and let . By Lemma 4.1, with , and also has degree at most . Since restricted to is uniform, Lemma 3.1 gives
Let . Then : simulate on , and answer each query by computing in polynomial time. Choosing uniformly from puts in .
Proposition 4.4. BP · ⊕P ⊆ Almost-⊕P.
Proof. Let , amplified so that and with . Let on read for deterministically and then run the machine for . Then , so by the Borel–Cantelli lemma, with probability one errs on only finitely many inputs. Patching those inputs with a finite table gives .
Propositions 4.3 and 4.4, together with BP · ⊕P = BPP⊕P, prove Theorem 1.1.
Remark 4.5. Only Proposition 4.3 is used below, and its proof uses nothing from Toda's paper. The same argument relativizes: for every oracle , , since Lemma 4.1 bounds the degree in the -variables for each fixed .
5 The polynomial hierarchy relative to a random oracle
Let and . Each language in is given by a finite specification: a tower of clocked oracle machines, with deterministic, nondeterministic with oracle for , and with oracle . We write for the language defined. Since is closed under join with , we may assume every has access to through its oracle. Composing the time bounds, there is a polynomial such that whether depends only on restricted to strings of length at most .
Theorem 5.1 (cf. Regan–Royer [RR95]). For every and every specification at level , we have . Consequently, .
Proof. The consequence follows because there are countably many specifications. We prove the first statement by induction on . For , for every .
Let be at level , so and . Write as a deterministic verifier: if and only if , where accepts} and is a polynomial. Let , so depends only on restricted to strings of length at most .
Hashing from far away. Let . For , read the random choices of Fact 2.2 from the bits of at the strings , ; all of these have length greater than . Define
For every the language is in : each bracket is a query and a polynomial-time machine takes the OR.
Error. If then . Condition on restricted to strings of length at most ; this fixes and leaves the hash bits uniform and independent. If , each isolates a unique element with probability at least , so
By the Borel–Cantelli lemma, with probability one and differ on only finitely many inputs.
Collapse. By induction, with probability one . For every in both probability-one events, Fact 2.1 gives , and is a finite variation of , so .
Remark 5.2. Reading the hash functions from strings longer than is what makes the argument work: an adversarial machine may query any string it can reach, and the Valiant–Vazirani analysis needs the hash functions to be independent of the witness set.
6 Toda's theorem
Corollary 6.1. PH ⊆ BP · ⊕P, and hence PH ⊆ P#P.
Proof. If then for some and every , so by Theorem 5.1, with probability one. Thus , and Proposition 4.3 gives . The second statement follows from Toda's inclusion [Tod91]; see [For09] for a short proof of that step.
7 Discussion
Regan and Royer. Regan and Royer [RR95] simplified Toda’s proof that and showed that is properly contained in relative to a random oracle . Theorem 5.1 is the containment half of their result. Going from the random-oracle statement back to Toda’s unrelativized theorem requires exactly Almost- , which is where the correlation bounds of [CHLLTV26] enter.
The 2009 simple proof. Toda’s original argument shows PH ⊆ BP · ⊕P by induction on the levels. Its main difficulty is showing BP · ⊕P^{BP·⊕P} ⊆ BP · ⊕P: the random bits inside an oracle must be amplified, chosen in advance, and pulled outside. The proof in [For09] avoids that step. Valiant–Vazirani gives NP ⊆ BPP^{⊕P}; relativizing to ⊕P and applying Papadimitriou–Zachos gives NP^{⊕P} ⊆ BPP^{⊕P}; and the relativized form of Zachos’s theorem [Zac88], that NP^{A} ⊆ BPP^{A} implies PH^{A} ⊆ BPP^{A}, applied with A = ⊕P gives PH ⊆ PH^{⊕P} ⊆ BPP^{⊕P}. The randomness bookkeeping is isolated inside Zachos’s theorem, whose proof amplifies and chooses the random bits before the nondeterministic guesses.
The random-oracle proof also avoids moving probabilistic quantifiers through oracles, but in a different way. The randomness is global: once is fixed, every level of the induction is an ordinary relativized inclusion of classes, and the probability enters only through a Borel–Cantelli argument about finitely many errors. Nothing is ever amplified inside an oracle. The price is paid once, at the end: an exponentially long random oracle has to be replaced by polynomially many random bits, and a P computation looks at the whole oracle through the parity of exponentially many paths. That replacement needs a generator fooling -polynomials of degree on variables with seed length , equivalently an explicit function with exponentially small correlation with polynomials of polynomial degree. Before [CHLLTV26], no such bound was known even for degree .
So the two proofs make opposite trades. The 2009 proof is elementary and self-contained. The random-oracle proof reduces the collapse of the hierarchy to a triviality and puts all of the difficulty into a single hardness-versus-randomness step, in the same way that Nisan and Wigderson [NW94] obtained Almost-PH = PH from the hardness of parity for constant-depth circuits. It needs a deep circuit lower bound to recover a theorem that has an elementary proof, but it explains the first half of Toda's theorem as a collapse that holds relative to a random oracle, plus a derandomization of that oracle.
Acknowledgment. This note was drafted with the assistance of Claude (Anthropic).
References
[AS86] K. Ambos-Spies. Randomness, relativizations, and polynomial reducibility. In Structure in Complexity Theory, volume 223 of Lecture Notes in Computer Science, pages 23–34. Springer, 1986.
[BG81] C. H. Bennett and J. Gill. Relative to a random oracle , with probability 1. SIAM Journal on Computing, 10(1):96–113, 1981.
[Bog05] A. Bogdanov. Pseudorandom generators for low degree polynomials. In Proceedings of the 37th ACM Symposium on Theory of Computing, pages 21–30, 2005.
[CHLLTV26] E. Chattopadhyay, P. Hatami, C. H. Lee, S. Lovett, A. Tal, and E. Viola. Exponential correlation bounds for polynomials. Electronic Colloquium on Computational Complexity, Report No. 208, 2026.
[For09] L. Fortnow. A simple proof of Toda's theorem. Theory of Computing, 5(7):135–140, 2009.
[Lov09] S. Lovett. Unconditional pseudorandom generators for low degree polynomials. Theory of Computing, 5(1):69–82, 2009.
[NW94] N. Nisan and A. Wigderson. Hardness vs randomness. Journal of Computer and System Sciences, 49(2):149–167, 1994.
[PZ83] C. H. Papadimitriou and S. Zachos. Two remarks on the power of counting. In Proceedings of the 6th GI Conference on Theoretical Computer Science, volume 145 of Lecture Notes in Computer Science, pages 269–276. Springer, 1983.
[RR95] K. W. Regan and J. S. Royer. On closure properties of bounded two-sided error complexity classes. Mathematical Systems Theory, 28:229–243, 1995.
[Tod91] S. Toda. PP is as hard as the polynomial-time hierarchy. SIAM Journal on Computing, 20(5):865–877, 1991.
[Vio09] E. Viola. The sum of d small-bias generators fools polynomials of degree d. Computational Complexity, 18(2):209–217, 2009.
[VV86] L. G. Valiant and V. V. Vazirani. NP is as easy as detecting unique solutions. Theoretical Computer Science, 47:85–93, 1986.
[Zac88] S. Zachos. Probabilistic quantifiers and games. Journal of Computer and System Sciences, 36(3):433–451, 1988.