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: specify the output stack and guarded Boolean equalities
Browse filesChecks
build Program · lake build, no sorry
Details
challenge Program · statement files and build config
Details
+5 −3 Problems/PVersusNP/Machines/CertificateBound.lean View file
| @@ -414,7 +414,7 @@ private def rejectRun (saved : List (tm.Γ tm.k₀)) : | ||
| 414 | 414 | funext j |
| 415 | 415 | by_cases eq : j = Sum.inl tm.k₁ |
| 416 | 416 | · subst j |
| 417 | - exact (Function.update_self (.inl tm.k₁) [reject] empty).trans | |
| 417 | + exact (Function.update_self (Sum.inl tm.k₁ : tm.K ⊕ Aux) [reject] empty).trans | |
| 418 | 418 | (haltList_stk_self (guarded tm sep reject k) [reject]).symm |
| 419 | 419 | · exact (Function.update_of_ne eq [reject] empty).trans |
| 420 | 420 | (haltList_stk_ne (guarded tm sep reject k) [reject] eq).symm |
| @@ -524,16 +524,18 @@ def checked {α Γ : Type} [Fintype Γ] {ea : FinEncoding α} | ||
| 524 | 524 | rw [List.append_nil, hs] at restored |
| 525 | 525 | have doneRun := EvalsTo.trans _ _ _ _ prefixRun |
| 526 | 526 | (EvalsTo.trans _ _ _ _ restored (liftRun original)) |
| 527 | + have answer : check ea k verifier p = verifier p := if_pos bound | |
| 527 | 528 | have ended := (final (sep := sep) (reject := reject) (k := k) |
| 528 | 529 | (List.map h.outputAlphabet.invFun (finEncodingBoolBool.encode (verifier p)))).trans |
| 529 | - (congrArg finish (if_pos bound).symm) | |
| 530 | + (congrArg finish answer.symm) | |
| 530 | 531 | exact Eq.mp (congrArg₂ (fun a b => |
| 531 | 532 | EvalsTo (guarded h.tm sep reject k).step a (some b)) started.symm ended) doneRun |
| 532 | 533 | · have no := lengths.not.mpr bound |
| 533 | 534 | simp only [no, decide_false, Bool.and_false] at prefixRun |
| 534 | 535 | have doneRun := EvalsTo.trans _ _ _ _ prefixRun (rejectRun saved) |
| 536 | + have answer : check ea k verifier p = false := if_neg bound | |
| 535 | 537 | have ended : haltList (guarded h.tm sep reject k) [reject] = |
| 536 | - finish (check ea k verifier p) := congrArg finish (if_neg bound).symm | |
| 538 | + finish (check ea k verifier p) := congrArg finish answer.symm | |
| 537 | 539 | exact Eq.mp (congrArg₂ (fun a b => |
| 538 | 540 | EvalsTo (guarded h.tm sep reject k).step a (some b)) started.symm ended) doneRun |
| 539 | 541 | |