(***************************************************************************)
(* 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 parallel_lemmas.
(*********************************************************************)
(*  Construction statements                                                         *)
(*********************************************************************)
Definition on_line (A B C : Point) : Prop := Col A B C /\ B <> C.
Definition on_line_d (A B C : Point) (lambda : F) : Prop :=
Col A B C /\ B <> C /\ B ** A = lambda * B ** C.
Definition inter_ll (I A B C D : Point) : Prop :=
Col I A B /\ Col I C D /\ ~ parallel A B C D.
Definition on_parallel (A' A B C : Point) : Prop := B <> C  /\ parallel A A' B C.
Definition on_parallel_d (Y R P Q : Point) (lambda : F) : Prop :=
P <> Q  /\ parallel Y R P Q /\ R ** Y = lambda * P ** Q.
Definition on_inter_line_parallel (Y R U V P Q : Point) : Prop :=
~Col R P Q /\ Col Y U V /\ parallel Y R P Q /\ ~ parallel P Q U V.
Definition on_inter_parallel_parallel (Y R U V W P Q : Point) : Prop :=
~Col R P Q /\ parallel Y R U V /\ parallel Y W P Q /\ ~ parallel P Q U V.
Definition is_midpoint (I A B : Point) := on_line_d I A B (1 / 2).
Definition mratio (Y U V : Point) (r : F) :=
on_parallel_d Y U U V (r / (1 + r)) /\ 1 + r  <> 0.
(** Lemma to go from point at some distance to point on a line *)

Theorem on_lineex : forall P Q : Point, P <> Q -> {Y : Point | Col Y P Q}.
Proof with Geometry.