Section FRound.
Variable b : Fbound.
Variable radix : Z.
Variable precision : nat.
Let FtoRradix := FtoR radix.
Local Coercion FtoRradix : float >-> R.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Hypothesis precisionGreaterThanOne : 1 < precision.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Definition TotalP (P : R -> float -> Prop) :=
forall r : R, exists p : float, P r p.
Definition UniqueP (P : R -> float -> Prop) :=
forall (r : R) (p q : float), P r p -> P r q -> p = q :>R.
Definition CompatibleP (P : R -> float -> Prop) :=
forall (r1 r2 : R) (p q : float),
P r1 p -> r1 = r2 -> p = q :>R -> Fbounded b q -> P r2 q.
Definition MinOrMaxP (P : R -> float -> Prop) :=
forall (r : R) (p : float), P r p -> isMin b radix r p \/ isMax b radix r p.
Definition RoundedModeP (P : R -> float -> Prop) :=
TotalP P /\ CompatibleP P /\ MinOrMaxP P /\ MonotoneP radix P.
intros P H; case H; auto.
Qed.
intros P H; Casec H; intros H H1; Casec H1; auto.
Qed.
intros P H; Casec H; intros H H1; Casec H1; intros H1 H2; Casec H2; auto.
Qed.
intros P H; Casec H; intros H H1; Casec H1; intros H1 H2; Casec H2; auto.
Qed.
Hint Resolve RoundedModeP_inv1 RoundedModeP_inv2 RoundedModeP_inv3
RoundedModeP_inv4: inv.
intros P H'; red in |- *; simpl in |- *.
intros p q H'0 H'1.
red in H'.
elim H'; intros H'2 H'3; elim H'3; intros H'4 H'5; elim H'5; intros H'6 H'7;
case (H'6 p q); clear H'5 H'3 H'; auto.
intros H'; apply (ProjectMin b radix p); auto.
intros H'; apply (ProjectMax b radix p); auto.
Qed.
red in |- *.
intros r1 r2 p q H' H'0 H'1 H'2; split; auto.
rewrite <- H'0; unfold FtoRradix in H'1; rewrite <- H'1; case H'; auto.
Qed.
split; try red in |- *.
intros r; apply MinEx with (precision := precision); auto with arith.
split; try exact MinCompatible.
split; try apply MonotoneMin; red in |- *; auto.
Qed.
red in |- *.
intros r1 r2 p q H' H'0 H'1 H'2; split; auto.
rewrite <- H'0; unfold FtoRradix in H'1; rewrite <- H'1; case H'; auto.
Qed.

Theorem MaxRoundedModeP : RoundedModeP (isMax b radix).