(***************************************************************************)
(* 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 geometry_tools.
Proof with try solve [ ring | congruence ].
intros.
assert (- -a=-0).
rewrite H...
assert (- -a=a)...
assert (-0=0)...
Qed.
Hint Resolve field_prop1 : Geom.
(** Some propositions about Col *)
Proof with uniformize_signed_areas;Geometry.
unfold Col in |- *.
intros...
Qed.
Proof with uniformize_signed_areas;Geometry.
unfold Col in |- *.
intros...
Qed.
Proof with uniformize_signed_areas;Geometry.
unfold Col in |- *.
intros...
Qed.
Proof with uniformize_signed_areas;Geometry.
unfold Col in |- *.
intros...
Qed.
Proof with uniformize_signed_areas;Geometry.
unfold Col in |- *.
intros...
Qed.
Hint Resolve col_1 col_2 col_3 col_4 col_5: Geom.
(** Proposition about equality and nullity of geometric quantities *)
intros.
assert (A ** B = 0 <-> A = B).
apply A1b.
intuition.
Qed.
Hint Resolve noteqnotzero: Geom.
Proof with try solve [ Geometry | congruence ].
intros.
unfold Col.
rewrite H...
Qed.
unfold Col in |- *.
intros.
intuition.
assert (T := egalcol A B C H0).
auto.
Qed.
intros.
assert (~ Col A B C -> ~ Col B C A).
intuition.
assert (~ Col B C A).
auto.
eapply notcolnotegal_1.
apply H1.
Qed.
intros.
assert (~ Col A B C -> ~ Col A C B).
intuition.
assert (~ Col A C B).
auto.
eapply notcolnotegal_1.
apply H1.
Qed.
Hint Resolve notcolnotegal_1 notcolnotegal_2 notcolnotegal_3: Geom.
Hint Resolve notparallelnotegal_1 notparallelnotegal_2 : Geom.
(** Some usefull lemmas about ratios of signed distances *)
Proof with Geometry.
intros.
uniformize_dir_seg.
field...
Qed.
Hint Resolve dirseg_1: Geom.
Proof with Geometry.
intros.
uniformize_dir_seg.
rewrite H.
auto.
Qed.
Hint Resolve dirseg_2: Geom.
(* Theorem dirseg_1 : (A,B,C,D:Point) C<>D -> -(A**B/C**D) = B**A /C**D. Proof with Geometry. Intros. Replace A**B with -B**A. Field. Symmetry. Qed.  Theorem dirseg_2 : (A,B,C,D:Point) C<>D -> -(A**B/C**D) = A**B /D**C. Proof with Geometry. Intros. Replace C**D with -D**C. Field. Symmetry. Qed.   Hints Resolve dirseg_1 dirseg_2 : Geom. *)
Proof with Geometry.
intros.
uniformize_dir_seg.
field...
Qed.
Proof with Geometry.
intros...
uniformize_dir_seg.
field...
Qed.
Hint Resolve dirseg_3 dirseg_4: Geom.
Proof with Geometry.
intros.
uniformize_signed_areas.
field...
Qed.
Hint Resolve dirsur_1: Geom.
Proof with Geometry.
intros.
assert (S A B C = S A B D + S A D C + S D B C)...
rewrite H0 in H2.
rewrite H1 in H2.
cases_col A D C...
cases_equality C A...
apply egalcol...
NormalizeRing H2...
assert (C ** B / C ** A = S D C B / S D C A)...
assert (C ** A + A ** B = C ** B)...
rewrite <- H6 in H5...
assert ((C ** A + A ** B) / C ** A = 1 + A ** B / C ** A)...
field...
rewrite H7 in H5.
clear H7 H6.
assert (S D B C = - S D C B)...
rewrite H6 in H2...
assert (S A D C = S D C A)...
rewrite H7 in H2...
IsoleVarRing (S D C B) H2...
rewrite H2 in H5...
assert (S D C A / S D C A = 1)...
field...
rewrite H8 in H5.
clear H6 H7 H8.
IsoleVarRing (A ** B) H5...
assert (A = B)...
intuition...
Qed.
Hint Resolve col_trans_1 : Geom.

Lemma build_point_not_collinear_1 : forall A B, A<>B -> exists C, ~ Col A B C.