Documentation

CslibFrontier.Computability.Complexity.Classes.Padding

Padding #

If P = NP, then EXP = NEXP and E = NE Arora and Barak, Section 2.6: collapses of polynomial classes translate upwards, by the padding argument of Book Book. The proof pads instances until a slow nondeterministic machine is fast in the length of the padded instance, decides the padded problem deterministically, and pays for writing the padding.

Timed reductions #

The general timed-reduction API lives in CslibFrontier.Computability.Complexity.Classes.Time. In particular, Cslib.Complexity.preimage_mem_DTIME computes a reduction and then tidily decides its output; the padding arguments below apply this API to their padded instances. The unconditional deterministic exponential-padding lemma Cslib.Complexity.setOf_mem_E_of_computableInPolyTime_pad lives in CslibFrontier.Computability.Complexity.Classes.EXP.

The padded problem #

A nondeterministic machine ntm decides A within time t. The padded problem Turing.MultiTapeNTM.padded ntm c consists of the bit words x such that some c * |x| coins encode an accepting computation of ntm on the word unframe x framed at the start of x, read as coins of the choice table (Turing.MultiTapeNTM.checkChoices). The general certificate characterization Turing.MultiTapeNTM.DecidesInTime.mem_iff_exists_checkChoices lives with checkChoices in CslibFrontier.Computability.Complexity.Classes.NP.Nondeterministic. The padded problem is in NP with respect to encBits by definition: checking the coins is polynomial-time. If every computation path on enc a with at least t a steps has halted, and c * |x| is at least M * t a for the number M of actions, the padded word x = frame (enc a) ++ u is in the padded problem exactly when a ∈ A (Turing.MultiTapeNTM.DecidesInTime.frame_append_mem_padded_iff). So every problem in NTIME t is decided by a problem in NP on the words frame (enc a) ++ u with t |enc a| ≤ |u| (Cslib.Complexity.exists_mem_NP_frame_append_mem_iff_of_mem_NTIME), and for exponential padding u = 1^{2 ^ f n} the padded word is written within time 2 ^ O(f n) (Cslib.Complexity.exists_computableInO_frame_append_two_pow).

The translation lemma #

If NP ⊆ P for problems on bit words, and t n is computable in unary from any word of length n within time O(T n), then NTIME t ⊆ ⋃ d, DTIME ((n + T n + 1) ^ d) (Cslib.Complexity.NTIME_subset_iUnion_DTIME_of_NP_subset_P): the padded problem with padding t n is decided in time polynomial in n + t n. For t n = 2 ^ f n with f computable in unary in polynomial time and n ≤ f n, 2 ^ f n is computed in unary by doubling, within time O((f n + 1) * 2 ^ f n) using the quantitative machine API (Turing.MultiTapeTM.ComputableInO.unary_two_pow), and NTIME (2 ^ f n) ⊆ ⋃ d, DTIME (2 ^ (d * f n)) (Cslib.Complexity.NTIME_two_pow_subset_iUnion_DTIME_of_NP_subset_P). With f n = (k + 1) * n and f n = n ^ (k + 1) this gives NE ⊆ E and NEXP ⊆ EXP.

The hypothesis is NP ⊆ P for problems on bit words, under encBits; the conclusions hold for problems on any type, under any encoding.

The proof only uses the P decider of a padded problem on padded instances. So the translation lemma holds under the weaker hypothesis that every problem in NP agrees with some problem in P on the padded words frame u ++ 1^{t |u|} (Cslib.Complexity.NTIME_subset_iUnion_DTIME_of_agree_padded). For exponential padding this is Cslib.Complexity.ExpPaddedNPEasy, the hypothesis that NP is easy on exponentially padded instances. It gives NE ⊆ E and NEXP ⊆ EXP, and it also follows from easiness of NP on average (CslibFrontier.Computability.Complexity.Classes.AverageCase.WorstCase).

The unconditional pullback lemmas Cslib.Complexity.preimage_mem_NTIME_of_mem_NP and Cslib.Complexity.preimage_pad_mem_NEXP compose a timed deterministic map with an NP verifier; exponential padding yields an NEXP decider without a collapse hypothesis.

