(* step 4 *)
(* Positivity predicate over points *)
Definition is_posp (c : R * R) := (fst c >= 0)%R /\ (snd c >= 0)%R.
(* Predicate for the positive rational coordinates of the unit circle *)
Definition is_ucp (c : R * R) :=
(in_ucirc (fst c) (snd c)) /\ (is_ratp c) /\ (is_posp c).
(* Positive rational coordinates of the unit circle *)
Definition ucp (p q : Z) :=
let pr := (IZR p) in
let qr := (IZR q) in
let den := (pr * pr + qr * qr)%R in
((qr * qr - pr * pr) / den, (2 * pr * qr) / den)%R.
(* A basic condition over p and q *)
Definition cond_pqb (p q : Z) := p >= 0 /\ q > 0 /\ p <= q /\ (rel_prime p q).
(* Set of positive rational coordinates of the unit circle *)
Definition in_ucp_setb (x y : R) :=
exists p : Z, exists q : Z,
x = (fst (ucp p q)) /\ y = (snd (ucp p q)) /\ (cond_pqb p q).

(* Specifications: *)
Lemma rat_pos_coo1 : forall x y : R, (is_ucp (x,y)) ->
exists r : R, (is_rat r) /\ (r >= 0)%R /\ (r <= 1)%R /\ x = (fst (p2 r)) /\
y = (snd (p2 r)).
Lemma rat_pos_coo2 : forall x y : R, (is_ucp (x,y)) -> (in_ucp_setb x y).
Definition cond_pq (p q : Z) := cond_pqb p q /\ (distinct_parity p q).