[proofplan]
We prove the inclusion by taking an arbitrary language $L \in \operatorname{P}$ and converting its deterministic polynomial-time decider into a nondeterministic polynomial-time decider. The conversion does not change the computation: at every nonhalting configuration, the nondeterministic machine has exactly the one move prescribed by the deterministic machine. Therefore the accepting and rejecting computations are identical, and the polynomial time bound is preserved.
[/proofplan]
[step:Choose an arbitrary deterministic polynomial-time language]
Let $L \subseteq \{0,1\}^*$ be an arbitrary language with $L \in \operatorname{P}$. By the definition of $\operatorname{P}$, there exist a deterministic Turing machine $M$ and a polynomial function
\begin{align*}
p: \mathbb{N} \to \mathbb{N}
\end{align*}
such that, for every input string $x \in \{0,1\}^*$, the machine $M$ halts on input $x$ in at most $p(|x|)$ steps and accepts $x$ if and only if $x \in L$.
[/step]
[step:View the deterministic decider as a nondeterministic decider with singleton branching]
Define a nondeterministic Turing machine $N$ as follows. The machine $N$ has the same states, tape alphabet, input alphabet, start state, accept state, reject state, and tape convention as $M$. For every nonhalting configuration $C$ of $M$, let the set of legal next configurations of $N$ from $C$ be the singleton set containing the unique next configuration prescribed by $M$.
Thus every computation path of $N$ on an input $x \in \{0,1\}^*$ is forced to follow exactly the deterministic computation path of $M$ on $x$.
[guided]
We now turn the deterministic machine into a nondeterministic one without changing the actual computation. A deterministic machine has exactly one legal next move from each nonhalting configuration. A nondeterministic machine is allowed to have several legal next moves, but it is also allowed to have only one. Therefore a deterministic transition rule is a special case of a nondeterministic transition rule.
Define $N$ to have the same machine data as $M$: the same finite set of states, the same tape alphabet, the same input alphabet $\{0,1\}$, the same start state, the same accepting state, and the same rejecting state. If $C$ is a nonhalting configuration of $M$, denote by $C'$ the unique configuration reached from $C$ after one transition of $M$. We declare that the nondeterministic machine $N$ has exactly one legal transition from $C$, namely the transition from $C$ to $C'$.
Because the legal transition set of $N$ is a singleton at every nonhalting configuration, there is only one computation path of $N$ on any input $x \in \{0,1\}^*$. That path is step-by-step identical to the computation path of $M$ on $x$.
[/guided]
[/step]
[step:Verify that the nondeterministic machine decides the same language in polynomial time]
Fix an input string $x \in \{0,1\}^*$. Since the computation path of $N$ on $x$ is identical to the computation path of $M$ on $x$, the machine $N$ halts on $x$ after exactly the same number of steps as $M$ does. Hence $N$ halts on $x$ in at most $p(|x|)$ steps.
Moreover, $N$ accepts $x$ if and only if the identical computation of $M$ accepts $x$. By the choice of $M$, this holds if and only if $x \in L$. Therefore $N$ is a nondeterministic polynomial-time decider for $L$.
[/step]
[step:Conclude the class inclusion]
Since the arbitrary language $L \in \operatorname{P}$ has been shown to belong to $\operatorname{NP}$, every language in $\operatorname{P}$ belongs to $\operatorname{NP}$. Therefore
\begin{align*}
\operatorname{P} \subseteq \operatorname{NP}.
\end{align*}
[/step]