Your teacher’s formula is correct except when $n=1$, which it says is prime (see the final section); for consistency with their terminology I shall use “prime” in this answer to mean “non-composite”. Your problem seems to be that you do not realise that $n$ is a “free variable” in formula (0), which we ought to call $P(n)$ to emphasise that it says something about $n$, some natural whose primality interests us.
A free variable (in a given formula) is one that is not a “bound variable”, where a bound variable is one introduced by a quantifier, in the way that $p$ and $q$ are. A free variable refers to something outside the formula, while a bound variable does not refer to anything outside the formula: replacing $q$ by $r$ would not affect the meaning of $P(n)$.
Where you write “Not for all natural $q$ and $p$ true, that, if $q*p$ gives us some $n$, then either $q$ or $p$ equals $1$.” it would be more accurate to say “…if $qp$ gives us the particular $n$ we are interested in, …”. That is to say, in your example we are only interested in the case $P(15)$, i.e. your (0) with $n$ replaced by $15$; as you correctly observed, $P(15)$ is false, so $15$ is not prime. If you try it out, you should find that $P(5)$ is true.
Your “gives us some $n$” makes me feel that you may be thinking of (0) as:
$$
(\forall q \in \mathbb N)(\forall p \in \mathbb N)(\exists n \in \mathbb N)[(n=pq) \Rightarrow (p=1 \lor q=1)]
$$
i.e. “every product of naturals is $1$ or prime” (or even “given two naturals, one is $1$”!), which is of course false. If you rearrange it as
$$
(\exists n \in \mathbb N)(\forall q \in \mathbb N)(\forall p \in \mathbb N)[(n=pq) \Rightarrow (p=1 \lor q=1)]
$$
it says “some natural is $1$ or prime”, which is trivially true. Both these formulæ have $n$ as a bound variable, i.e. they are not statements about a particular $n$ but about $\mathbb N$ as a whole.
In step (9) you write (with “complex” replaced by “composite”):
• For some $n$ its $q$ and $p$ are not equal one, then we know that $n$ consist of two numbers, then it is composite.
• For another $n$ either $q$ or $p$ can be $1$, then we don't know if n is prime or composite, cause another number ($q$ or $p$) can be either composite or prime.
The first part is more or less right, though “its $p$ and $q$” is a bit odd, as $p$ and $q$ are not determined by $n$, but are just some naturals that may need to be checked to see if $n$ is prime.
The second part is wrong: you are right that the case when either $p$ or $q$ is $1$ does not (on its own) settle the primality of $n$, but if all such $p$ and $q$ satisfy $ (n=pq) \Rightarrow (p=1 \lor q=1) $ that makes $P(n)$ true – that is what the universal quantifiers in $P(n)$ mean!
The case $n=1$
As pointed out the answer in the answer by Dan Brumleve, your teacher’s expression breaks down when $n=1$, though this seems to have nothing to do with your problems in understanding it.
Their expression $P(1)$ says
$$
(\forall q \in \mathbb N)(\forall p \in \mathbb N)[(1=pq) \Rightarrow (p=1 \lor q=1)]
$$
which is true: when the product of two naturals is $1$, then one of them is $1$ – indeed both are! But the conventional definition of a prime is that it should not be a “unit”, i.e. should not have a multiplicative inverse in $\mathbb N$. We can fix this by defining “$n$ is prime” as $n\neq 1 \land P(n)$. This is useful, as the primes are then the smallest set of naturals that generate $\mathbb N$ by multiplication. For $\mathbb Z$ there is no unique set of generators, but the sets are unique up to multiplying each element by one of the units $\{1,-1\}$.
Equally, their expression for “$1$ is not prime” becomes
$$
(\exists q \in \mathbb N)(\exists p \in \mathbb N)(p > 1 \land q > 1 \land 1=pq)
$$
which is false, again meaning that $1$ is prime.
You aren't considering the quantifiers' scope, partly due to your insertion of commas after every quantifier, which is obscuring not just your analysis but also your intended meaning.
Some authors insert a comma/colon/period after a quantifier to delimit that its scope extends as far right as possible; others use commas/colons/periods, like in $(\exists x,P(x)),$ with no particular meaning; others import from natural language commas as punctuation and the colons as abbreviation of ‘such that’; these usages conflict with one another; How to grammatically formalise mathematical statements?
Reading your question, I had to frequently pause to guess whether you mean something like $$∀x \;(Px\implies Q)$$ or something like $$(∀x \:Px)\implies Q;$$ they aren't equivalent formulae!
-
$$\forall x \in S, \exists y \in S, P(x) \implies P(y)$$
$$\forall x {\in} S \;\exists y {\in} S\; (P(x) \implies P(y)).$$
Since the goal when taking contrapositive is for the old and new sentences to be logically equivalent, and the
conditional here conveniently contains no quantifiers, the
contrapositive is simply $$\forall x {\in} S \;\exists y {\in} S\;
(¬P(y) \implies ¬P(z)).$$
contrapositive:
$$\exists y \in S, \forall y \in S, \neg P(y) \implies \neg P(x)$$
-
If every car has wheels, then there is a car with at least one wheel.
$$\forall c, \exists d, c \implies d$$
$$(∀x{∈}C\:Wx)⟹∃y{∈}C\:Wy.$$ Here, each side of the
conditional has a quantifier, so they need to be negated, and the contrapositive is
$$(∀y{∈}C\:¬Wy)⟹∃x{∈}C\:¬Wx.$$ If no car has a wheel, then some car
has no wheel.
contrapositive:
If there is a car which does not have at least one wheel, then not every car has wheels.
$$\exists c, \forall d, \neg d \implies \neg c$$
-
If $a$ is a real number, such that $a < b$ for every positive real number $b$, then $a = 0$.
$$\exists a \in \mathbb{R}, \forall b \in \mathbb{R}^+, a < b \implies a = 0.$$
$$\forall a{\in}\mathbb R\;\Big((\forall b{\in}\mathbb
R^+\;a<b)\implies a=0\Big).\tag1$$ Here, there's only one quantifier to
negate, and the contrapositive is $$\forall a{\in}\mathbb
R\;\Big(a\ne0\implies \exists b{\in}\mathbb R^+\;a\ge b \Big).\tag2$$
contrapositive:
$$\exists a \in \mathbb{R}, \forall b \in \mathbb{R}^+, a \neq 0 \implies a \ge b,$$ $$\forall a \in \mathbb{R}, \exists b \in
\mathbb{R}^+, a \neq 0 \implies a \ge b.$$
Note that $(1)$ and $(2)$ are, respectively, logically equivalent to: $$\forall a{\in}\mathbb R\;\exists b{\in}\mathbb
R^+\;\Big(a<b\implies a=0\Big);\tag1$$$$\forall a{\in}\mathbb
R\;\exists b{\in}\mathbb R^+\;\Big(a\ne0\implies a\ge b \Big).\tag2$$ So, had we initially pulled out those quantifiers, the contrapositive work itself would, like in case #1 above, have required no quantifier negation.
Best Answer
In natural language the negation "The inequality $x^2−4x+3<0$ has a real solution" expresses existence of a number $x$ such that $x^2-4x+3 < 0$. Translated into symbols, this gives $(\exists x \in \mathbb{R})\ x^2-4x+3 < 0$.
Taking the negation,
$$\begin{align}&\neg (\exists x \in \mathbb{R})\ x^2-4x+3 <0\\ \iff & (\forall x \in \mathbb{R}) \neg(x^2-4x+3<0)\\ \iff & (\forall x \in \mathbb{R})\ x^2 -4x+3 \geq 0 \end{align}$$ The last statement, translated into language, says that $x^2-4x+3\geq 0$ for all real numbers $x$. This exactly expresses the negation of the original statement, because whenever we don't have a real solution to $x^2-4x+3<0$, then we know that for every real $x$, $x^2-4x+3 \geq 0$, and vice versa.