Documentation

CslibFrontier.Computability.Complexity.Classes.UniformDiagonalization

Uniform diagonalization #

Schöning's uniform diagonalization theorem Schöning (Cslib.Complexity.exists_mem_P_ite_notMem): let C₁, C₂ be recursively presentable classes of sets of bit words, both closed under finite variations, and let A₁ ∉ C₁ and A₂ ∉ C₂ be decidable. Then some G ∈ P makes the set G.ite A₁ A₂, which agrees with A₁ on G and with A₂ off G, belong to neither class. This set is decidable, reduces to the marked union of A₁ and A₂, and reduces to A₂ when A₁ ∈ P and A₂ is neither empty nor everything. The two predicates on classes live in CslibFrontier.Computability.Complexity.Classes.RecursivelyPresentable, and the recursive presentation of P lives in CslibFrontier.Computability.Complexity.Classes.RecursivelyPresentable.PolyTime.

The proof is delayed diagonalization. Stage k separates the mixed set from the member of index k / 2 of the first family (even k) or the second family (odd k). The words of length n are put on the side of the stage at n. The stage at n advances over the stage at n - 1 when a word of index below n separates the two sets, as seen by runs of n steps of both machines (Turing.MultiTapeTM.Universal.runBool). This check takes polynomial time in n, so G ∈ P. Since the sets of each side are infinitely different from the members of their family, every stage is reached, and leaving stage k needs a separating word.

P itself meets the hypotheses: it is closed under finite variations (Cslib.Complexity.closedUnderFiniteVariation_P), and it is recursively presentable by the machines run within polynomial clocks (Cslib.Complexity.recursivelyPresentable_P).

Main definitions #

Main results #

Implementation notes #

The classes are of sets of bit words (encBits), so the theorem is the binary-alphabet case of the source statement. Decidable sets and presentations are computed by total native machines (Turing.MultiTapeTM.IsComputable). The reduction to A₂ takes a member and a non-member of A₂ in place of the hypothesis that A₂ is neither empty nor everything.

Ladner's density theorem, obtained by presenting polynomial-time degrees and cones, is proved in CslibFrontier.Computability.Complexity.Classes.Ladner.Density, and recursive presentations of NP, PSPACE, PH, and EXP are in CslibFrontier.Computability.Complexity.Classes.RecursivelyPresentable.Classes.

References #

The construction #

The side of stage k: true (the first pair) at even stages, false at odd ones.

The clocked answer, within t steps, for membership of w in the mixed set, where the side is read from the table T at the length of w.

The clocked answer, within t steps, for membership of w in the set diagonalized at stage k.

Two clocked answers that are both present and differ.

Whether a word with index below T.length separates the mixed set from the set diagonalized at stage k, as seen by runs of T.length steps.

The stage after the table T of the earlier stages: the last stage, advanced by one if it has a witness.

theorem Cslib.Complexity.UniformDiagonalization.stage_succ (dA dF : Bool → Turing.MultiTapeTM.Universal.Desc) (n : ℕ) :
stage dA dF (n + 1) = if witness dA dF (table dA dF (n + 1)) (stage dA dF n) = true then stage dA dF n + 1 else stage dA dF n

Soundness and completeness of the witnesses #

Clocked runs of dA b decide A b, and clocked runs of dF b decide the family F b, soundly and eventually completely.

The mixed set: a word of length n is decided by the side of the stage at n.

theorem Cslib.Complexity.UniformDiagonalization.witness_sound {dA dF : Bool → Turing.MultiTapeTM.Universal.Desc} {A : Bool → Set (List Bool)} {F : Bool → ℕ → Set (List Bool)} (hS : Spec dA dF A F) {n k : ℕ} (h : witness dA dF (table dA dF n) k = true) :
∃ (w : List Bool), ¬(w ∈ D dA dF A ↔ w ∈ F (side k) (k / 2))

A witness separates.

theorem Cslib.Complexity.UniformDiagonalization.witness_complete {dA dF : Bool → Turing.MultiTapeTM.Universal.Desc} {A : Bool → Set (List Bool)} {F : Bool → ℕ → Set (List Bool)} (hS : Spec dA dF A F) {k : ℕ} {w : List Bool} (hw : ¬(w ∈ A (side k) ↔ w ∈ F (side k) (k / 2))) :
∃ (N : ℕ), ∀ (n : ℕ), N ≤ n → stage dA dF w.length = k → witness dA dF (table dA dF n) k = true

A separating word is eventually a witness.

