Cook Proposition 1(a): if and , then
ProvedPvsNP.mem_P_of_pReducibleCook, Proposition 1(a) (p. 4): "If and , then ."
For all languages : if there is a polynomial-time computable function with for all (Cook's Definition 3), and has a polynomial-time decision procedure, then has one. Cook calls the proposition "easy to prove"; this part is the closure of under polynomial-time many-one reductions and is the analogue of "if and is decidable then is decidable" from computability theory (p. 3).
Formalization Note The proof is the composition of the machine computing with the machine deciding , the polynomial bound coming from : this is exactly the polynomial-time composition of multi-stack machines that Mathlib records as proof_wanted TM2ComputableInPolyTime.comp. and are explicit universally quantified arguments.
import Definitions.Def_PvsNP import Mathlib
namespace PvsNP
theorem mem_P_of_pReducible (L₁ L₂ : Language Bool) (h : PReducible L₁ L₂) (h₂ : L₂ ∈ P) :
L₁ ∈ P := by sorry
end PvsNPRead-back
What the Lean code literally says, in plain math · claude-fable-5-1
Read-back: PvsNP.mem_P_of_pReducible
Statement. For every pair of sets of finite Boolean strings (a "language over " is literally an arbitrary subset of the set of finite lists of Booleans, the empty list included; no decidability, finiteness or other restriction is placed on or , and either may be empty or all of ), if
- is p-reducible to in the sense spelled out below (hypothesis ), and
- belongs to the class defined below (hypothesis ),
then belongs to . The theorem is a bare implication between these three membership/relational facts; it asserts nothing about the machine, polynomial, or decision function witnessing the conclusion beyond their existence.
Hypothesis : " is p-reducible to ". There exists a total function such that
- is polynomial-time computable (unfolded below with input encoding and output encoding , i.e. a string is fed to and read from the machine as itself), and
- for every string : (a biconditional, for all strings, including the empty string).
Hypothesis : "". There exists a total function such that
- is polynomial-time computable in the sense unfolded below, with input encoding and output encoding , where is the one-element list containing ; and
- for every string : .
Conclusion: "". There exists a total function that is polynomial-time computable (same sense, encodings and ) with for all .
The notion " is polynomial-time computable with encodings " (used above with , ; and with or , , ). It is the mere existence (a proposition, "nonempty") of the following data:
- A bundled stack machine (a finite "TM2" in Mathlib's sense), consisting of:
- a finite type of stack indices with decidable equality, and two designated indices (input stack) and (output stack) — is allowed;
- for each a type of symbols that may be stored on stack ; only is required to be finite (the other are arbitrary types, subject only to the alphabet bijections below for );
- a finite type of function labels with a designated label ;
- a finite type of internal states with a designated ;
- a program assigning to every label a statement . Statements are finite trees built from: push onto stack a symbol computed from the internal state; peek at the top of stack (an optional symbol, absent if the stack is empty) and update the internal state; pop the top of stack and update the internal state; load, i.e. apply a function to the internal state; branch on a Boolean function of the internal state between two sub-statements; goto a label chosen as a function of the internal state; and halt. The functions inside statements (e.g. , ) are arbitrary mathematical functions.
- Alphabet bijections and (in all three uses in this theorem both the input and output symbol types are in bijection with ).
- A polynomial with natural-number coefficients (of any degree, constants included; is a legal polynomial).
- A correctness-and-time proof: for every input (here every ), writing
the machine, started in the configuration
reaches after exactly some number of steps the configuration
with
where is the length of the encoded input list (for this is just the length of the input string). More precisely, the requirement is that iterating the one-step transition times from (in the option-valued sense where a halted configuration, whose label is "none", steps to "no configuration", which is then absorbing) yields precisely the configuration : same halted label, internal state equal to again, output stack equal to , and all other stacks empty (if , the single stack must hold ). The witness is a specific natural number depending on , and since the target configuration is halted, it is exactly the number of steps at which the machine halts.
What one "step" is. From a configuration with current label , internal state and stacks , one step executes the entire statement — following pushes, peeks, pops, loads and branches in sequence — until it hits a (yielding a new configuration with the chosen label) or a (yielding a configuration with label "none"). Thus the time bound counts executed labelled function bodies, not individual stack operations. A configuration with label "none" has no successor.
Specialisations relevant to this theorem.
- For the reduction (encodings ): the input stack initially holds of the bits of (in order), and at halting the output stack must hold of the bits of , within steps.
- For the deciders (encodings ): at halting the output stack must consist of the single symbol , within steps.
- In all cases the run must terminate for every string, including the empty string (for which the bound is , the constant coefficient), and the internal state must be back at at halting.
Degenerate/edge observations (about what the quantifiers literally include). range over all subsets of . The functions are arbitrary total functions; only the existence of a machine as above certifies them. If for some , the bound forces , which would require , impossible since their labels differ ( vs. none); so such a polynomial can never witness the property for that input. Polynomial-time computability is stated as a proposition (existence of the data), not as an explicit machine; hence the hypotheses and conclusion are all propositions, and the theorem provides no construction. Nothing in the statement relates the polynomial of , the polynomial of , or the size of reduced strings to the polynomial of ; the conclusion only demands that some polynomial and some machine for some exist.