Main definitions #

Main results #

References #

noncomputable def Turing.MultiTapeNTM.checkPadded {k : ℕ} {State : Type} [Finite State] (ntm : MultiTapeNTM k Bool State) (x : List Bool × List Bool) :

The verifier of padded instances. It accepts when the certificate, read as coins of the choice table, replays a computation path of ntm on the word framed at the start of the instance that halts with output [true]; the rest of the instance is padding.

def Turing.MultiTapeNTM.padded {k : ℕ} {State : Type} [Finite State] (ntm : MultiTapeNTM k Bool State) (c : ℕ) :

The padded problem of ntm: the bit words x such that some c * |x| coins encode an accepting computation of ntm on the word unframe x framed at the start of x.

The padded problem is in NP, with certificates of length c * |x|.

theorem Turing.MultiTapeNTM.DecidesInTime.frame_append_mem_padded_iff {k : ℕ} {State : Type} [Finite State] {α : Type} {enc : α ↪ List Bool} {ntm : MultiTapeNTM k Bool State} {A : Set α} {t : α → ℕ} (h : ntm.DecidesInTime enc A t) {a : α} {c : ℕ} {u : List Bool} (hc : Nat.card (Action k Bool State) * t a ≤ c * (MultiTapeTM.frame (enc a) ++ u).length) :
MultiTapeTM.frame (enc a) ++ u ∈ ntm.padded c ↔ a ∈ A

Padded instances. If ntm decides A within t, then the padded word frame (enc a) ++ u is in the padded problem of ntm with c coins per bit exactly when a ∈ A, as soon as c * |frame (enc a) ++ u| is at least M * t a, for the number M of actions.

The translation lemma #

NP is easy on exponentially padded instances: every problem B ∈ NP agrees with some problem B' ∈ P on the words frame u ++ 1^m with 2 ^ |u| ≤ m. This holds if NP ⊆ P (Cslib.Complexity.expPaddedNPEasy_of_NP_subset_P), and also if every distributional NP problem with a polynomial-time computable ensemble has a polynomial-time heuristic scheme (Cslib.Complexity.expPaddedNPEasy_of_DistNP_subset_HeurP). It suffices for the padding arguments below.

If NP ⊆ P, then NP is easy on exponentially padded instances.

Writing padded instances #

Writing an exponentially padded instance. If f is computable in unary in polynomial time and n ≤ f n, then a ↦ frame (enc a) ++ 1^{2 ^ f |enc a|} is computable within time O(2 ^ (d * f n)) for some d.

theorem Cslib.Complexity.exists_mem_NP_frame_append_mem_iff_of_mem_NTIME {α : Type} {enc : α ↪ List Bool} {A : Set α} {t : ℕ → ℕ} (hA : A ∈ NTIME enc t) :
∃ B ∈ NP Turing.MultiTapeTM.encBits, ∀ (a : α) (u : List Bool), t (enc a).length ≤ u.length → (Turing.MultiTapeTM.frame (enc a) ++ u ∈ B ↔ a ∈ A)

Padding into NP. A problem A decidable by a nondeterministic machine within time O(t n) is decided on padded instances by a problem in NP: some B ∈ NP contains frame (enc a) ++ u, for every padding u of length at least t |enc a|, exactly when a ∈ A. The problem B is the padded problem of the machine (Turing.MultiTapeNTM.padded).

The translation lemma on padded instances. Suppose every problem in NP agrees with some problem in P on the words frame u ++ 1^{t |u|}, and t n is computable in unary from any word of length n within time O(T n). Then every problem decidable by a nondeterministic machine within time O(t n) is decidable deterministically within time O((n + T n + 1) ^ d) for some d: the padded problem with padding t n agrees with a problem in P on padded instances, and the padding is written within time O(n + T n).

theorem Cslib.Complexity.NTIME_subset_iUnion_DTIME_of_NP_subset_P {α : Type} {enc : α ↪ List Bool} (hNP : NP Turing.MultiTapeTM.encBits ⊆ P Turing.MultiTapeTM.encBits) {t T : ℕ → ℕ} {S : List Bool → ℕ} (hpad : Turing.MultiTapeTM.ComputableInO (fun (x : List Bool) => t x.length) Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encUnary (fun (x : List Bool) => T x.length) S) :
NTIME enc t ⊆ ⋃ (d : ℕ), DTIME enc fun (n : ℕ) => (n + T n + 1) ^ d

