(* step 6 *)

(* The set of Pythagorean triples *)
Definition pytha_set (a b c : Z) :=
  exists p : Z, exists q : Z, exists m : Z,
    (a = m * (q * q - p * p) /\ b = 2 * m * (p * q) \/
     a = 2 * m * (p * q) /\ b = m * (q * q - p * p)) /\
    c = m * (p * p + q * q) /\ m >= 0 /\ (cond_pq p q).

Lemma relp_frac : forall a b c d : Z, (b <> 0) -> (d <> 0) -> (frac a b) = (frac c d) -> (rel_prime c d) -> exists m : Z, m <> 0 /\ b = m * d.