Ltac split_hyp_not_eq_zero  :=
repeat
match goal with
|  H: (Fmult _ _) <> F0 |- _ =>
case (multnonzero  _ _ H); clear H; intros
| H: (Fdiv ?X ?Y) <> F0 |- _ =>
let T:=fresh in
assert (T:= (divnonzero X Y H));clear H
end.
Goal forall x y : F,
x*y<>0 -> x/y <> 0 -> True.
intros.
split_hyp_not_eq_zero.
auto.
Qed.
Ltac removes_inv_opp :=
repeat rewrite remove_opp in *;
repeat rewrite remove_inv in *.
Ltac rewrite_for_same_denom :=
match goal with
| H:_ |- context[?X*0] => rewrite simp_1 in *
| H:_ |- context[0*?X] => rewrite simp_2 in *
| H:_ |- context[1*?X] => rewrite simp_3 in *
| H:_ |- context[?X*1] => rewrite simp_4 in *
| H:_ |- context[0+?X] => rewrite simp_5 in *
| H:_ |- context[?X+0] => rewrite simp_6 in *
| H:_ |- context[?X-0] => rewrite simp_7 in *
| H1:?B<>0, H2: ?C/?D<>0, H3:?D<>0 |- context[?A/?B / ?C/?D ] =>
rewrite (same_denom_div_1 A B C D H1 H2 H3) in *;
let T:=fresh in assert (T:=(invariant_div_1 B C D H1 H2 H3))
| H1:?B<>0, H2:?C<>0 |- context[(?A/?B) / ?C ] =>
rewrite (same_denom_div_2 A B C H1 H2) in *;
let T:=fresh in assert (T:=(nonzeromult B C H1 H2))
| H1: ?C/?D<>0, H2: ?D<>0 |- context[?A / (?C/?D) ] =>
rewrite (same_denom_div_3 A C D H1 H2) in *;
let T:=fresh in assert (T:=(invariant_div_3 C D H1 H2))
| H1:?B<>0, H2: ?D<>0 |- context[?A/?B + ?C/?D ] =>
rewrite (same_denom_add_1 A B C D H1 H2) in *;
let T:=fresh in assert (T:=(nonzeromult B D H1 H2))
| H1:?B<>0 |- context[?A/?B + ?C ] =>
rewrite (same_denom_add_2 A B C H1) in *
| H2: ?D<>0 |- context[?A + ?C/?D ] =>
rewrite (same_denom_add_3 A C D H2) in *
| H1:?B<>0, H2: ?D<>0 |- context[?A/?B - ?C/?D ] =>
rewrite (same_denom_min_1 A B C D H1 H2) in *;
let T:=fresh in assert (T:=(nonzeromult B D H1 H2))
| H1:?B<>0 |- context[?A/?B - ?C ] =>
rewrite (same_denom_min_2 A B C H1) in *
| H2: ?D<>0 |- context[?A - ?C/?D ] =>
rewrite (same_denom_min_3 A C D H2) in *
| H1:?B<>0, H2: ?D<>0 |- context[(?A/?B) * (?C/?D) ] =>
rewrite (same_denom_mul_1 A B C D H1 H2) in *;
let T:=fresh in assert (T:=(nonzeromult B D H1 H2))
| H1:?B<>0 |- context[(?A/?B) * ?C ] =>
rewrite (same_denom_mul_2 A B C H1) in *
| H2: ?D<>0 |- context[?A * (?C/?D) ] =>
rewrite (same_denom_mul_3 A C D H2) in *
end.
Goal forall a b c d,
b<>0 -> d<>0 -> (a/b) + (c/d) <> 0 ->
(a/b) + (c/d) = (a * d + c * b) / (b * d) .
Goal forall a b c d,
d<>0 -> (a/b) + (c/d) <> 0 ->
a + (c/d) = (a * d + c) / d.
Ltac same_denom :=
let H:=fresh in assert (H:=chara_not_2);
removes_inv_opp;try assumption_or_ax;
repeat rewrite_for_same_denom.
Ltac same_denom_prepare_for_ring:=  repeat (
(** First we try the case 0 *)
apply same_denom_conclude_4 ||
apply same_denom_conclude_5 ||
(** Then the other cases *)
apply same_denom_conclude_1 ||
apply same_denom_conclude_2 ||
apply same_denom_conclude_3);
try assumption;same_denom.
Ltac Ffield_before_ring :=
let H:=fresh in assert (H:=chara_not_2);
same_denom;
same_denom_prepare_for_ring.
Ltac Ffield := Ffield_before_ring;Fring.
Goal  forall f f0,
f0 <> 0 ->
f * f0 - (- f0 + f * f0) * (f * f0) * / f0 <> 0 ->
/ (f * f0 - (- f0 + f * f0) * (f * f0) * / f0) *
(f * f0 * ((1 - f) * f0) * / f0 * f0) <> 0 ->
/ (f * f0 - (- f0 + f * f0) * (f * f0) * / f0) *
(f * f0 * ((- f0 + f * f0) * f0 * / f0)) *
/
(/ (f * f0 - (- f0 + f * f0) * (f * f0) * / f0) *
(f * f0 * ((1 - f) * f0) * / f0 * f0)) = - (1).
Goal forall x y z t,  x<>0 -> -x <> 0 -> False ->
- (y * / x) - z * / - x + t * / x = 1.
Goal forall f,  / 2 * f + / 2 * (/ 2 * f) <> 0 ->
- (/ 2 * (/ (/ 2 * f + / 2 * (/ 2 * f)) * (/ 2 * (/ 2 * f) * f))) +
/ 2 * (/ (/ 2 * f + / 2 * (/ 2 * f)) * (/ 2 * f * (/ 2 * f))) = 0.
Goal forall x,  / 2 * x + / 2 * (/ 2 * x) <> 0 -> / 2 * x + / 2 * (/ 2 * x) <> 0 ->
-
(/ 2 *
(/ (/ 2 * x + / 2 * (/ 2 * x)) *
(/ 2 * (/ 2 * x) * x))) +
/ 2 *
(/ (/ 2 * x + / 2 * (/ 2 * x)) *
(/ 2 * x * (/ 2 * x))) = 0.
(* field; trivial works... *)
Goal forall f f1 f0,
- (f * f1 + (1 - f) * (f0 * f1)) <> 0 ->
-
((f * f1 + (1 - f) * (f0 * f1) - f * f1) * f1 *
/ - (f * f1 + (1 - f) * (f0 * f1))) +
(f * f1 * ((1 - f) * (f0 * f1)) -
- ((f * f1 + (1 - f) * (f0 * f1) - f * f1) * ((1 - f) * f1))) *
/ - (f * f1 + (1 - f) * (f0 * f1)) = 0.
(*...*)
Goal forall x,  / 2 * (/ 2 * x) <> 0 ->
/ 2 * x * / (/ 2 * (/ 2 * x)) = 2.
Goal forall x y z, z<>0 -> x * (y/z) = (x*y)/z.
intros.
Ffield.
Qed.
Goal forall a b c d : F,
b <> 0 ->
d <> 0 ->
a/b+c/d+a/b = a/b+c/d+a/b.
Goal forall x, -x<>0 -> -x + x = 0.
Goal forall x,  x - x = 0.
Goal forall x, x*x <> 0 -> 1<>0 ->  1/(x*x)<> 0 -> 1 / (1 / (x * x)) = x * x.
Goal forall x, 1/x<>0 -> x <> 0 -> 1 <> 0 ->  1 / (1 / x) = x.
Goal forall x, x <> 0 -> x <> 0 -> x <> 0 ->  1 / x  + 1 /x  = 2/x.
Goal forall x, 2*x <> 0 -> 2*x <> 0 -> x<>0 ->  1 / (2*x)  + 1 /(2*x)  = 1/x.
Goal forall x, 1*x <> 0 -> 1*x <> 0 -> 1/2*x<>0 -> 1 / (1*x)  + 1 /(1*x)  = 1/(1/2*x).
intros.
Ffield.
Qed.
Goal forall x,  x - (1 - - (1)) * (/ 2 * x) = 0.
intros.
Ffield.
Qed.
(** This example needs an efficient ring tactic *)
Goal forall x, x <> 0 ->
2*2*2*2*2*2*2*2*x<>0 ->
2*2*2*2*2*2*2*2*x<>0 ->
2*2*2*2*2*2*2*x<>0 ->
1 / (2*2*2*2*2*2*2*2*x)  + 1 /(2*2*2*2*2*2*2*2*x)  = 1/(2*2*2*2*2*2*2*x).

Lemma eq_simpl: forall a b : F,
a-b = 0 -> a =b .