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

Compare the decisions independently of their instance witnesses
Browse filesChecks
build Program · lake build, no sorry
Details
challenge Program · statement files and build config
Details
+1 −4 Problems/PVersusNP/Examples/Palindrome.lean View file
| @@ -192,7 +192,6 @@ theorem halt_eq (out : List Bool) : | ||
| 192 | 192 | funext k |
| 193 | 193 | cases k <;> rfl |
| 194 | 194 | |
| 195 | -set_option pp.explicit true in | |
| 196 | 195 | /-- Each phase takes at most one step per symbol and one final transition. -/ |
| 197 | 196 | def run (inp : List α) : |
| 198 | 197 | EvalsToInTime (machine α).step (initList (machine α) inp) |
| @@ -206,9 +205,7 @@ def run (inp : List α) : | ||
| 206 | 205 | have h := follow (follow hc hr) he |
| 207 | 206 | rw [show 3 * inp.length + 3 = |
| 208 | 207 | (inp.length + 1) + (inp.length + 1) + (inp.length + 1) by omega] |
| 209 | - by_cases equal : inp = inp.reverse | |
| 210 | - · simpa only [decide_eq_true equal, Bool.true_and] using h | |
| 211 | - · simpa only [decide_eq_false equal, Bool.true_and] using h | |
| 208 | + convert h using 1 <;> congr 5 <;> first | rfl | apply Subsingleton.elim | simp | |
| 212 | 209 | |
| 213 | 210 | /-- The polynomial-time witness for comparison with the reversed input. -/ |
| 214 | 211 | noncomputable def decider (α : Type) [Fintype α] [DecidableEq α] : |