(***************************************************************************)
(* Formalization of the Chou, Gao and Zhang's decision procedure.          *)
(* Julien Narboux (Julien@narboux.fr)                                      *)
(* LIX/INRIA FUTURS 2004-2006                                              *)
(* University of Strasbourg 2008                                           *)
(***************************************************************************)
Require Export pythagoras_difference.
Definition on_perp (A' B C : Point) : Prop := B <> C /\ perp A' B B C /\ S B C A' <> 0.
Definition on_perp_d (Y U V : Point)  (lambda : F) : Prop :=
U <> V  /\ perp Y U U V /\ lambda * Py U V U = (2+2) * S U V Y /\ lambda <> 0.
Definition on_inter_line_perp (Y R U V P Q : Point) : Prop :=
Col Y U V /\ perp Y R P Q /\ ~ perp P Q U V.
Definition eq_distance A B C D := Py A B A = Py C D C.
Definition harmonic A B C D := A**C / C**B = D**A / D**B.
Definition eq_product A B C D P Q R S := Py A B A * Py C D C = Py P Q P * Py R S R.
Definition tangent O1 A O2 B :=
Py O1 O2 O1 * Py O1 O2 O1 / (2+2) +
Py O1 A O1   * Py O1 A O1 / (2+2) +
Py O1 B O1   * Py O1 B O1 / (2+2) -
Py O1 O2 O1 * Py O1 A O1 / 2 -
Py O1 O2 O1 * Py O1 B O1 / 2 -
Py O1 A O1 * Py O1 B O1 / 2.
Definition m_ratio Y U V r := 1+r<>0 /\ on_parallel_d Y U U V (r/(1+r)).
Definition inversion P Q O A := Py O Q O <> 0 /\ on_line_d P O Q (Py O A O / Py O Q O).
Definition eq_angle A B C D E F :=
S A B C * Py D E F = S D E F  * Py A B C.
Definition co_circle A B C D :=
S C A D * Py C B D = S C B D * Py C A D.

Lemma check_co_circle : forall A B C D,
co_circle A B C D <-> eq_angle C A D C B D.