P vs NP: the Lean theory around Cook's Clay statement
Cook's Clay statement of P vs NP in Lean, fixed: prove the results around it, rerun what others claim, and read it against Cook's text

fix: transport runs through explicit state-transition equalities
Browse filesChecks
build Program · lake build, no sorry
Details
challenge Program · statement files and build config
Details
+6 −3 Problems/PVersusNP/Machines/CertificateBound.lean View file
| @@ -470,7 +470,8 @@ def checked {α Γ : Type} [Fintype Γ] {ea : FinEncoding α} | ||
| 470 | 470 | have prefixRun := EvalsTo.trans _ _ _ _ scan (EvalsTo.trans _ _ _ _ powered |
| 471 | 471 | (EvalsTo.trans _ _ _ _ cleared compared)) |
| 472 | 472 | have lengths : (m ≤ cap) ↔ |
| 473 | - p.2.length ≤ (ea.encode p.1).length ^ k := by simp [xs, ys, m, cap, n] | |
| 473 | + p.2.length ≤ (ea.encode p.1).length ^ k := by | |
| 474 | + simp only [m, cap, n, xs, ys, Nat.zero_add, Nat.one_mul, List.length_map] <;> rfl | |
| 474 | 475 | have started := (congrArg (initList (guarded h.tm sep reject k)) inputEq).trans |
| 475 | 476 | (initial (sep := sep) (reject := reject) (k := k) (xs ++ sep :: ys)) |
| 476 | 477 | let finish (b : Bool) : (guarded h.tm sep reject k).Cfg := |
| @@ -488,13 +489,15 @@ def checked {α Γ : Type} [Fintype Γ] {ea : FinEncoding α} | ||
| 488 | 489 | have ended := (final (sep := sep) (reject := reject) (k := k) |
| 489 | 490 | (List.map h.outputAlphabet.invFun (finEncodingBoolBool.encode (verifier p)))).trans |
| 490 | 491 | (congrArg finish (if_pos bound).symm) |
| 491 | - exact started.symm ▸ ended ▸ doneRun | |
| 492 | + exact Eq.mp (congrArg₂ (fun a b => | |
| 493 | + EvalsTo (guarded h.tm sep reject k).step a (some b)) started.symm ended) doneRun | |
| 492 | 494 | · have no := lengths.not.mpr bound |
| 493 | 495 | simp only [no, decide_false, Bool.and_false] at prefixRun |
| 494 | 496 | have doneRun := EvalsTo.trans _ _ _ _ prefixRun (rejectRun saved) |
| 495 | 497 | have ended : haltList (guarded h.tm sep reject k) [reject] = |
| 496 | 498 | finish (check ea k verifier p) := congrArg finish (if_neg bound).symm |
| 497 | - exact started.symm ▸ ended ▸ doneRun | |
| 499 | + exact Eq.mp (congrArg₂ (fun a b => | |
| 500 | + EvalsTo (guarded h.tm sep reject k).step a (some b)) started.symm ended) doneRun | |
| 498 | 501 | |
| 499 | 502 | end |
| 500 | 503 | |