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

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