Cook Proposition 1(c): an -complete language in forces
ProvedPvsNP.P_eq_NP_of_npComplete_mem_PCook, Proposition 1(c) (p. 5): "If is -complete and , then ."
For every language : if , every language in is p-reducible to , and has a polynomial-time decision procedure, then the classes and are equal as sets of languages. Cook: "part (c) follows from part (a)", and it "explains why it is probably a waste of time looking for a polynomial-time algorithm for an -complete problem" (p. 5). Together with the Cook–Levin theorem it shows that the whole versus question is the question whether Satisfiability has a polynomial-time algorithm.
Formalization Note The conclusion is the equality P = NP of two sets of type Set (Language Bool); by it amounts to , which follows from Proposition 1(a) applied to each with the reduction .
import Definitions.Def_PvsNP import Mathlib
namespace PvsNP
theorem P_eq_NP_of_npComplete_mem_P (L : Language Bool) (hL : NPComplete L) (hP : L ∈ P) :
P = NP := by sorry
end PvsNPRead-back
What the Lean code literally says, in plain math · claude-fable-5-1
Read-back: PvsNP.P_eq_NP_of_npComplete_mem_P
Throughout, is the two-letter Boolean alphabet, is the set of all finite lists (strings) of Booleans, including the empty string, and is the length of a string . A language is any subset (there is no restriction whatsoever on : it may be empty, all of , or undecidable). The two classes and appearing in the statement are specific sets of such languages over , defined below by way of a specific machine model; languages over any other alphabet do not appear.
The statement. For every language , if
- is "NP-complete" in the sense spelled out below, namely and every is polynomial-time many-one reducible to (in the sense below), and
- (in the sense below),
then the two sets of languages are equal:
i.e. for every language , if and only if . The statement is a conditional: if no language satisfies both hypotheses 1 and 2 simultaneously, it asserts nothing. Neither nor any other relation between the classes is assumed; the conclusion is full set equality.
The machine model (what "computable in polynomial time" means everywhere below). All computability notions are phrased through one notion, "there exists a polynomial-time stack machine computing with respect to input encoding and output encoding ", where , and are arbitrary functions (the encodings are not required to be injective or decodable; they are just functions to lists). This notion means that the following data exist (the existence is all that is used; the specific machine is not fixed):
- A machine consisting of: a finite set of stack indices (with decidable equality) and two designated indices (input stack) and (output stack), which are allowed to coincide; for every a type of symbols that may be stored on stack , where only is required to be finite (the alphabets of the other stacks may be arbitrary, possibly infinite, types); a finite set of program labels with a designated main label; a finite set of internal states with a designated initial state ; and a program assigning to each label a statement. A statement is a finite tree built from the operations: push onto stack a symbol computed from the internal state; peek at the top of stack (possibly absent) and update the internal state accordingly; pop the top of stack (possibly absent) and update the internal state accordingly; replace the internal state by a function of itself; branch on a Boolean function of the internal state; ending either in "go to the label computed from the internal state" or in "halt".
- A bijection between and and a bijection between and .
- A polynomial in one variable with natural-number coefficients (any such polynomial, including constants).
- A proof that for every input there is a number of steps such that, starting from the initial configuration (current label main, internal state , stack holding the list transported through the bijection with the first symbol on top, and every other stack empty), after exactly applications of the one-step transition the machine is in the halting configuration determined by , namely: no current label (halted), internal state equal to the initial state again, stack holding the list transported through the bijection, and every other stack empty (so, when , the input stack must have been completely emptied). One step is the execution of the entire statement attached to the current label (all of its pushes, pops, peeks, loads and branches, however many, count as a single step); the count is the number of such label-executions. The time bound is a function of the length of the encoded input , not of itself.
The functions involved are always total, so a machine as above halts on every input in the required form.
The class . means: there is a total function such that
- there exists a polynomial-time stack machine (as above) computing with input encoding the identity (so and the time bound is ) and output encoding , the one-symbol list (so and the output stack must hold exactly the single symbol at halting); and
- for every : .
The class . means: there exist a total function and a natural number such that
- there exists a polynomial-time stack machine computing with input encoding
over the four-symbol alphabet (the symbols of tagged "left", followed by the symbols of tagged "right"; the encoded length is , so the time bound is ), and output encoding ; and
- for every :
Here is ordinary natural-number exponentiation with (also ); in particular is allowed (then ), and for and the empty string the only admissible witness is the empty string. The checker must be computed within time on all pairs, including those with . The exponent is one fixed number for the language, but is otherwise arbitrary.
Polynomial-time reducibility. For languages , " is polynomial-time reducible to " means: there is a total function such that
- there exists a polynomial-time stack machine computing with both input and output encodings the identity on (so , the time bound is , and at halting the output stack holds exactly the string ); no bound on is stated other than what this implies; and
- for every : .
NP-completeness. " is NP-complete" means: , and for every language with , is polynomial-time reducible to in the sense just given.
Summary in one sentence. For any set of Boolean strings, if belongs to (as defined above via a checker , a witness-length exponent and a polynomial-time stack machine), every member of many-one reduces to via a function computed by a polynomial-time stack machine with identity encodings, and also belongs to (decided by a polynomial-time stack machine with identity input encoding and one-symbol output), then the set and the set of languages over are one and the same set.