4.6.22 · D1Theory of Computation

Foundations — P — polynomial time

1,741 words8 min readBack to topic

Before you can read " is in P if runs in steps," you need about a dozen ideas that the parent note assumed. We build them one at a time, each resting on the one before.


1. What is an input, and how big is it?

Why the topic needs this. Every timing claim in P is measured against . The single most important trap on the parent page — "trial division looks fast but isn't" — is entirely about the difference between the value a string represents and the length of the string. So must be crystal clear before anything else.


2. What is a decision problem (a "language")?

Why appears. The parent writes . The symbol means =="is a subset of" — every member of the left is also a member of the right==. It just says: is some collection of bit-strings (the yes-instances), sitting inside the pool of all bit-strings.


3. What is a step, a machine, and "deciding"?

Why the topic needs . "Fast enough to trust" is meaningless until we fix what a step is. The Turing machine gives us a countable unit of work. Thanks to the Cobham–Edmonds thesis, the number of steps is essentially the same (up to a polynomial factor) whether you use a TM, a RAM, or your laptop — so P doesn't depend on which machine you picture.


4. Counting steps: the running time function

Why Big-O. We don't care whether a step takes 3 or 7 machine-cycles — that's a constant we can't control and it changes between computers. We care about the shape of the growth. Big-O throws away the constant and keeps the shape. That's exactly what makes P model-robust.


5. What is a polynomial, and why is it the finish line?


6. Assembling the parent's definition

Now every symbol in the headline is earned. Read it slowly:

That single line now reads in plain English: "P is every yes/no problem a deterministic computer can settle in a number of steps bounded by a fixed power of the input's length."


Prerequisite map

contrast

Input string x over 0 and 1

Length n equals size of x

Language L the yes-set

Deterministic Turing machine M

One step read write move

Running time T of n worst case

Big-O growth shape

Polynomial n to the k

Exponential 2 to the n

Class P

Read it bottom-up: strings give length; machine gives steps; steps + length give running time; Big-O shapes it; polynomial is the threshold — and languages decided that fast form P.


Equipment checklist

Self-test: can you answer each before revealing?

What does mean?
Every finite string of 0s and 1s — "zero or more bits strung together" (Kleene star).
What is ?
The number of symbols in the input — its length, not the value it represents.
What is a language ?
The set of all inputs whose answer is "yes"; solving the problem means deciding membership in .
What does assert?
That the correct answer for input is YES.
What does "deterministic" mean for a Turing machine?
The next action is completely fixed by the current symbol and state — no guessing or branching.
What is one "step"?
A single read-write-move-and-change-state action of the machine's head.
What does " decides " require?
always halts and outputs yes exactly when , no otherwise.
What is ?
The worst-case number of steps over all inputs of length .
What does mean?
for some constant and all large enough — growth ignoring constants.
Polynomial vs. exponential — where is ?
Polynomial has in the base (); exponential has in the exponent ().
Why is P closed/robust?
Because polynomials compose: a polynomial of a polynomial is still polynomial.
What does collect?
All languages decidable in for some constant exponent .

Connections

  • Parent: P — polynomial time
  • Turing Machine
  • Time complexity & Big-O
  • TIME complexity classes
  • Cobham–Edmonds thesis
  • NP — nondeterministic polynomial time
  • Polynomial-time reductions
  • P vs NP problem
  • NP-complete problems