theorem Cslib.Complexity.UniformDiagonalization.exists_stage_eq {dA dF : Bool → Turing.MultiTapeTM.Universal.Desc} {A : Bool → Set (List Bool)} {F : Bool → ℕ → Set (List Bool)} (hS : Spec dA dF A F) (hinf : ∀ (b : Bool) (i : ℕ), (symmDiff (A b) (F b i)).Infinite) (k : ℕ) :
∃ (n : ℕ), stage dA dF n = k

Every stage is reached when each A b is infinitely different from every F b i: if the stages stayed at k, the sets of the side of k would agree on all long words.

theorem Cslib.Complexity.UniformDiagonalization.D_ne {dA dF : Bool → Turing.MultiTapeTM.Universal.Desc} {A : Bool → Set (List Bool)} {F : Bool → ℕ → Set (List Bool)} (hS : Spec dA dF A F) (hinf : ∀ (b : Bool) (i : ℕ), (symmDiff (A b) (F b i)).Infinite) (b : Bool) (i : ℕ) :
D dA dF A ≠ F b i

The mixed set differs from every diagonalized set.

The stages in polynomial time #

The words whose length is at a stage of the first side form a problem in P.

Uniform diagonalization #

Uniform diagonalization, effective form. Let A₁, A₂ be decidable sets of words and F₁, F₂ computable families of sets of words, with A₁ infinitely different from every member of F₁ and A₂ from every member of F₂. Some G ∈ P makes the set agreeing with A₁ on G and with A₂ off G differ from every member of both families.

theorem Cslib.Complexity.exists_mem_P_ite_notMem {C₁ C₂ : Set (Set (List Bool))} (hC₁ : RecursivelyPresentable Turing.MultiTapeTM.encBits C₁) (hC₂ : RecursivelyPresentable Turing.MultiTapeTM.encBits C₂) (hv₁ : ClosedUnderFiniteVariation C₁) (hv₂ : ClosedUnderFiniteVariation C₂) {A₁ A₂ : Set (List Bool)} (hA₁ : Turing.MultiTapeTM.IsDecidable A₁ Turing.MultiTapeTM.encBits) (hA₂ : Turing.MultiTapeTM.IsDecidable A₂ Turing.MultiTapeTM.encBits) (h₁ : A₁ ∉ C₁) (h₂ : A₂ ∉ C₂) :
∃ G ∈ P Turing.MultiTapeTM.encBits, G.ite A₁ A₂ ∉ C₁ ∧ G.ite A₁ A₂ ∉ C₂

Schöning's uniform diagonalization theorem. Let C₁, C₂ be recursively presentable classes of sets of words, closed under finite variations, and A₁ ∉ C₁, A₂ ∉ C₂ decidable. Some G ∈ P makes the set agreeing with A₁ on G and with A₂ off G belong to neither class.

The mixed set and marked union #

theorem Cslib.Complexity.isDecidable_ite {α : Type} {enc : α ↪ List Bool} {G A₁ A₂ : Set α} (hG : Turing.MultiTapeTM.IsDecidable G enc) (hA₁ : Turing.MultiTapeTM.IsDecidable A₁ enc) (hA₂ : Turing.MultiTapeTM.IsDecidable A₂ enc) :

The mixed set is decidable when G, A₁ and A₂ are.

The marked union of two sets of words: false :: x for x ∈ A₁ and true :: x for x ∈ A₂.

theorem Cslib.Complexity.cons_mem_markedUnion {A₁ A₂ : Set (List Bool)} {b : Bool} {x : List Bool} :
b :: x ∈ markedUnion A₁ A₂ ↔ x ∈ if b = true then A₂ else A₁

Membership of b :: x in markedUnion A₁ A₂ selects A₁ for false and A₂ for true.

markedUnion A B reduces in polynomial time to any C with a non-member c₀ ∉ C whenever both A and B reduce to C.

The marked union of two problems in NP on bit words belongs to NP.

The mixed set reduces to the marked union when G ∈ P.

theorem Cslib.Complexity.polyTimeReducible_ite_of_mem_P {α : Type} {enc : α ↪ List Bool} {G A₁ A₂ : Set α} (hG : G ∈ P enc) (hA₁ : A₁ ∈ P enc) {y₀ y₁ : α} (hy₀ : y₀ ∉ A₂) (hy₁ : y₁ ∈ A₂) :
PolyTimeReducible enc enc (G.ite A₁ A₂) A₂

The mixed set reduces to A₂ when G and A₁ are in P and A₂ has a member and a non-member: on G, the reduction answers with the member or the non-member.

Schöning's theorem for P against a second class.