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: map the canonical input over its concrete alphabet
Browse filesChecks
build Program · lake build, no sorry
Details
challenge Program · statement files and build config
Details
+7 −3 Problems/PVersusNP/Machines/CertificateBound.lean View file
| @@ -444,8 +444,12 @@ def checked {α Γ : Type} [Fintype Γ] {ea : FinEncoding α} | ||
| 444 | 444 | have inputEq : |
| 445 | 445 | List.map h.inputAlphabet.invFun ((pair_encoding ea (fin_encoding_string Γ)).encode p) = |
| 446 | 446 | xs ++ sep :: ys := by |
| 447 | - rw [pair_encoding.encode_eq, List.map_append, List.map_cons, List.map_map, List.map_map] | |
| 448 | - rfl | |
| 447 | + refine (congrArg (List.map h.inputAlphabet.invFun) | |
| 448 | + (pair_encoding.encode_eq ea (fin_encoding_string Γ) p)).trans ?_ | |
| 449 | + change List.map (fun a : ea.Γ ⊕ Option Γ => h.inputAlphabet.symm a) | |
| 450 | + ((ea.encode p.1).map Sum.inl ++ Sum.inr none :: p.2.map (fun b => Sum.inr (some b))) = | |
| 451 | + xs ++ sep :: ys | |
| 452 | + simp only [List.map_append, List.map_cons, List.map_map, xs, ys, sep] <;> rfl | |
| 449 | 453 | have noSep : ∀ x ∈ xs, x ≠ sep := by |
| 450 | 454 | intro x hx eq |
| 451 | 455 | obtain ⟨a, _, rfl⟩ := List.mem_map.mp hx |
| @@ -461,7 +465,7 @@ def checked {α Γ : Type} [Fintype Γ] {ea : FinEncoding α} | ||
| 461 | 465 | let n := 0 + xs.length |
| 462 | 466 | let m := 0 + ys.length |
| 463 | 467 | let cap := 1 * n ^ k |
| 464 | - have powered := powerRun (sep := sep) (reject := reject) k ⟨k, by omega⟩ rfl | |
| 468 | + have powered := powerRun (sep := sep) (reject := reject) (k := k) k ⟨k, by omega⟩ rfl | |
| 465 | 469 | { saved := saved, base := n, count := 1, cert := m } |
| 466 | 470 | have cleared := clearBaseRun (sep := sep) (reject := reject) (k := k) n |
| 467 | 471 | { saved := saved, count := cap, cert := m } |