Documentation

CslibFrontier.Computability.Complexity.Classes.Counting.OracleSpace

Counting oracles within polynomial space and the counting hierarchy #

An arbitrarily encoded #P function extends to a #P function on all words: use the finite native counting machine supplied by its machine characterization and count the branches halted by its polynomial clock. On valid codes this is the original function; on other words no halting claim is needed. Thresholding the extension gives the corresponding extension for PP languages.

The definitions of P^PP and P^#P require a single oracle program to work for every oracle agreeing on valid encodings. Choosing the total PP extension therefore puts these classes within PSPACE. In particular, this argument does not assume that an encoding's image is decidable. In the same way, if every #P function on words is computable in polynomial time, the bit graph of the total extension is a polynomial-time oracle, and P^#P collapses to P. Since the total extension is a PP language on words, it is also an oracle of the first level of the counting hierarchy, so P^PP lies in its second level C₂P = PP^PP; with Toda's theorem, so does PH.

Main results #

References #

theorem Cslib.Complexity.SharpP.exists_extension {α : Type} {enc : α ↪ List Bool} {f : α → ℕ} (hf : f ∈ SharpP enc) :
∃ g ∈ SharpP Turing.MultiTapeTM.encBits, ∀ (a : α), g (enc a) = f a

A #P function on an arbitrary encoded type extends to a #P function on all words. The extension counts branches halted by the machine's polynomial clock even on malformed codes.

theorem Cslib.Complexity.exists_PP_extension {α : Type} {enc : α ↪ List Bool} {A : Set α} (hA : A ∈ PP enc) :
∃ B ∈ PP Turing.MultiTapeTM.encBits, ∀ (a : α), enc a ∈ B ↔ a ∈ A

An arbitrarily encoded PP language has a total PP extension on words. No recognition of valid encodings is required: the clocked count is thresholded on every word.

Polynomial time with a PP oracle is contained in polynomial space, including arbitrary oracle-instance encodings and arbitrary answers outside their image.

P^PP ⊆ C₂P: polynomial time with a PP oracle lies in the second level of the counting hierarchy, PP^PP. The total PP extension of the oracle problem is a PP language on words, and a polynomial-time oracle program is a majority verifier relative to it. With Toda's theorem PH ⊆ P^PP Toda (Cslib.Complexity.PH_subset_PWithPPOracle) this gives PH ⊆ C₂P.

Polynomial time with a bit-by-bit #P oracle is contained in polynomial space.

If #P ⊆ FP, then P^#P = P: if every #P function on words is computable in polynomial time with binary output, every problem in P^#P is in P, at every instance encoding. The total word extension of the oracle's function (SharpP.exists_extension) is then computable in polynomial time, so its bit graph is a polynomial-time oracle answering every query on a valid code.