Documentation

CslibFrontier.Computability.Complexity.Classes.CountingHierarchy

Decision and function levels of the counting hierarchy #

CountingLevel a enc is C_a P and CountingFunction a input output is F_a. Each membership witness uses one fixed language oracle on raw words and one uniform program. Function output length is polynomially bounded by the strict oracle machine certificate. Successor decision levels use the existing fixed-length relativized majority verifier characterization; this module does not claim equivalence with probabilistic oracle machines.

Tagged unions combine a fixed finite collection of oracle languages at the same level. Thus function composition may be adaptive without increasing the level. This does not collapse adaptive PP access to PP.

Main definitions #

References #

def Cslib.Complexity.CountingLevel (a : ℕ) {α : Type} :
(α ↪ List Bool) → Set (Set α)

Counting-hierarchy decision levels. Every successor witness uses one raw-word oracle from the preceding level and a uniform strict polynomial-time majority verifier.

def Cslib.Complexity.CountingFunction {α β : Type} (a : ℕ) (input : α ↪ List Bool) (output : β ↪ List Bool) :
Set (α → β)

Function level F_a, using one fixed oracle in C_a P. Encoded output length is bounded by the program's strict certificate; the witness cannot depend on the input.

@[simp]
theorem Cslib.Complexity.CountingLevel_zero {α : Type} {input : α ↪ List Bool} :
CountingLevel 0 input = P input

The zeroth decision level is P.

@[simp]
theorem Cslib.Complexity.CountingLevel_one {α : Type} {input : α ↪ List Bool} :
CountingLevel 1 input = PP input

The first decision level is ordinary PP: a polynomial-time oracle can be eliminated.

