{"repo":"pvsnp","commit":{"oid":"346abe536d053a5c1b61722fd9b9ea5144e9a85c","tree":"f2ec5842a9aae6fa83389b8f340fd95fc1f4f13f","parents":["f5592d3aedb2a3159eb374b0c8fe8cc6eec1d4da"],"author":{"name":"Claude","email":"noreply@anthropic.com","time_ms":1795945023000},"committer":{"name":"Claude","email":"noreply@anthropic.com","time_ms":1795945023000},"subject":"Define NP by polynomial-time verifiers; prove P ⊆ NP","message":"Define NP by polynomial-time verifiers; prove P ⊆ NP\n\nInNP L: a machine with the certificate on tape 1 halts within T |x|\nsteps for every certificate, and x ∈ L exactly when some certificate\nmakes it accept (Sipser's definition: the time bound ignores the\ncertificate, so only a polynomial prefix of it can matter).\n\nP ⊆ NP: lift the decider with Embedding.skipOne so it never touches tape\n1; it is then a verifier that ignores its certificate.\n\nCo-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>\n"},"diff":{"base":"f5592d3aedb2a3159eb374b0c8fe8cc6eec1d4da","head":"346abe536d053a5c1b61722fd9b9ea5144e9a85c","stat":{"files":2,"additions":49,"deletions":0},"files":[{"path":"PvsNP.lean","status":"modified","additions":1,"deletions":0,"binary":false,"patch":"--- a/PvsNP.lean\n+++ b/PvsNP.lean\n@@ -8,6 +8,7 @@\n import PvsNP.Complexity.Time\n import PvsNP.Complexity.P\n import PvsNP.Complexity.Reduction\n+import PvsNP.Complexity.NP\n \n /-! # P versus NP in Lean 4\n \n","truncated":false},{"path":"PvsNP/Complexity/NP.lean","status":"added","additions":48,"deletions":0,"binary":false,"patch":"--- /dev/null\n+++ b/PvsNP/Complexity/NP.lean\n@@ -0,0 +1,48 @@\n+import PvsNP.Complexity.Reduction\n+\n+/-!\n+# The class NP\n+\n+`InNP L`: some machine verifies `L` in polynomial time. The input `x` is on tape `0` and a certificate\n+`w` on tape `1`; the verifier halts within `T |x|` steps whatever the certificate, and `x ∈ L` exactly\n+when some certificate makes it accept. Because the time bound depends on `|x|` alone, only the first\n+`T |x|` symbols of a certificate can matter, so certificates are polynomially short in effect\n+(Sipser, *Introduction to the Theory of Computation*, Definition 7.18).\n+\n+Proved here:\n+- `InP.inNP`: **P ⊆ NP**. A decider, run with tape `1` left alone, is a verifier that ignores its\n+  certificate.\n+-/\n+\n+namespace PvsNP\n+\n+variable {α : Type}\n+\n+/-- `L ∈ NP`: a machine verifies `L` in polynomial time. -/\n+def InNP (L : Language α) : Prop :=\n+  ∃ (k : Nat) (M : Machine α k) (T : Nat → Nat), PolyBounded T ∧ VerifiesIn M L T\n+\n+namespace InNP\n+\n+/-- The time bound of a verifier can be taken of the form `c * (n + 1) ^ d`, hence monotone. -/\n+theorem polyBound {L : Language α} (h : InNP L) :\n+    ∃ (k : Nat) (M : Machine α k) (c d : Nat), VerifiesIn M L (PvsNP.polyBound c d) := by\n+  obtain ⟨k, M, T, ⟨c, d, hT⟩, hM⟩ := h\n+  exact ⟨k, M, c, d, hM.mono hT⟩\n+\n+end InNP\n+\n+/-- **P ⊆ NP.** -/\n+theorem InP.inNP {L : Language α} (h : InP L) : InNP L := by\n+  obtain ⟨k, M, T, hT, hM⟩ := h\n+  let E := Embedding.skipOne (Nat.le_refl (k + 1))\n+  have e : ∀ x w, (M.lift E).init (verifierTapes x w) =\n+      M.liftCfg E (verifierTapes x w) (M.init (inputTapes x)) := by\n+    intro x w\n+    simp only [Machine.init, Machine.liftCfg, E, liftTapes_skipOne_inputTapes]; rfl\n+  refine ⟨k + 1, M.lift E, T, hT, fun x w => ?_, fun x => ?_⟩\n+  · rw [e, Machine.run_lift]; exact (hM x).1\n+  · simp only [e, Machine.run_lift]\n+    exact ⟨fun hx => ⟨[], (hM x).2.mpr hx⟩, fun ⟨_, hw⟩ => (hM x).2.mp hw⟩\n+\n+end PvsNP\n","truncated":false}],"truncated":false},"jit":null,"api":"/v1/repos/pvsnp/commit?rev=346abe536d053a5c1b61722fd9b9ea5144e9a85c","api_url":"https://git.neoopensource.com/v1/repos/pvsnp/commit?rev=346abe536d053a5c1b61722fd9b9ea5144e9a85c"}