Cook's Problem Statement, negative answer: (Clay Millennium Prize Problem)
OpenPvsNP.P_ne_NPCook's Problem Statement (p. 2) reads: Does ? This theorem asserts the negative answer,
the class of languages over that are decided by some multi-stack machine within a polynomial number of steps is not the same as the class of languages that have a polynomial-time checking relation with polynomially bounded certificates. Since (Cook, p. 2; a milestone of this mission), the statement is equivalent to the existence of a language with a polynomial-time checking relation and an exponent such that for all , but with no polynomial-time decision procedure.
Cook (p. 7): "Most complexity theorists believe that ." The Millennium Prize is offered for a proof of either answer; this theorem is the conjectured one. It is open: a proof would settle the Millennium Prize Problem and, by Cook's Proposition 1(c), show that none of the -complete problems (Satisfiability, 3-SAT, Karp's 21 problems, and the hundreds catalogued since) has a polynomial-time algorithm. Its role in the mission is to fix in Lean the exact statement the prize asks about, so that the classical partial results (the milestones) are formalized against the same definitions.
Formalization Note P and NP are the sets of languages PvsNP.P, PvsNP.NP : Set (Language Bool) of the definition bundle, defined via Mathlib's Turing.TM2ComputableInPolyTime over the multi-stack machine model, which is polynomially equivalent to Turing machines. The statement is the inequality of these two sets. If is in fact true, this theorem is false; its negation is not an item of the mission.
import Definitions.Def_PvsNP import Mathlib
namespace PvsNP theorem P_ne_NP : P ≠ NP := by sorry end PvsNP
Read-back
What the Lean code literally says, in plain math · claude-fable-5-1
Read-back: PvsNP.P_ne_NP
Statement. The declaration asserts
where and are two specific sets of languages over the alphabet , defined in the accompanying bundle as spelled out below. A "language" here is simply an arbitrary set of finite lists of Booleans (no computability or decidability requirement is built into the notion of language itself). The statement is the negation of set equality: it is not the case that every language in is in and every language in is in . Classically this is equivalent to: there is a language over lying in exactly one of the two sets. The declaration has no hypotheses, no free variables and no typeclass assumptions; the proof body is a placeholder (sorry), so nothing is proved — the read-back below describes only what is claimed.
Throughout, a string means a finite list of Booleans; denotes its length (the empty string is allowed, ).
The machine model used by both classes
Both classes are defined via a fixed notion " is computable in polynomial time by a stack machine", taken from Mathlib (Turing.TM2ComputableInPolyTime). Unfolded, "there exists a polynomial-time machine computing with input encoding and output encoding " means that the following data exist (the definitions below use it only as a proposition, i.e. only the existence of such data matters, not any particular choice):
- A finite stack machine consisting of:
- a finite type of stack indices with decidable equality, together with two distinguished indices (input stack) and (output stack), which are allowed to coincide;
- for each a type of symbols that may be stored on stack ; the only finiteness requirement on these is that is finite — the symbol types of the other stacks are arbitrary types (though is forced to be finite by the bijection with the output alphabet below);
- a finite type of program labels with a distinguished label ;
- a finite type of internal states with a distinguished initial state ;
- a program , assigning to every label a statement. Statements are finite trees built from: push onto stack a symbol computed from the current internal state by an arbitrary function ; peek at the top of stack and update the internal state by an arbitrary function ; pop stack and update the internal state likewise; load, applying an arbitrary function ; branch on an arbitrary predicate ; goto a label chosen by an arbitrary function ; and halt. (The functions inside statements are arbitrary set-theoretic functions; since and are finite this is unproblematic, but no restriction such as computability of these functions is imposed.)
- A bijection between the input-stack symbols and the input alphabet , and a bijection between the output-stack symbols and the output alphabet .
- A polynomial with natural-number coefficients (any element of , including constant polynomials and the zero polynomial).
- A correctness-with-time-bound proof: for every input , letting be the encoded input (a list over ), the machine started in the initial configuration — current label , internal state , stack holding applied elementwise to (first list element on top), all other stacks empty — reaches, after some number of steps with
exactly the halting configuration for the output: current label "halted", internal state equal to the initial state again, stack holding applied elementwise to , and every other stack empty (in particular, if the input stack must have been emptied). A step means one application of the step function, which executes an entire statement tree from a label up to and including its terminal goto or halt; the many pushes/pops inside a single statement count as one step. "Reaches after steps" is the exact equality of the -fold iterate of the step function (in the option monad) with the halting configuration; because a halted configuration has no successor, is exactly the number of steps at which the machine halts.
Two encodings from Mathlib are used:
- , sending (the one-element list).
- The identity encoding on strings (input alphabet ; the encoded input is the string itself, so the time bound is ).
The bundle adds one encoding of its own:
- , with
i.e. the symbols of tagged "left" followed by the symbols of tagged "right"; the input alphabet is the four-element type and .
The class
A language (a set of strings) belongs to iff there exists a total function such that
- is a polynomial-time decider: there exists a finite stack machine, in the sense above, with input encoding the identity on strings (input alphabet ), output encoding (output alphabet ), and some polynomial , which for every string , started on , halts within steps in the halting configuration whose output stack holds exactly the one-symbol list and whose other stacks are empty; and
- for every string : .
The class
A language belongs to iff there exist a total function and a natural number (with allowed) such that
- is a polynomial-time checker: there exists a finite stack machine, in the sense above, with input encoding (input alphabet ), output encoding , and some polynomial , which for every pair , started on , halts within steps in the halting configuration whose output stack holds exactly and whose other stacks are empty; and
- for every string :
Edge cases made explicit by the quantifiers: the exponent ranges over all natural numbers including , in which case the bound reads for every (with , so this also applies to the empty string); for and the empty string the bound is , so only the empty certificate is admissible. The certificate bound is , not . The polynomial time bound for the checker is measured in , not in alone. There is no requirement that or be anything beyond a total Boolean-valued function that some machine computes within the stated bound.
What the theorem claims, assembled
Let be the set of all languages for which some Boolean-valued function on strings, computed by a finite stack machine (as specified above, with identity input encoding and one-symbol output) within a polynomial number of steps in the input length, satisfies for all . Let be the set of all languages for which some Boolean-valued function on pairs of strings, computed by a finite stack machine (with the tagged-concatenation input encoding and one-symbol output) within a polynomial number of steps in , together with some , satisfies for all . The declaration P_ne_NP asserts
as an inequality of sets of languages, with no further hypotheses. It does not assert which inclusion fails, does not assert , and does not exhibit any witness language; it also makes no reference to the other notions in the bundle (reductions, -completeness, , CNF formulas, , ), none of which occur in the statement.