intros.
apply nonzerodiv;Geometry.
Qed.
Ltac case_not_equal X5 X6 X7 Y Heq :=
let T:= fresh in
assert (T:X7**Y/X5**X6 <> 0);[apply (invariant_inverse_ratio X5 X6 X7 Y );try assumption|idtac];
(replace (X5**X6 / X7**Y) with (1/(X7**Y / X5 ** X6));[changeparhyp X5 X6 X7 Y par_2|symmetry;apply inverse_ratio;Geometry]).
(** This tactic assumes that Y is on the right *)
Ltac put_on_the_upper_right_ratios Y :=
repeat match goal with
|_:_ |- context [(?X5 ** Y / ?X6 ** Y)] => fail 1
|_:_ |- context [(?X5 ** ?X6 / ?X7**Y)] =>
test_equality X5 X6 ltac:(case_equal X5 X6 X7 Y) ltac:(case_not_equal X5 X6 X7 Y)
end.
Ltac unify_signed_areas_point P :=
repeat
match goal with
|  |- context [(S ?X1 ?X1 ?X2)] =>
replace (S X1 X1 X2) with 0; [ idtac | apply trivial_col1 ]
|  |- context [(S ?X2 ?X1 ?X1)] =>
replace (S X2 X1 X1) with 0; [ idtac | apply trivial_col2 ]
|  |- context [(S ?X1 ?X2 ?X1)] =>
replace (S X1 X2 X1) with 0; [ idtac | apply trivial_col3 ]
|  |- context [(S ?X1 ?X2 P)] =>
( let Truc := fresh in
match goal with
|  |- context [(S ?X4 ?X5 P)] =>
(assert (Truc : S X4 X5 P = - S X1 X2 P);
[ apply S_3 || apply S_2 || apply S_4
| rewrite Truc in *; clear Truc ]) ||
(assert (Truc : S X4 X5 P = S X1 X2 P);
[ apply S_0 || apply S_1 | rewrite Truc in *; clear Truc ])
end)
end.
(** This tactic prepares the elimination process by putting the point on the right and unifying the geometric quantities concerning the point *)
Ltac unify_signed_areas_and_put_on_the_right P :=
put_on_the_right_areas P;
put_on_the_right_pys P;
put_on_the_right_ratios P;
put_on_the_upper_right_ratios P;
unify_signed_areas_point P.

(* Specifications: *)
Lemma test_1 : forall A B C, S A B C + S B A C = 0.
Lemma test_2 : forall Y A C D, parallel Y A C D -> C<>D ->
Y**A / C**D = (A**Y / D**C).
Lemma test_3 :forall Y A C D, parallel C D A Y -> A<>Y ->
C<>D -> C**D / A**Y = 1/(A**Y / C**D).
Lemma test_4: forall A B Y, Py Y A B = Py B A Y.
Lemma test_5: forall A Y, Py Y A Y = Py Y A Y.
Lemma test_6: forall C B A E, Py B E B + Py E A C = Py E B E + Py C A E.