(***************************************************************************)
(* 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_lemmas.
Require Export my_field_tac.
(***********************************************)
(* Unification tactic for signed areas         *)
(***********************************************)
(* Simplification is necessary for termination *)
(***********************************************)
Ltac uniformize_signed_areas_goal :=
repeat
match goal with
|  |- context [(- - ?X1)] =>
replace (- - X1) with X1 by apply simplring1
|  |- context [(S ?X1 ?X1 ?X2)] =>
replace (S X1 X1 X2) with 0 by apply trivial_col1
|  |- context [(S ?X2 ?X1 ?X1)] =>
replace (S X2 X1 X1) with 0 by apply trivial_col2
|  |- context [(S ?X1 ?X2 ?X1)] =>
replace (S X1 X2 X1) with 0 by apply trivial_col3
|  |- context [(S ?X1 ?X2 ?X3)] =>
( let Truc := fresh in
match goal with
|  |- context [(S ?X4 ?X5 ?X6)] =>
(assert (Truc : S X4 X5 X6 = - S X1 X2 X3);
[ apply S_3 || apply S_2 || apply S_4
| rewrite Truc; clear Truc ]) ||
(assert (Truc : S X4 X5 X6 = S X1 X2 X3);
[ apply S_0 || apply S_1 | rewrite Truc; clear Truc ])
end)
end.
Ltac generalize_all_areas :=
repeat match goal with
H: context [(S ?X1 ?X2 ?X3)] |- _=> revert H
end.
Ltac uniformize_signed_areas :=
generalize_all_areas;uniformize_signed_areas_goal;intros.

(* Specifications: *)
Lemma S4Simpl_1 : forall A B C : Point, S4 A B B C = S A B C.
intros.