(***************************************************************************)
(* 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 basic_geometric_facts.
Proof with Geometry.
intros.
assert (D <> Y).
unfold not;intro;subst D...
unfold not;intro.
assert (C ** Y / D ** Y = S C A B / S D A B)...
assert (S C A B = S D A B).
unfold parallel in H6.
unfold S4 in H6.
assert (S C A B = - S A C B)...
rewrite H8.
RewriteVar (S A C B) H6.
ring_simplify.
Geometry.
rewrite H8 in H7.
assert (C ** Y = D ** Y).
RewriteVar (C ** Y) H7.
field...
Geometry.
assert (C = D).
assert (C ** D + D ** Y = C ** Y)...
rewrite <- H10 in H9.
assert (C ** D = 0)...
RewriteVar (C ** D) H9...
Geometry.
Qed.
Hint Resolve col_par_1 col_par_2 col_par_3 col_par_4 : Geom.
Proof with Geometry.
intros.
cut (Col C D B).
Geometry.
assert (parallel C D A B).
Geometry.
eapply par_col_col_1;eauto...
Qed.
Proof with Geometry.
intros.
cases_col D A B.
unfold parallel, S4 in |- *.
cut (Y = D).
intro.
assert (S A B D = S D A B)...
rewrite H6.
rewrite H4.
unfold not in |- *.
intro.
NormalizeRing H7.
clear H H0.
rewrite H5 in H3.
clear H5.
clear H6.
assert (Col A B D)...
assert (Col A B C)...
assert (Col A D C); eauto with Geom.
assert (Col A B Y)...
assert (Col A B D)...
assert (Col A Y D); eauto with Geom.
assert (A <> Y); eauto with Geom.
cases_equality Y D.
auto.
assert (Col Y D A)...
assert (Col Y D C)...
assert (Col Y A C); eauto with Geom.
intuition.
eapply common_point_not_par_aux; apply H || auto.
Qed.
Definition parallelogram (A B C D : Point) : Prop :=
parallel A B C D /\ parallel B C A D /\ ~ Col A B C.
Proof with Geometry.
intros.
unfold parallelogram in H.
DecompAndAll.
unfold parallel,S4 in *.
assert (S A B D = S A B C).
RewriteVar (S A B D) H2...
replace (-(1) * S A C B) with (- S A C B) by ring...
assert (S B C D = S B C A).
RewriteVar (S B C D) H4...
replace (-(1) * S B A C) with (- S B A C) by ring...
assert (S C B D = - S B C A).
rewrite <- H3...
assert (~ Col C B D).
unfold not in |- *; intro.
rewrite H7 in H6...
assert (A ** O / C ** O = S A B D / S C B D).
apply co_side...
unfold not in |- *; intro.
subst O...
rewrite H in H8...
rewrite H6 in H8...
assert (S A B C = S B C A)...
rewrite H9 in H8...
assert (C ** O = - O ** C)...
rewrite H10 in H8...
RewriteVar (A ** O) H8...
field...
rewrite <- H10.
assert (O <> C).
unfold not; intro;subst O...
Geometry.
Qed.
Proof with Geometry.
unfold parallelogram,parallel, S4 in |- *.
intros.
DecompAndAll.
assert (S A C D = S A C B + S A B D + S B C D)...
RewriteVar (S A C B) H0.
RewriteVar (S B C D) H2.
NormalizeRing H.
rewrite H.
replace (S B A C) with (- S A B C)...
ring_simplify (S A B C + - - S A B C)...
Qed.
Hint Resolve para_not_col_1: Geom.
Hint Resolve para_not_col_2: Geom.
Hint Resolve para_not_col_3: Geom.
Hint Resolve para_1: Geom.
Hint Resolve para_2: Geom.
Hint Resolve para_3: Geom.
Hint Resolve para_4: Geom.
Hint Resolve not_para_eq_1 not_para_eq_2 not_para_eq_3
not_para_eq_4 not_para_eq_5 not_para_eq_6 : Geom.

Theorem para_not_eq_1 : forall A B C D,
parallelogram A B C D -> A<>B.