(* Pythagorean.v *)
(***********************)
(* Pythagorean triples *)
(***********************)
Require Export Tactics.
(* A non nul predicate *)
Definition nnl_triple (a b c : Z) := ~(a = 0) /\ ~(b = 0) /\ ~(c = 0).
(* A positive predicate *)
Definition pos_triple (a b c : Z) := (a >= 0) /\ (b >= 0) /\ (c >= 0).
(* A Pythagorean predicate *)
Definition is_pytha (a b c : Z) := (pos_triple a b c) /\ a * a + b * b = c * c.
(* Unit circle and D_r *)
Definition in_ucirc (x y : R) := (x * x + y * y = 1)%R.
Definition D_r (r x y : R) := (y = r * (x + 1))%R.
(******************************)
(* Set of Pythagorean triples *)
(******************************)
(* step1 *)
(* step 2 *)
(* Intersection between the unit circle and D_r *)
Definition interCDr (r x y : R) := (in_ucirc x y) /\ (D_r r x y).
(* Points of the intersection *)
Definition p1 := (-1,0)%R.
Definition p2 (r : R) :=
let den := (1 + r * r)%R in
((1 - r * r) / den, 2 * r / den)%R.
(* Equality over points *)
Definition eqp (p1 p2 : R * R) := (fst p1) = (fst p2) /\ (snd p1)= (snd p2).

(* Total order over points (using R) *)
Lemma ordp : forall p1 p2 : R * R, (eqp p1 p2) \/ ~(eqp p1 p2).