intros x p H H'.
apply Rle_trans with (/ 2%nat * Fulp b radix precision p)%R.
replace (Rabs (x - FtoRradix p)) with
(/ 2%nat * (2%nat * Rabs (x - FtoRradix p)))%R.
apply Rmult_le_compat_l; auto with real.
apply ClosestUlp; auto.
rewrite <- Rmult_assoc; rewrite Rinv_l; simpl in |- *; auto with real.
apply
Rle_trans with (/ 2%nat * (Rabs p * (radix * / Zpos (vNum b))))%R;
[ apply Rmult_le_compat_l | right; ring; ring ].
apply Rlt_le; apply Rinv_0_lt_compat; auto with real arith.
unfold Fulp in |- *.
replace (Fexp (Fnormalize radix b precision p)) with
(Fexp (Fnormalize radix b precision p) + precision + - precision)%Z;
[ idtac | ring ].
rewrite powerRZ_add; auto with real zarith.
apply Rle_trans with (Rabs p * radix * powerRZ radix (- precision))%R;
[ apply Rmult_le_compat_r | right ]; auto with real zarith.
2: rewrite pGivesBound; simpl in |- *.
2: rewrite powerRZ_Zopp; auto with real zarith; rewrite Zpower_nat_Z_powerRZ;
auto with real zarith; ring.
replace (FtoRradix p) with (FtoRradix (Fnormalize radix b precision p));
[ idtac | apply (FnormalizeCorrect radix) ]; auto.
rewrite <- (Fabs_correct radix); unfold FtoR in |- *; simpl in |- *;
auto with arith.
rewrite powerRZ_add; auto with real zarith.
replace
(Zabs (Fnum (Fnormalize radix b precision p)) *
powerRZ radix (Fexp (Fnormalize radix b precision p)) * radix)%R with
(powerRZ radix (Fexp (Fnormalize radix b precision p)) *
(Zabs (Fnum (Fnormalize radix b precision p)) * radix))%R;
[ idtac | ring ].
apply Rmult_le_compat_l; auto with arith real.
rewrite <- Zpower_nat_Z_powerRZ; auto with real zarith.
rewrite <- Rmult_IZR; apply Rle_IZR.
rewrite <- pGivesBound; pattern radix at 2 in |- *;
rewrite <- (Zabs_eq radix); auto with zarith.
rewrite <- Zabs_Zmult.
rewrite Zmult_comm; elim H'; auto.
Qed.

(* Specifications: *)
Theorem ClosestErrorBound2 :
forall (x : R) (p : float),
Closest b radix x p ->
(Rabs (x - p) <=
Rmax (Rabs p * (/ 2%nat * (radix * / Zpos (vNum b))))
(/ 2%nat * powerRZ radix (- dExp b)))%R.