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: keep guarded machine projections reducible
Browse filesChecks
build Program · lake build, no sorry
Details
challenge Program · statement files and build config
Details
+4 −2 Problems/PVersusNP/Machines/CertificateBound.lean View file
| @@ -20,6 +20,8 @@ open Computability Turing StateTransition | ||
| 20 | 20 | |
| 21 | 21 | noncomputable section |
| 22 | 22 | |
| 23 | +set_option maxErrors 1 | |
| 24 | + | |
| 23 | 25 | private inductive Aux |
| 24 | 26 | | saved | base | temp | count | next | cert |
| 25 | 27 | deriving DecidableEq, Fintype |
| @@ -126,7 +128,7 @@ private def guard (tm : FinTM2) (sep : tm.Γ tm.k₀) (reject : tm.Γ tm.k₁) | ||
| 126 | 128 | else .push (.inl tm.k₁) (fun _ => reject) |
| 127 | 129 | (.load (fun _ => (none, tm.initialState)) .halt))) |
| 128 | 130 | |
| 129 | -private def guarded (tm : FinTM2) (sep : tm.Γ tm.k₀) (reject : tm.Γ tm.k₁) | |
| 131 | +private abbrev guarded (tm : FinTM2) (sep : tm.Γ tm.k₀) (reject : tm.Γ tm.k₁) | |
| 130 | 132 | (k : ℕ) : FinTM2 where |
| 131 | 133 | K := tm.K ⊕ Aux |
| 132 | 134 | kFin := by letI := tm.kFin; infer_instance |
| @@ -462,7 +464,7 @@ def checked {α Γ : Type} [Fintype Γ] {ea : FinEncoding α} | ||
| 462 | 464 | have prefixRun := EvalsTo.trans _ _ _ _ scan (EvalsTo.trans _ _ _ _ powered |
| 463 | 465 | (EvalsTo.trans _ _ _ _ cleared compared)) |
| 464 | 466 | have lengths : (m ≤ cap) ↔ |
| 465 | - p.2.length ≤ (ea.encode p.1).length ^ k := by simp [xs, ys, m, cap, n] | |
| 467 | + p.2.length ≤ (ea.encode p.1).length ^ k := by simp [xs, ys, m, cap, n] | |
| 466 | 468 | change Run h.tm sep reject k |
| 467 | 469 | (initList (guarded h.tm sep reject k) |
| 468 | 470 | (List.map h.inputAlphabet.invFun ((pair_encoding ea (fin_encoding_string Γ)).encode p))) |