@[simp]
theorem Cslib.Complexity.mem_CountingFunction_zero {α β : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {f : α → β} :

The zeroth function level is ordinary polynomial-time computation.

theorem Cslib.Complexity.P_subset_CountingLevel {α : Type} {input : α ↪ List Bool} (a : ℕ) :
P input ⊆ CountingLevel a input

Every decision level contains P.

theorem Cslib.Complexity.CountingLevel_subset_succ {α : Type} {input : α ↪ List Bool} (a : ℕ) :
CountingLevel a input ⊆ CountingLevel (a + 1) input

The decision levels are increasing.

theorem Cslib.Complexity.CountingLevel_mono {α : Type} {input : α ↪ List Bool} {a b : ℕ} (hab : a ≤ b) :
CountingLevel a input ⊆ CountingLevel b input

Monotonicity in the level index.

theorem Cslib.Complexity.PolyTimeReducible.mem_CountingLevel {α β : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {a : ℕ} {L : Set α} {M : Set β} (h : PolyTimeReducible input middle L M) (hM : M ∈ CountingLevel a middle) :
L ∈ CountingLevel a input

Polynomial-time many-one reductions preserve every decision level.

Prefixing a false tag reduces the first oracle to its tagged union.

Prefixing a true tag reduces the second oracle to its tagged union.

A fixed pair of same-level languages can share one tagged oracle. Repeating this theorem combines every fixed finite family, without an input-dependent oracle depth.

A fixed list of languages, joined by successive leading tags. The empty list gives the empty language; a false tag selects the head and a true tag continues through the list.

Every fixed finite tagged union stays at the same decision level.

Each component of a fixed finite union reduces to the combined oracle by a fixed tag word.

theorem Cslib.Complexity.CountingFunction.exists_common_oracle {α β : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {a : ℕ} {ι : Type} [Finite ι] {f : ι → α → β} (hf : ∀ (i : ι), f i ∈ CountingFunction a input middle) :
∃ A ∈ CountingLevel a Turing.MultiTapeTM.encBits, ∀ (i : ι), ComputableInPolyTimeWithOracle A (f i) input middle

A fixed finite family of same-level functions has one common language oracle, independent of the input and selected member. Its functions retain their strict uniform program witnesses.

theorem Cslib.Complexity.CountingFunction.of_polyTime {α β : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {a : ℕ} {f : α → β} (hf : Turing.MultiTapeTM.ComputableInPolyTime f input middle) :
f ∈ CountingFunction a input middle

Ordinary polynomial-time functions belong to every function level.

theorem Cslib.Complexity.CountingFunction.mono {α β : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {a b : ℕ} (hab : a ≤ b) {f : α → β} (hf : f ∈ CountingFunction a input middle) :
f ∈ CountingFunction b input middle

Increasing the oracle level preserves a function certificate.

theorem Cslib.Complexity.CountingFunction.polyBounded_length {α β : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {a : ℕ} {f : α → β} (hf : f ∈ CountingFunction a input middle) :
Turing.MultiTapeTM.PolyBounded (fun (x : α) => (input x).length) fun (x : α) => (middle (f x)).length

Polynomial output length follows from function-level membership.

theorem Cslib.Complexity.CountingFunction.preprocess {α β γ : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {output : γ ↪ List Bool} {a : ℕ} {f : β → γ} {g : α → β} (hf : f ∈ CountingFunction a middle output) (hg : Turing.MultiTapeTM.ComputableInPolyTime g input middle) :
(fun (x : α) => f (g x)) ∈ CountingFunction a input output

Polynomial-time preprocessing does not change the level.

theorem Cslib.Complexity.CountingFunction.comp {α β γ : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {output : γ ↪ List Bool} {a : ℕ} {f : β → γ} {g : α → β} (hf : f ∈ CountingFunction a middle output) (hg : g ∈ CountingFunction a input middle) :
(fun (x : α) => f (g x)) ∈ CountingFunction a input output

Adaptive composition combines the two fixed oracle languages by tagging.

theorem Cslib.Complexity.CountingFunction.prod {α β γ : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {output : γ ↪ List Bool} {a : ℕ} {f : α → β} {g : α → γ} (hf : f ∈ CountingFunction a input middle) (hg : g ∈ CountingFunction a input output) :
(fun (x : α) => (f x, g x)) ∈ CountingFunction a input (Turing.MultiTapeTM.encPair middle output)

A fixed pair of same-level functions can be evaluated together at that level.

theorem Cslib.Complexity.CountingFunction.comp_with {α β γ : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {output : γ ↪ List Bool} {a : ℕ} {f : α × β → γ} {g : α → β} (hf : f ∈ CountingFunction a (Turing.MultiTapeTM.encPair input middle) output) (hg : g ∈ CountingFunction a input middle) :
(fun (x : α) => f (x, g x)) ∈ CountingFunction a input output

Retain the input for a later same-level computation.

theorem Cslib.Complexity.CountingFunction.ite {α β : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {a : ℕ} {c : α → Bool} {f g : α → β} (hc : c ∈ CountingFunction a input Turing.MultiTapeTM.encBool) (hf : f ∈ CountingFunction a input middle) (hg : g ∈ CountingFunction a input middle) :
(fun (x : α) => if c x = true then f x else g x) ∈ CountingFunction a input middle

Same-level Boolean control selects between two same-level function values.

theorem Cslib.Complexity.CountingFunction.map {α β γ : Type} {input : α ↪ List Bool} {middle : β ↪ List Bool} {output : γ ↪ List Bool} {a : ℕ} {f : α → β} {g : β → γ} (hf : f ∈ CountingFunction a input middle) (hg : Turing.MultiTapeTM.ComputableInPolyTime g middle output) :
(fun (x : α) => g (f x)) ∈ CountingFunction a input output

Polynomial-time postprocessing preserves the function level.

theorem Cslib.Complexity.CountingFunction.decision {α : Type} {input : α ↪ List Bool} {a : ℕ} {f : α → Bool} (hf : f ∈ CountingFunction a input Turing.MultiTapeTM.encBool) :
{x : α | f x = true} ∈ CountingLevel (a + 1) input

An F_a Boolean decision is a language in C_(a+1) P, using a verifier that ignores its coins.