Documentation

CslibFrontier.Computability.Complexity.Classes.Tally

Tally problems #

A tally language consists of words over a one-letter alphabet: here, words all of whose letters are true (Cslib.Complexity.TALLY). The words true ^ n are the unary encodings of the natural numbers, so a conjunctive reduction to a set A of natural numbers written in unary is one to the tally language encUnary '' A (Cslib.Complexity.PolyTimeCTTReducible.image_encUnary).

Sparse problems reduce conjunctively to tally problems (Cslib.Complexity.exists_polyTimeCTTReducible_encUnary_of_mem_SPARSE), a theorem of Buhrman, Longpré and Spaan, cited by Arvind, Köbler and Mundhenk Arvind, Köbler and Mundhenk, proof of Lemma 3.2. The reduction asks, for a word u of length n and each m < M, whether some member of the sparse problem of length n has the same residue as u modulo m + 1 (Cslib.Complexity.Tally.fingerprint); members of the sparse problem pass every test. For a word u outside it, let Y be the at most s members of length n. If every modulus m + 1 ≤ M were matched by some y ∈ Y, it would divide |u - y|, read as binary numbers, so the least common multiple of 1, …, M would divide the nonzero product of the |u - y|, which is at most 2 ^ (n s). Since that least common multiple is at least 2 ^ M for M ≥ 7 (Chebyshev.two_pow_le_lcmUpto), M = n s + 7 moduli suffice (Cslib.Complexity.Tally.exists_fingerprint_notMem). This route through Nat.lcmUpto is the library's own; it needs no bound on the number of primes.

Conjunctive reductions to tally problems are closed under intersection, by asking both batches of queries tagged by their reduction, and under union, by asking for every pair of queries whether one of them is in its target; pairs of unary numbers are unary numbers again (Nat.pair). Sparse targets do not allow the second construction, which is why the tally step is needed.

Main definitions #

Main results #

References #

Tally languages #

The tally languages: languages of words all of whose letters are true.

theorem Cslib.Complexity.mem_TALLY {T : Set (List Bool)} :
T ∈ TALLY ↔ ∀ w ∈ T, ∀ b ∈ w, b = true

The unary encodings of a set of natural numbers form a tally language.

A conjunctive reduction to a set of natural numbers written in unary is a conjunctive reduction to the tally language of their unary encodings.

Fingerprints modulo small numbers #

The residue of the binary value of the word u, most significant bit first, modulo m + 1, computed digit by digit.

The m-th fingerprint of the word u: its length, m, and its residue modulo m + 1.

The fingerprints of the members of S.

The residue is that of the binary value.

theorem Cslib.Complexity.Tally.exists_fingerprint_notMem {S : Set (List Bool)} {u : List Bool} {s M : ℕ} (hs : ∀ (T : Finset (List Bool)), (∀ w ∈ T, w ∈ S ∧ w.length = u.length) → T.card ≤ s) (hM : u.length * s + 7 ≤ M) (hu : u ∉ S) :
∃ m < M, fingerprint u m ∉ fingerprints S

Few moduli separate a word from the members of a sparse problem. If at most s members of S have the length of u, u is not in S and M ≥ |u| s + 7, then some fingerprint fingerprint u m with m < M is not a fingerprint of a member of S.

Sparse problems reduce conjunctively to tally problems #

Sparse problems reduce conjunctively to tally problems (Buhrman, Longpré and Spaan; cited in Arvind, Köbler and Mundhenk, proof of Lemma 3.2): a sparse problem has a polynomial-time conjunctive reduction to a set of natural numbers written in unary. The queries are the fingerprints of the encoding of an instance with M = n s + 7 moduli, where n is its length and s bounds the members of length at most n; the target is the set of fingerprints of the encodings of members.

SPARSE ⊆ R_ctt(TALLY): a sparse problem has a polynomial-time conjunctive reduction to a tally language.

Closure of conjunctive reductions to tally problems #

A problem in P reduces conjunctively to a tally problem: no query for members and an unanswerable one otherwise.

theorem Cslib.Complexity.PolyTimeCTTReducible.exists_encUnary_inter {α : Type} {encA : α ↪ List Bool} {L₁ L₂ : Set α} {A₁ A₂ : Set ℕ} (h₁ : PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary L₁ A₁) (h₂ : PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary L₂ A₂) :
∃ (A : Set ℕ), PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary (L₁ ∩ L₂) A

Conjunctive reductions to tally problems are closed under intersection: ask the queries of both reductions, tagged by the reduction they come from.

theorem Cslib.Complexity.PolyTimeCTTReducible.exists_encUnary_union {α : Type} {encA : α ↪ List Bool} {L₁ L₂ : Set α} {A₁ A₂ : Set ℕ} (h₁ : PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary L₁ A₁) (h₂ : PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary L₂ A₂) :
∃ (A : Set ℕ), PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary (L₁ ∪ L₂) A

Conjunctive reductions to tally problems are closed under union: ask, for every pair of a query of each reduction, whether one of the two is in its target.

theorem Cslib.Complexity.PolyTimeCTTReducible.exists_encUnary_biUnion {α : Type} {encA : α ↪ List Bool} {ι : Type u_1} {L : ι → Set α} (l : List ι) (h : ∀ i ∈ l, ∃ (A : Set ℕ), PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary (L i) A) :
∃ (A : Set ℕ), PolyTimeCTTReducible encA Turing.MultiTapeTM.encUnary (⋃ i ∈ l, L i) A

Conjunctive reductions to tally problems are closed under finite unions, by induction on the list of indices from Cslib.Complexity.PolyTimeCTTReducible.exists_encUnary_union; the empty union asks one query of the empty target.

Asking a computed list of queries of a problem with a conjunctive reduction to a tally problem: if B reduces conjunctively to a set A of natural numbers written in unary, so do the instances a whose queries Qs a all lie in B, to the same set. The reduction asks the queries of all of them.