Fround

# Library Fround

`Require Export Fprop.
Require Export Fodd.
Section FRound.
Variable b : Fbound.
Variable radix : Z.
Variable precision : nat.
Coercion Local FtoRradix := FtoR radix.
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.
Theorem RoundedModeP_inv1 : forall P, RoundedModeP P -> TotalP P.
Theorem RoundedModeP_inv2 : forall P, RoundedModeP P -> CompatibleP P.
Theorem RoundedModeP_inv3 : forall P, RoundedModeP P -> MinOrMaxP P.
Theorem RoundedModeP_inv4 : forall P, RoundedModeP P -> MonotoneP radix P.
Hint Resolve RoundedModeP_inv1 RoundedModeP_inv2 RoundedModeP_inv3
RoundedModeP_inv4: inv.
Theorem RoundedProjector : forall P, RoundedModeP P -> ProjectorP b radix P.
Theorem MinCompatible : CompatibleP (isMin b radix).
Theorem MinRoundedModeP : RoundedModeP (isMin b radix).
Theorem MaxCompatible : CompatibleP (isMax b radix).
Theorem MaxRoundedModeP : RoundedModeP (isMax b radix).
Definition ToZeroP (r : R) (p : float) :=
(0 <= r)%R /\ isMin b radix r p \/ (r <= 0)%R /\ isMax b radix r p.
Theorem ToZeroTotal : TotalP ToZeroP.
Theorem ToZeroCompatible : CompatibleP ToZeroP.
Theorem ToZeroMinOrMax : MinOrMaxP ToZeroP.
Theorem ToZeroMonotone : MonotoneP radix ToZeroP.
Theorem ToZeroRoundedModeP : RoundedModeP ToZeroP.
Definition ToInfinityP (r : R) (p : float) :=
(r <= 0)%R /\ isMin b radix r p \/ (0 <= r)%R /\ isMax b radix r p.
Theorem ToInfinityTotal : TotalP ToInfinityP.
Theorem ToInfinityCompatible : CompatibleP ToInfinityP.
Theorem ToInfinityMinOrMax : MinOrMaxP ToInfinityP.
Theorem ToInfinityMonotone : MonotoneP radix ToInfinityP.
Theorem ToInfinityRoundedModeP : RoundedModeP ToInfinityP.
Theorem MinUniqueP : UniqueP (isMin b radix).
Theorem MaxUniqueP : UniqueP (isMax b radix).
Theorem ToZeroUniqueP : UniqueP ToZeroP.
Theorem ToInfinityUniqueP : UniqueP ToInfinityP.
Theorem MinOrMaxRep :
forall P,
MinOrMaxP P ->
forall p q : float, P p q -> exists m : Z, q = Float m (Fexp p) :>R.
Theorem RoundedModeRep :
forall P,
RoundedModeP P ->
forall p q : float, P p q -> exists m : Z, q = Float m (Fexp p) :>R.
Definition SymmetricP (P : R -> float -> Prop) :=
forall (r : R) (p : float), P r p -> P (- r)%R (Fopp p).
Theorem ToZeroSymmetric : SymmetricP ToZeroP.
Theorem ToInfinitySymmetric : SymmetricP ToInfinityP.
Theorem ScalableRoundedModeP :
forall P (f s t : float),
RoundedModeP P ->
Fbounded b f -> P (radix * f)%R s -> P (s / radix)%R t -> f = t :>R.
Theorem RoundLessThanIsMax :
forall P,
RoundedModeP P ->
forall (p m : float) (x : R), P x p -> isMax b radix x m -> (p <= m)%R.
End FRound.
Hint Resolve RoundedProjector MinCompatible MinRoundedModeP MaxCompatible
MaxRoundedModeP ToZeroTotal ToZeroCompatible ToZeroMinOrMax ToZeroMonotone
ToZeroRoundedModeP ToInfinityTotal ToInfinityCompatible ToInfinityMinOrMax
ToInfinityMonotone ToInfinityRoundedModeP MinUniqueP MaxUniqueP
ToZeroUniqueP ToInfinityUniqueP FnOddNEven ToZeroSymmetric
ToInfinitySymmetric: float.
Hint Resolve RoundedModeP_inv1 RoundedModeP_inv2 RoundedModeP_inv3
RoundedModeP_inv4: inv.
`