(***************************************************************************)
(* 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 advanced_parallel_lemmas.
Require Export geometry_tools.
(*********************************************************************)
(*  Elimination Theorems                                               *)
(*********************************************************************)
(* Area elimination *)
unfold on_line in |- *.
Proof with Geometry.
unfold on_inter_parallel_parallel in |- *.
unfold parallel in |- *.
intros.
assert (S4 G C H D = - S4 C G D H)...
rewrite H1 in H0.
intuition.
Qed.
Proof with Geometry.
intros.
unfold on_line_d in *.
DecompAndAll.
RewriteVar lambda H3...
clear H3.
assert (1 - P ** Y / P ** Q = Y ** Q / P ** Q)...
assert (Y ** P + P ** Q = Y ** Q)...
rewrite <- H1...
assert (P ** Y = - Y ** P)...
rewrite H3; field...
rewrite H1...
replace (S A B Y) with (S Y A B)...
replace (S A B Q) with (S Q A B)...
replace (S A B P) with (S P A B)...
apply l2_9...
Qed.
Proof with Geometry.
intros.
assert (on_line_d Y P Q (P ** Y / P ** Q)).
apply on_line_to_on_line_d...
apply elim_area_on_line_d...
Qed.
Proof with Geometry.
intros.
unfold inter_ll in *.
DecompAndAll.
assert (P <> Q);eauto with Geom.
assert (S Y A B = P ** Y / P ** Q * S Q A B + Y ** Q / P ** Q * S P A B)...
apply l2_9...
unfold parallel in H3.
assert (P ** Y / P ** Q = S P U V / S4 P U Q V)...
assert (Q ** Y / P ** Q = S Q U V / S4 P U Q V)...
replace (Q**Y) with (- Y**Q) in H5.
2:symmetry;Geometry.
uniformize_signed_areas.
IsoleVar (Y ** Q) H5...
rewrite H1.
rewrite H4.
rewrite H5.
field...
Qed.

Theorem elim_area_on_parallel_d :
forall (A B P Q R Y : Point) (lambda : F),
on_parallel_d Y R P Q lambda ->
S A B Y = S A B R + lambda * S4 A P B Q.