Section Fbounded_Def.
Variable radix : Z.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let radixMoreThanZERO := Zlt_1_O _ (Zlt_le_weak _ _ radixMoreThanOne).
Hint Resolve radixMoreThanZERO: zarith.
Let FtoRradix := FtoR radix.
Local Coercion FtoRradix : float >-> R.
Coercion Z_of_N: N >-> Z.
Record Fbound : Set := Bound {vNum : positive; dExp : N}.
Definition Fbounded (b : Fbound) (d : float) :=
(Z.abs (Fnum d) < Zpos (vNum b))%Z /\ (- dExp b <= Fexp d)%Z.
intros b p H; case H; intros H1 H2; case H1; auto.
Qed.
intros b p H; case H; auto.
Qed.
Hint Resolve FboundedNum FboundedExp: float.
intros b p; case (Z_le_gt_dec (Zpos (vNum b)) (Z.abs (Fnum p)));
intros H'.
right; red in |- *; intros H'3; Contradict H'; auto with float zarith.
case (Z_le_gt_dec (- dExp b) (Fexp p)); intros H'1.
left; repeat split; auto with zarith.
right; red in |- *; intros H'3; Contradict H'1; auto with float zarith.
Qed.
intros b; unfold FtoRradix, FtoR in |- *; simpl in |- *; auto with real.
Qed.
intros b; repeat (split; simpl in |- *).
replace 0%Z with (- 0%nat)%Z; [ idtac | simpl in |- *; auto ].
apply Zeq_le; auto with arith.
Qed.
Hint Unfold Fbounded.
intros b p H'; (repeat split; simpl in |- *; auto with float zarith).
Qed.
intros b p n H'; repeat split; simpl in |- *; auto with float.
apply Z.le_trans with (Fexp p); auto with float.
pattern (Fexp p) at 1 in |- *;
(replace (Fexp p) with (Fexp p + 0%nat)%Z; [ idtac | simpl in |- *; ring ]).
apply Zplus_le_compat_l.
apply inj_le; auto with arith.
Qed.
intros b p n; unfold FtoRradix, FtoR in |- *; simpl in |- *.
rewrite powerRZ_add; auto with real zarith.
ring.
Qed.
intros b x H'; repeat split; simpl in |- *; auto with float zarith.
replace (Z.abs (- Fnum x)) with (Z.abs (Fnum x)); auto with float.
case (Fnum x); simpl in |- *; auto.
Qed.
intros b x H'; rewrite <- (Fopp_Fopp x).
apply oppBounded; auto.
Qed.
intros b z p H'; elim H'; intros r E; elim E; intros H'0 H'1; elim H'1;
intros H'2 H'3; clear H'1 E H'.
exists (Fopp r); split; auto.
rewrite <- (Ropp_involutive p).
rewrite <- H'0; auto.
unfold FtoRradix in |- *; apply Fopp_correct; auto.
split.
apply oppBounded; auto.
simpl in |- *; auto.
Qed.
intros b f H'; repeat split; simpl in |- *; auto with float.
replace (Z.abs (Z.abs (Fnum f))) with (Z.abs (Fnum f)); auto with float.
case (Fnum f); auto.
Qed.
intros b p q H' H'0 H'1 H'2.
cut (0 <= Fnum p)%Z;
[ intros Z1
| apply (LeR0Fnum radix); auto with real arith; fold FtoRradix in |- *;
rewrite H'0; auto ].
cut (0 <= Fnum q)%Z;
[ intros Z2 | apply (LeR0Fnum radix); auto with real arith ].
split.
apply Z.le_lt_trans with (Z.abs (Fnum p)); [ idtac | auto with float ].
repeat rewrite Z.abs_eq; auto.
apply Z.le_trans with (Fnum (Fshift radix (Z.abs_nat (Fexp q - Fexp p)) q));
auto.
unfold Fshift in |- *; simpl in |- *; auto.
pattern (Fnum q) at 1 in |- *; replace (Fnum q) with (Fnum q * 1)%Z;
auto with zarith.
apply (Rle_Fexp_eq_Zle radix); auto with real zarith.
rewrite FshiftCorrect; auto with real zarith.
unfold Fshift in |- *; simpl in |- *; rewrite inj_abs; try ring.
apply Zle_Zminus_ZERO; apply le_IZR; auto with real arith.
apply Z.le_trans with (Fexp p).
case H'; auto.
apply le_IZR; auto with real arith.
Qed.

Theorem FboundedEqExp :
forall (b : Fbound) (p q : float),
Fbounded b p -> p = q :>R -> (Fexp p <= Fexp q)%R -> Fbounded b q.