# Show that P is a subset of NP

Okay, before I start with the question I would like to point out that I am aware that there are many proofs of this question online. However, I am interested in showing this with the definitions of my university script which are somewhat different from most of what I've seen online.

Show that $P \subseteq NP$.

Definition 1: A set of words $A$ is in $NP$ if and only if there is a polynomial $p$ and a set $B\in P$ such that

$$x\in A \iff \exists y(|y| \le p(|x|)\land x\#y \in B)$$

Definition 2: $$P = \bigcup_{polynomial \; p}TIME(p(n))$$

Definition 3: $$TIME(f(n)) = \{A\subseteq \Sigma^*:\text{there exists a multitape Turing machine M which computes} \;\chi_A \text{with}\;time_M(x)\le f(|x|) \}$$

Definition 4: $$time_M:\Sigma^* \to \Bbb N$$ is the function that gives the amount of "computing steps" for a word $x$.

Definition 5: $$\chi_A$$ is the indicator (also called characteristic) function of $A$.

My attempt:

The way I understand definition 1 $$P\subseteq NP :\iff$$ $$x\in P \iff (\exists polynomial \; p)(\exists B \in P)(\exists y \in \Sigma^*)(|y| \le p(|x|)\land x\#y \in B)$$

Proof:

(i) "$\Rightarrow$"

Let $x\in P$ and $|x|=n$ for an $n\in \Bbb N$

Define

$p(t):=n$ for all $t\in \Bbb N$

$y:=x$

$B:=\{x\#x\} = \{x\#y\}$

Then

$|y|\le p(|x|)$ since $|y|=|x|=n$ and $p(|x|)=p(n)=n$

and $\{x|\#y\}\in B$

(ii) "$\Leftarrow$"

Let $p$ be a polynomial, $B\in P$, $y\in \Sigma^*$ such that

$$|y| \le p(|x|)\land x\#y \in B \text{ for an x\in\Sigma^*}$$

Now I have to show that $x\in P$ but I do not know how.

Furthermore, I do not understand is that in (i) I could have let $x$ be an element of any set and this implication would still hold. For example $x\in S$ for a set $S:NP\subset S$ with the rest of the proof being identical. This would mean that every set is in NP which is not the case. My guess is that my understanding of definition 1 is wrong.

This raises my first question: How come is not every set is a subset of NP using the definitions from above?

My second question: How do I go about solving (ii)?

• We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. – Discrete lizard May 5 '18 at 10:28
• @Discretelizard Thanks for your feedback, I have edited the question to avoid yes/no answers – Travis May 5 '18 at 10:48