InNP L: a machine with the certificate on tape 1 halts within T |x| steps for every certificate, and x ∈ L exactly when some certificate makes it accept (Sipser's definition: the time bound ignores the certificate, so only a polynomial prefix of it can matter). P ⊆ NP: lift the decider with Embedding.skipOne so it never touches tape 1; it is then a verifier that ignores its certificate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diff
2 files changed +49 -0
| @@ -0,0 +1,48 @@ | ||
| 1 | +import PvsNP.Complexity.Reduction | |
| 2 | + | |
| 3 | +/-! | |
| 4 | +# The class NP | |
| 5 | + | |
| 6 | +`InNP L`: some machine verifies `L` in polynomial time. The input `x` is on tape `0` and a certificate | |
| 7 | +`w` on tape `1`; the verifier halts within `T |x|` steps whatever the certificate, and `x ∈ L` exactly | |
| 8 | +when some certificate makes it accept. Because the time bound depends on `|x|` alone, only the first | |
| 9 | +`T |x|` symbols of a certificate can matter, so certificates are polynomially short in effect | |
| 10 | +(Sipser, *Introduction to the Theory of Computation*, Definition 7.18). | |
| 11 | + | |
| 12 | +Proved here: | |
| 13 | +- `InP.inNP`: **P ⊆ NP**. A decider, run with tape `1` left alone, is a verifier that ignores its | |
| 14 | + certificate. | |
| 15 | +-/ | |
| 16 | + | |
| 17 | +namespace PvsNP | |
| 18 | + | |
| 19 | +variable {α : Type} | |
| 20 | + | |
| 21 | +/-- `L ∈ NP`: a machine verifies `L` in polynomial time. -/ | |
| 22 | +def InNP (L : Language α) : Prop := | |
| 23 | + ∃ (k : Nat) (M : Machine α k) (T : Nat → Nat), PolyBounded T ∧ VerifiesIn M L T | |
| 24 | + | |
| 25 | +namespace InNP | |
| 26 | + | |
| 27 | +/-- The time bound of a verifier can be taken of the form `c * (n + 1) ^ d`, hence monotone. -/ | |
| 28 | +theorem polyBound {L : Language α} (h : InNP L) : | |
| 29 | + ∃ (k : Nat) (M : Machine α k) (c d : Nat), VerifiesIn M L (PvsNP.polyBound c d) := by | |
| 30 | + obtain ⟨k, M, T, ⟨c, d, hT⟩, hM⟩ := h | |
| 31 | + exact ⟨k, M, c, d, hM.mono hT⟩ | |
| 32 | + | |
| 33 | +end InNP | |
| 34 | + | |
| 35 | +/-- **P ⊆ NP.** -/ | |
| 36 | +theorem InP.inNP {L : Language α} (h : InP L) : InNP L := by | |
| 37 | + obtain ⟨k, M, T, hT, hM⟩ := h | |
| 38 | + let E := Embedding.skipOne (Nat.le_refl (k + 1)) | |
| 39 | + have e : ∀ x w, (M.lift E).init (verifierTapes x w) = | |
| 40 | + M.liftCfg E (verifierTapes x w) (M.init (inputTapes x)) := by | |
| 41 | + intro x w | |
| 42 | + simp only [Machine.init, Machine.liftCfg, E, liftTapes_skipOne_inputTapes]; rfl | |
| 43 | + refine ⟨k + 1, M.lift E, T, hT, fun x w => ?_, fun x => ?_⟩ | |
| 44 | + · rw [e, Machine.run_lift]; exact (hM x).1 | |
| 45 | + · simp only [e, Machine.run_lift] | |
| 46 | + exact ⟨fun hx => ⟨[], (hM x).2.mpr hx⟩, fun ⟨_, hw⟩ => (hM x).2.mp hw⟩ | |
| 47 | + | |
| 48 | +end PvsNP | |