Documentation

CslibFrontier.Computability.Complexity.Classes.Oracle.PP

Polynomial time with a PP oracle #

P^PP relative to the encoding enc of instances (Cslib.Complexity.PWithPPOracle) consists of the problems L decided by one deterministic oracle program, strict oracle PPT as in Cslib.Complexity.ComputableInPolyTimeWithOracle, that is correct against every oracle language agreeing with some problem B ∈ PP on the encoded instances of B, for some encoded type of instances of B. As for Cslib.Complexity.PWithSharpPOracle, the program is fixed before the oracle and the answers on words that are not codes are arbitrary.

A bit of a value f b of a function f ∈ #P is computed in P^PP by binary search: the problem {(b, k) | k ≤ f b} is in PP, by the characterisation through GapP (Cslib.Complexity.setOf_le_mem_PP), and N queries lo + 2 ^ (j - 1) ≤ f b, for j = N, …, 1, determine f b < 2 ^ N (Cslib.Complexity.BinarySearch.fst_iterate_step, Cslib.Complexity.BinarySearch.interpret_id_search), within strict oracle PPT (Cslib.Complexity.BinarySearch.isOraclePPTOn_search). Hence P^#P ⊆ P^PP (Cslib.Complexity.PWithSharpPOracle_subset_PWithPPOracle): every request of a P^#P program for bit i of f b, sent as the code (b, i), is answered by a binary search (Cslib.Complexity.BinarySearch.bitQuery), substituted into the program by stateless open oracle substitution (Cslib.Probability.IsOraclePPTOn.interpret_preprocess_open'). The search reads the code of b and the position i from the request without decoding b, and runs for r (n) + 1 rounds, for the length n of the request and f b ≤ 2 ^ r (|b|).

A problem in ModP k is decided by reading all bits of its #P count, as in a metric reduction (Cslib.Complexity.MetricReducible.polyTimeOracleProgram), and testing the residue modulo k. So ModP k ⊆ P^#P ⊆ P^PP for every modulus k (Cslib.Complexity.ModP_subset_PWithSharpPOracle, Cslib.Complexity.ModP_subset_PWithPPOracle), with ⊕P ⊆ P^PP (Cslib.Complexity.ParityP_subset_PWithPPOracle) as the modulus-two case via ModP_two. With Toda's theorem PH ⊆ P^#P (Cslib.Complexity.PH_subset_PWithSharpPOracle), P^#P ⊆ P^PP gives Toda's theorem PH ⊆ P^PP Toda (Cslib.Complexity.PH_subset_PWithPPOracle). The classes do not count queries.

Main definitions #

Main results #

References #

def Cslib.Complexity.PWithPPOracle {α : Type} (enc : α ↪ List Bool) :
Set (Set α)

P^PP: the problems L such that, for some type β with encoding encβ and some B ∈ PP encβ, one deterministic oracle program, strict oracle PPT on the encoding enc of instances, decides L against every oracle language containing the code encβ b exactly when b ∈ B. Answers on words that are not codes are arbitrary.

P ⊆ P^PP: a polynomial-time decider makes no query.

PP ⊆ P^PP: the program asks the oracle about its instance, with one query.

P^A ⊆ P^PP for A ∈ PP: a polynomial-time oracle program relative to a language in PP over words encoded as themselves decides its problem against every oracle agreeing with that language, since every word is a code.

theorem Cslib.Complexity.exists_mem_PP_mem_PWithOracle_image {α : Type} {enc : α ↪ List Bool} {L : Set α} (hL : L ∈ PWithPPOracle enc) :
∃ (β : Type) (encβ : β ↪ List Bool), ∃ B ∈ PP encβ, L ∈ PWithOracle (⇑encβ '' B) enc

P^PP lies in polynomial time relative to the codes of a PP problem: against the image of its PP problem under the encoding, the program of a problem in P^PP decides it.

Comparing with a #P value #

theorem Cslib.Complexity.setOf_le_mem_PP {α : Type} {enc : α ↪ List Bool} {f : α → ℕ} (hf : f ∈ SharpP enc) :

Comparing with a #P value is in PP: for f ∈ #P, the pairs (a, k) with k ≤ f a, k in binary, are the instances where the GapP function f a + 1 - k is positive.

Answering bit requests #

The handler answering a request for bit i of f b, sent as the code encPair encβ encNat (b, i), by binary search for f b < 2 ^ N with N = r (n) + 1 rounds, where n is the length of the request: the code of b is read from the request without decoding b, and the position is read in binary and capped at N.

P^#P ⊆ P^PP #

P^#P ⊆ P^PP: every request of a P^#P program for a bit of a #P value f b is answered by binary search with queries k ≤ f b to the PP problem {(b, k) | k ≤ f b}.

Modular counting #

ModP k ⊆ P^#P, for every modulus k: the program reads the bits of the #P count f a ≤ 2 ^ r (|enc a|) and tests whether f a is nonzero modulo k. At k = 0 this is NP ⊆ P^#P (Cslib.Complexity.ModP_zero). The argument is elementary.

theorem Cslib.Complexity.ModP_subset_PWithPPOracle {α : Type} {enc : α ↪ List Bool} (k : ℕ) :
ModP k enc ⊆ PWithPPOracle enc

ModP k ⊆ P^PP, for every modulus k: the count is read in P^#P, and P^#P ⊆ P^PP.

⊕P ⊆ P^PP: the modulus-two case of ModP_subset_PWithPPOracle, via ModP_two. It sits in the setting of Toda's theorem Toda, whose step BP·⊕P ⊆ P^PP (BPOp_ParityP_subset_PWithPPOracle) allows a bounded-error randomized reduction first.

Toda's theorem #

theorem Cslib.Complexity.mem_PWithPPOracle_of_testBit {α : Type} {enc : α ↪ List Bool} {L : Set α} {f : α → ℕ} (hf : f ∈ SharpP enc) {p : Polynomial ℕ} (h : ∀ (a : α), a ∈ L ↔ (f a).testBit (Polynomial.eval (enc a).length p) = true) :

One bit of a #P value is in P^PP: a problem decided by the bit at a polynomial position of a function f ∈ #P on its own instances is in P^PP, found by binary search with queries k ≤ f a to the PP problem {(a, k) | k ≤ f a}.

BP·⊕P ⊆ P^PP: a problem decided with bounded error by a problem in ⊕P about pairs of an instance and a random string is decided by one bit of a function in #P, found by binary search with a PP oracle.

Toda's theorem: PH ⊆ P^PP Toda. Every problem in the polynomial hierarchy is decided by a polynomial-time oracle program against every oracle language agreeing with a problem in PP on its encoded instances.