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.

Lemma test_4: forall A B Y, Py Y A B = Py B A Y.