We fix a positive real number x. The backward direction holds trivially, so we only need to prove the forwards direction.
To that end, we assume that x is rational, i.e. that there are some integers a_0,b_0 such that x=a_0/b_0; because x is positive, we may assume without generality that a_0,b_0 are both positive.
We wish to prove
\exists m,n:\mathbb {Z}^+\mathpunct {.}
x=m/n \land
\lnot \exists p:\mathbb {Z}\mathpunct {.}
\mathsf {isPrime}(p)\land p \mid m \land p \mid n\text {,}
and by double negation elimination it suffices to prove
\lnot \lnot \exists m,n:\mathbb {Z}^+\mathpunct {.}
x=m/n \land
\lnot \exists p:\mathbb {Z}\mathpunct {.}
\mathsf {isPrime}(p)\land p \mid m \land p \mid n\text {,}
which we may calculate using the classical negation identities in the following way:
\begin {aligned}
&
\lnot \lnot \exists m,n:\mathbb {Z}^+\mathpunct {.}
x=m/n \land
\lnot \exists p:\mathbb {Z}\mathpunct {.}
\mathsf {isPrime}(p)\land p \mid m \land p \mid n
\\
&\Longleftrightarrow
\lnot \forall m,n:\mathbb {Z}^+\mathpunct {.}
x\not = m/n \lor \exists p:\mathbb {Z}\mathpunct {.} \mathsf {isPrime}(p)\land p \mid m \land p \mid n
\\
&\Longleftrightarrow
\lnot \forall m,n:\mathbb {Z}^+\mathpunct {.}
x= m/n \implies \exists p:\mathbb {Z}\mathpunct {.} \mathsf {isPrime}(p)\land p \mid m \land p \mid n
\end {aligned}
To prove this negation, we therefore assume that for any representation of x by a positive fraction m/n there exists a prime dividing both m and n, and we must now prove \bot .
We consider in particular the fractional representation x=a_0/b_0 that we started with; from this we may assume some prime p_0 such that both p_0\mid a_0 and p_0\mid b_0. Hence we may assume integers a_1, b_1 such that a_0 = p_0 a_1 and b_0 = p_0 b_1.
x = \frac {a_0}{b_0} = \frac {p_0a_1}{p_0b_1} = \frac {a_1}{b_1}
Iterating this process any number of times, say l, we have a = p_0 \ldots p_l a_{l+1} and b = p_0\cdots p_lb_{l+1}. If we choose l \coloneqq \lfloor \log _2 a_0\rfloor we would have
a_0 = p_0\cdots p_1 a_{l+1} \geq 2^{l+1} > a_0
because all the primes p_i are at least 2 by definition. Of course, a_0>a_0 is contradictory so we are done.