P — surface layer #
This file aggregates the definitions and theorems for P, FP, and PSPACE.
Definitions (from P/Defs.lean) #
P— polynomial time:⋃ k, DTIME(n^k)FP— functions computable in polynomial timePSPACE— polynomial space:⋃ k, DSPACE(n^k)
Theorems #
DTIME_union— DTIME is closed under union (AB Claim 1.5)id_mem_FP— the identity function is computable in linear timemem_P_iff_decidesInTime_polynomial— polynomial-evaluation normal form forPmem_FP_iff_computesInTime_polynomial— polynomial-evaluation normal formmem_FP_comp—FPis closed under function compositionmem_FP_pairWithInput— anFPresult can be paired with its original inputmem_P_preimage—Pis closed under preimages of functions inFPunaryLength_mem_FP— materializing the unary input length belongs toFPite_mem_finset_mem_FP— functions supported on a finite set belong toFPmem_FP_of_bounded_key,FPPred.of_bounded_key— any value or test of a polynomial-time key of bounded length is polynomial-timeCobhamFP_eq_FP— Cobham's machine-independent characterization ofFPiterate_mem_FP,iterate_mem_FP_of_polyBound,iterate_mem_FP_of_step_le,iterate_mem_FP_along— iterating a polynomial-time step is polynomial-time while the states stay polynomially shortrecFold_mem_FP_of_bound— so is a bitwise fold with polynomially short statescatRange_mem_FP,flatMap_range_mem_FP— concatenating a polynomial-time rule's outputs over a unary range is polynomial-time, with corollaries for list encodings, counts, bounded search, maxima and bitwise descriptionsUnaryFn,FPPred— closure rules for polynomial-time functions toℕ(written in unary) and polynomial-time tests: arithmetic, comparisons, connectives, case distinction, bounded loops, division, capped powers and logarithmsFPPred.forall_lt,FPPred.exists_lt— quantifying a polynomial-time test over the indices below a polynomial-time numbergetBit_mem_FP,UnaryFn.leadingTrueLength— polynomial-time bit reads and unary-prefix parsing, including missing bits and unterminated prefixestoBitsLE_mem_FP,bits_mem_FP,UnaryFn.fromBitsLE_min— writing a polynomial-time number in binary, and reading a binary numeral back below a polynomial-time capencodeList_mem_FP,natEncode_mem_FP— writing theDataEncodeencoding of a bit list or of a polynomial-time number
The identity function belongs to FP. The executable
copyInputToOutputTM copies the input to the output in n + 2 steps, and
this concrete bound is linear.