Documentation

CslibFrontier.Computability.Complexity.Classes.Oracle.BoundedQuery

Bounded-query oracle classes and P^{NP[O(log n)]} #

f is computable in polynomial time relative to A with r requests (Cslib.Complexity.ComputableInPolyTimeWithOracleQueries) when it has the certificate of Cslib.Complexity.ComputableInPolyTimeWithOracle and the program, run against the oracle language A, makes at most r n requests on instances of encoded length n (Cslib.OracleComp.queriesWith). The requests are counted against A itself, as in the usual definition of a machine with oracle A making a bounded number of queries; the certificate's clock bounds the requests against every oracle in any case (Cslib.Probability.IsOraclePPTOn.query_bounds).

P^{NP[O(log n)]} (Cslib.Complexity.PNPLog) is the class of problems decided in polynomial time with at most c log₂ n + c requests to some oracle language in NP, for a constant c Hemaspaandra and Ogihara, p. 1 Kadin. It contains NP and coNP with one request to the encodings of the satisfiable formulas (Cslib.Complexity.NP_subset_PWithOracleQueries_image_SAT), through the Cook–Levin reduction, and is closed under complement. Running two deciders in sequence adds their requests (Cslib.Complexity.inter_mem_PWithOracleQueries), so the nth level of the Boolean hierarchy is decided with n requests to SAT and the whole Boolean hierarchy lies in P^{NP[O(log n)]} Köbler, Schöning and Wagner; in particular DP and coDP (Cslib.Complexity.BH_two, Cslib.Complexity.coBH_two) are decided with two requests.

Main definitions #

Main results #

References #

theorem Cslib.OracleComp.length_queriesWith_iterate_le {ι State : Type} {spec : OracleSpec ι} (answer : (q : ι) → spec q) {step : State → OracleComp spec State} {r : ℕ} (h : ∀ (st : State), (queriesWith answer (step st)).length ≤ r) (n : ℕ) (st : State) :
(queriesWith answer (iterate n step st)).length ≤ n * r

A bounded loop makes a bounded number of requests: if every round makes at most r requests, n rounds make at most n * r.

def Cslib.Complexity.ComputableInPolyTimeWithOracleQueries {α β : Type} (A : Set (List Bool)) (r : ℕ → ℕ) (f : α → β) (input : α ↪ List Bool) (output : β ↪ List Bool) :

f is computable in polynomial time relative to the oracle language A with at most r n requests on instances of encoded length n: one deterministic word-query program has the certificate of ComputableInPolyTimeWithOracle, computes f against A, and makes at most r (input a).length requests on a against A.

theorem Cslib.Complexity.ComputableInPolyTimeWithOracleQueries.computableInPolyTimeWithOracle {α β : Type} {A : Set (List Bool)} {r : ℕ → ℕ} {input : α ↪ List Bool} {middle : β ↪ List Bool} {f : α → β} (h : ComputableInPolyTimeWithOracleQueries A r f input middle) :

A bounded number of requests is in particular polynomial time relative to the oracle.

theorem Cslib.Complexity.ComputableInPolyTimeWithOracleQueries.mono {α β : Type} {A : Set (List Bool)} {r r' : ℕ → ℕ} {input : α ↪ List Bool} {middle : β ↪ List Bool} {f : α → β} (h : ComputableInPolyTimeWithOracleQueries A r f input middle) (hr : ∀ (n : ℕ), r n ≤ r' n) :

Weakening the bound on the requests.

theorem Cslib.Complexity.ComputableInPolyTimeWithOracleQueries.map {α β γ : Type} {A : Set (List Bool)} {r : ℕ → ℕ} {input : α ↪ List Bool} {middle : β ↪ List Bool} {output : γ ↪ List Bool} {f : α → β} {g : β → γ} (h : ComputableInPolyTimeWithOracleQueries A r f input middle) (hg : Turing.MultiTapeTM.ComputableInPolyTime g middle output) :
ComputableInPolyTimeWithOracleQueries A r (fun (a : α) => g (f a)) input output

Polynomial-time postprocessing of the result makes no further request.

