Documentation

CslibFrontier.Computability.Complexity.Reduction.CountingTuring

Polynomial-time counting Turing reductions #

Polynomial-time Turing reductions between counting functions (f ≤_T^#P g), defined using Cslib.Complexity.PolyTimeOracleProgram against the bit-graph oracle predicate AnswersBits (Valiant 1979, Arora and Barak).

A counting oracle g : β → ℕ exposes its bits (b, i) ↦ (g b).testBit i through AnswersBits encB g A. Any batch of oracle calls with a polynomial-time unary bit-length bound is assembled via queryWords (batchNatOracleProgram / PolyTimeOracleProgram.of_batchNatBits), and any problem in #P whose counting Turing reduction target lies in FP (with a polynomial-time total decoder for its input encoding) drops to FP.

Main definitions #

Main results #

References #

def Cslib.Complexity.CountingTuringReducible {α β : Type} (encA : α ↪ List Bool) (encB : β ↪ List Bool) (f : α → ℕ) (g : β → ℕ) :

Polynomial-time counting Turing reduction (f ≤_T^#P g): f is computed by a polynomial-time oracle program with access to any bit-graph oracle satisfying AnswersBits encB g.

def Cslib.Complexity.CountingTuringHard {β : Type} (encB : β ↪ List Bool) (g : β → ℕ) :

A counting function g is #P-hard under polynomial-time counting Turing reductions when every function in #P reduces to it.

def Cslib.Complexity.CountingTuringComplete {β : Type} (encB : β ↪ List Bool) (g : β → ℕ) :

A counting function g is #P-complete under counting Turing reductions when g ∈ #P and g is #P-hard under counting Turing reductions.

theorem Cslib.Complexity.ParsimoniousReducible.comp_countingTuringReducible {α β γ : Type} {encA : α ↪ List Bool} {encB : β ↪ List Bool} {encC : γ ↪ List Bool} {f : α → ℕ} {h : β → ℕ} {g : γ → ℕ} (hfh : ParsimoniousReducible encA encB f h) (hhg : CountingTuringReducible encB encC h g) :

Precomposing a counting Turing reduction with a parsimonious reduction yields a counting Turing reduction.

theorem Cslib.Complexity.SharpPHard.trans_countingTuring {β γ : Type} {encB : β ↪ List Bool} {encC : γ ↪ List Bool} {h : β → ℕ} {g : γ → ℕ} (hh : SharpPHard encB h) (hhg : CountingTuringReducible encB encC h g) :

Every parsimoniously #P-hard function remains #P-hard under counting Turing reductions once composed with a counting Turing reduction.

def Cslib.Complexity.natBitWords {β : Type} (encB : β ↪ List Bool) (b : β) (K : ℕ) :

Query word list asking bits 0, …, K - 1 of a single oracle argument b : β.

def Cslib.Complexity.batchNatBitWords {β : Type} (encB : β ↪ List Bool) (qs : List β) (K : ℕ) :

Query word list asking bits 0, …, K - 1 of each oracle argument in qs.

Decode count consecutive K-bit little-endian segments from bits.

def Cslib.Complexity.queryNatBits {β : Type} (encB : β ↪ List Bool) (b : β) (K : ℕ) :

Ask the K low-order bits of a single oracle call b and reconstruct the binary natural.

def Cslib.Complexity.batchNatOracleProgram {α β : Type} (encB : β ↪ List Bool) (queries : α → List β) (bound : α → ℕ) (combine : α × List ℕ → ℕ) (a : α) :

Ask the bound a low-order bits of every b ∈ queries a in one batch and combine the decoded naturals with combine.

theorem Cslib.Complexity.interpret_queryNatBits {β : Type} {encB : β ↪ List Bool} {g : β → ℕ} {A : Set (List Bool)} (hA : AnswersBits encB g A) {b : β} {K : ℕ} (hsize : (g b).size ≤ K) :

Interpreting queryNatBits encB b K against any oracle satisfying AnswersBits encB g recovers g b provided (g b).size ≤ K.

Single-query bit-oracle lookup is strict oracle PPT in (b, K) (with K in unary).

theorem Cslib.Complexity.PolyTimeOracleProgram.of_batchNatBits {α β : Type} {encA : α ↪ List Bool} {encB : β ↪ List Bool} {f : α → ℕ} {g : β → ℕ} (queries : α → List β) (bound : α → ℕ) (combine : α × List ℕ → ℕ) (hqueries : Turing.MultiTapeTM.ComputableInPolyTime queries encA (Turing.MultiTapeTM.encList encB)) (hbound : Turing.MultiTapeTM.ComputableInPolyTime bound encA Turing.MultiTapeTM.encUnary) (hcombine : Turing.MultiTapeTM.ComputableInPolyTime combine (Turing.MultiTapeTM.encPair encA (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) Turing.MultiTapeTM.encNat) (hsize : ∀ (a : α), ∀ b ∈ queries a, (g b).size ≤ bound a) (hspec : ∀ (a : α), combine (a, List.map g (queries a)) = f a) :

Batch constructor for CountingTuringReducible: any polynomial-time list of queries queries with a polynomial-time unary bit-length bound bound and polynomial-time combination combine witnesses CountingTuringReducible encA encB f g.

If f ≤_T^#P g and the bit graph of g is in P, then f is computable in polynomial time (FP).

If f ≤_T^#P g, g is computable in polynomial time, and encB has a polynomial-time total decoder, then f is computable in polynomial time (FP).