Proof with auto with typeclass_instances.
intros m e.
set (e' := canonic_exp beta fexp (F2R (Float beta m e))).
unfold round, scaled_mantissa. fold e'.
destruct (Zle_or_lt e' e) as [He|He].
exists m.
unfold F2R at 2. simpl.
rewrite Rmult_assoc, <- bpow_plus.
rewrite <- Z2R_Zpower. 2: omega.
rewrite <- Z2R_mult, Zrnd_Z2R...
unfold F2R. simpl.
rewrite Z2R_mult.
rewrite Rmult_assoc.
rewrite Z2R_Zpower. 2: omega.
rewrite <- bpow_plus.
apply (f_equal (fun v => Z2R m * bpow v)%R).
ring.
exists ((rnd (Z2R m * bpow (e - e'))) * Zpower beta (e' - e))%Z.
unfold F2R. simpl.
rewrite Z2R_mult.
rewrite Z2R_Zpower. 2: omega.
rewrite 2!Rmult_assoc.
rewrite <- 2!bpow_plus.
apply (f_equal (fun v => _ * bpow v)%R).
ring.
Qed.
End round_repr_same_exp.
Context { monotone_exp : Monotone_exp fexp }.
Notation format := (generic_format beta fexp).
Variable choice : Z -> bool.

(* Specifications: *)
Lemma plus_error_aux :
forall x y,
(canonic_exp beta fexp x <= canonic_exp beta fexp y)%Z ->
format x -> format y ->
format (round beta fexp (Znearest choice) (x + y) - (x + y))%R.
(** Error of the addition *)
Theorem plus_error :
forall x y,
format x -> format y ->
format (round beta fexp (Znearest choice) (x + y) - (x + y))%R.
Lemma plus_error_aux :
forall x y,
(canonic_exp beta fexp x <= canonic_exp beta fexp y)%Z ->
format x -> format y ->
format (round beta fexp (Znearest choice) (x + y) - (x + y))%R.
(** Error of the addition *)
Theorem plus_error :
forall x y,
format x -> format y ->
format (round beta fexp (Znearest choice) (x + y) - (x + y))%R.