theorem Cslib.Complexity.ComputableInPolyTimeWithOracleQueries.prod {α β γ : Type} {A : Set (List Bool)} {r r' : ℕ → ℕ} {input : α ↪ List Bool} {middle : β ↪ List Bool} {output : γ ↪ List Bool} {f : α → β} {g : α → γ} (hf : ComputableInPolyTimeWithOracleQueries A r f input middle) (hg : ComputableInPolyTimeWithOracleQueries A r' g input output) :
ComputableInPolyTimeWithOracleQueries A (fun (n : ℕ) => r n + r' n) (fun (a : α) => (f a, g a)) input (Turing.MultiTapeTM.encPair middle output)

Sequential composition: running two programs against the same oracle one after the other, retaining both results, makes the requests of both.

theorem Turing.MultiTapeTM.ComputableInPolyTime.computableInPolyTimeWithOracleQueries {α β : Type} {f : α → β} {input : α ↪ List Bool} {output : β ↪ List Bool} (h : ComputableInPolyTime f input output) (A : Set (List Bool)) (r : ℕ → ℕ) :

A polynomial-time computation makes no request.

One request to A for the polynomial-time word req a decides whether req a ∈ A.

def Cslib.Complexity.PWithOracleQueries {α : Type} (A : Set (List Bool)) (r : ℕ → ℕ) (enc : α ↪ List Bool) :
Set (Set α)

The problems decided in polynomial time relative to the oracle language A with at most r n requests on instances of encoded length n.

theorem Cslib.Complexity.mem_PWithOracleQueries {α : Type} {A : Set (List Bool)} {r : ℕ → ℕ} {enc : α ↪ List Bool} {L : Set α} :
L ∈ PWithOracleQueries A r enc ↔ ∃ (f : α → Bool), ComputableInPolyTimeWithOracleQueries A r f enc Turing.MultiTapeTM.encBool ∧ ∀ (a : α), a ∈ L ↔ f a = true
def Cslib.Complexity.PNPLog {α : Type} (enc : α ↪ List Bool) :
Set (Set α)

P^{NP[O(log n)]}: the problems decided in polynomial time with at most c log₂ n + c requests, on instances of encoded length n, to some oracle language in NP Hemaspaandra and Ogihara, p. 1 Kadin.

theorem Cslib.Complexity.mem_PNPLog {α : Type} {enc : α ↪ List Bool} {L : Set α} :
L ∈ PNPLog enc ↔ ∃ A ∈ NP Turing.MultiTapeTM.encBits, ∃ (c : ℕ), L ∈ PWithOracleQueries A (fun (n : ℕ) => c * Nat.log 2 n + c) enc
theorem Cslib.Complexity.PWithOracleQueries_mono {α : Type} {A : Set (List Bool)} {r r' : ℕ → ℕ} {enc : α ↪ List Bool} (hr : ∀ (n : ℕ), r n ≤ r' n) :
theorem Cslib.Complexity.P_subset_PWithOracleQueries {α : Type} (A : Set (List Bool)) (r : ℕ → ℕ) (enc : α ↪ List Bool) :
P enc ⊆ PWithOracleQueries A r enc

A problem in P is decided with no request.

theorem Cslib.Complexity.compl_mem_PWithOracleQueries {α : Type} {A : Set (List Bool)} {r : ℕ → ℕ} {enc : α ↪ List Bool} {L : Set α} (hL : L ∈ PWithOracleQueries A r enc) :

Closure under complement: negate the decider, with the same requests.

theorem Cslib.Complexity.inter_mem_PWithOracleQueries {α : Type} {A : Set (List Bool)} {r r' : ℕ → ℕ} {enc : α ↪ List Bool} {L L' : Set α} (hL : L ∈ PWithOracleQueries A r enc) (hL' : L' ∈ PWithOracleQueries A r' enc) :
L ∩ L' ∈ PWithOracleQueries A (fun (n : ℕ) => r n + r' n) enc

Closure under intersection: run both deciders, adding their requests.

theorem Cslib.Complexity.mem_PWithOracleQueries_of_reduction {α : Type} {A : Set (List Bool)} {enc : α ↪ List Bool} {L : Set α} {req : α → List Bool} (hreq : Turing.MultiTapeTM.ComputableInPolyTime req enc Turing.MultiTapeTM.encBits) (h : ∀ (a : α), a ∈ L ↔ req a ∈ A) :
L ∈ PWithOracleQueries A (fun (x : ℕ) => 1) enc

A problem that reduces in polynomial time to the oracle language is decided with one request.

theorem Cslib.Complexity.NP_subset_PWithOracleQueries_image_SAT {α : Type} (enc : α ↪ List Bool) :
NP enc ⊆ PWithOracleQueries (⇑encCNF '' SAT) (fun (x : ℕ) => 1) enc

One request to SAT decides a problem in NP: the request is the encoding of the Cook–Levin reduction of the instance.

theorem Cslib.Complexity.mem_PNPLog_of_mem_PWithOracleQueries {α : Type} {A : Set (List Bool)} {enc : α ↪ List Bool} {L : Set α} (hA : A ∈ NP Turing.MultiTapeTM.encBits) {c : ℕ} (hL : L ∈ PWithOracleQueries A (fun (n : ℕ) => c * Nat.log 2 n + c) enc) :
L ∈ PNPLog enc

A problem decided with c log₂ n + c requests to an oracle language in NP is in P^{NP[O(log n)]}.

theorem Cslib.Complexity.compl_mem_PNPLog {α : Type} {enc : α ↪ List Bool} {L : Set α} (hL : L ∈ PNPLog enc) :

P^{NP[O(log n)]} is closed under complement.

theorem Cslib.Complexity.P_subset_PNPLog {α : Type} (enc : α ↪ List Bool) :
P enc ⊆ PNPLog enc

P ⊆ P^{NP[O(log n)]}.

theorem Cslib.Complexity.NP_subset_PNPLog {α : Type} (enc : α ↪ List Bool) :
NP enc ⊆ PNPLog enc

NP ⊆ P^{NP[O(log n)]}, with one request to SAT.

theorem Cslib.Complexity.coNP_subset_PNPLog {α : Type} (enc : α ↪ List Bool) :
coNP enc ⊆ PNPLog enc

coNP ⊆ P^{NP[O(log n)]}.

theorem Cslib.Complexity.BH_subset_PWithOracleQueries_image_SAT {α : Type} (enc : α ↪ List Bool) (n : ℕ) :
BH enc n ⊆ PWithOracleQueries (⇑encCNF '' SAT) (fun (x : ℕ) => n) enc

A level of the Boolean hierarchy needs a constant number of requests: a problem in BH enc n is decided with n requests to SAT, one for each NP language of its nested difference; by compl_mem_PWithOracleQueries, so is a problem in coBH enc n. Köbler, Schöning and Wagner, Corollary 4.6 (i) prove the stronger nonadaptive form: the nth level (their DIFF_n) and its complements are n-truth-table reducible to NP. PWithOracleQueries counts requests that may depend on earlier answers.

BooleanHierarchy ⊆ P^{NP[O(log n)]}: a problem in the nth level is decided with n requests to SAT, a constant number. The Boolean hierarchy is in fact the class of problems bounded-truth-table reducible to NP Köbler, Schöning and Wagner, Corollaries 3.9 (iii) and 4.6 (ii).

P^{NP[O(log n)]} ⊆ P^{NP}.