Assume I already have defined prime(n) which tells whether n is a prime and cons_prime(n,m) which tells whether m,n are coprimes.
I need to define a formula for P(n,k) which is true if and only if n is the kth prime .
I've been thinking something like :
$$P(k,n) = (n=2 \wedge k = 1) \lor \exists m(P(k-1,m) \wedge \text{cons_prime}(m,n))$$