The translation lemma. If NP ⊆ P for problems on bit words, and t n is computable in unary from any word of length n within time O(T n), then every problem decidable by a nondeterministic machine within time O(t n) is decidable deterministically within time O((n + T n + 1) ^ d) for some d: the padded problem with padding t n is in NP, hence in P, and the padding is written within time O(n + T n).

theorem Cslib.Complexity.NTIME_two_pow_subset_iUnion_DTIME_of_expPaddedNPEasy {α : Type} {enc : α ↪ List Bool} (hNP : ExpPaddedNPEasy) {f : ℕ → ℕ} (hf : Turing.MultiTapeTM.ComputableInPolyTime f Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hn : ∀ (n : ℕ), n ≤ f n) :
(NTIME enc fun (n : ℕ) => 2 ^ f n) ⊆ ⋃ (d : ℕ), DTIME enc fun (n : ℕ) => 2 ^ (d * f n)

Padding exponential time on padded instances. If NP is easy on exponentially padded instances, and f is computable in unary in polynomial time with n ≤ f n, then every problem decidable by a nondeterministic machine within time O(2 ^ f n) is decidable deterministically within time O(2 ^ (d * f n)) for some d.

Padding exponential time. If NP ⊆ P for problems on bit words, and f is computable in unary in polynomial time with n ≤ f n, then every problem decidable by a nondeterministic machine within time O(2 ^ f n) is decidable deterministically within time O(2 ^ (d * f n)) for some d.

Exponential time #

theorem Cslib.Complexity.NE_subset_E_of_expPaddedNPEasy {α : Type} {enc : α ↪ List Bool} (hNP : ExpPaddedNPEasy) :
NE enc ⊆ E enc

If NP is easy on exponentially padded instances, then NE ⊆ E, by the padding argument of Book Book.

If NP ⊆ P, then NE ⊆ E, by padding Book.

If NP is easy on exponentially padded instances, then NEXP ⊆ EXP, by padding.

If P = NP, then E = NE, by padding Book.

Upward translation from NP to NTIME and NEXP #

theorem Cslib.Complexity.preimage_mem_NTIME_of_mem_NP {α : Type} {enc : α ↪ List Bool} {B : Set (List Bool)} {g : α → List Bool} {T₀ : ℕ → ℕ} {S : α → ℕ} (hB : B ∈ NP Turing.MultiTapeTM.encBits) (hg : Turing.MultiTapeTM.ComputableInO g enc Turing.MultiTapeTM.encBits (fun (a : α) => T₀ (enc a).length) S) :
∃ (d : ℕ), g ⁻¹' B ∈ NTIME enc fun (n : ℕ) => (T₀ n + 1) ^ d

Pulling back a problem B ∈ NP encBits along a function g : α → List Bool computable within time O(T₀ (enc a).length) places g ⁻¹' B in NTIME enc (fun n => (T₀ n + 1) ^ d) for some d: a deterministic machine writes g a to a buffer tape and hands off to the halting fair-coin certificate verifier for B.

Pulling back B ∈ NP encBits along the exponential-padding map a ↦ frame (enc a) ++ List.replicate (2 ^ f (enc a).length) true, where f is polynomial-time in unary with n ≤ f n, gives a problem in NEXP enc.

Pulling back B ∈ NP encBits along x ↦ x ++ List.replicate (2 ^ x.length) true gives a problem in NEXP encBits.

Pulling back B ∈ P (encPair encBits encBits) along (a, y) ↦ (frame (enc a) ++ List.replicate (2 ^ f (enc a).length) true, y), where f is polynomial-time in unary, gives a problem in EXP (encPair enc encBits).

Pulling back B ∈ P (encPair encBits encUnary) along a ↦ (frame (enc a) ++ List.replicate (2 ^ f (enc a).length) true, 2 ^ g (enc a).length), where f and g are polynomial-time in unary with n ≤ f n, gives a problem in EXP enc.