FroundProp

# Library FroundProp

`Require Export Fround.
Require Export MSB.
Section FRoundP.
Variable b : Fbound.
Variable radix : Z.
Variable precision : nat.
Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let radixMoreThanZERO := Zlt_1_O _ (Zlt_le_weak _ _ radixMoreThanOne).
Hint Resolve radixMoreThanZERO: zarith.
Hypothesis precisionGreaterThanOne : 1 < precision.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Definition Fulp (p : float) :=
powerRZ radix (Fexp (Fnormalize radix b precision p)).
Theorem FulpComp :
forall p q : float,
Fbounded b p -> Fbounded b q -> p = q :>R -> Fulp p = Fulp q.
Theorem FulpLe :
forall p : float, Fbounded b p -> (Fulp p <= Float 1 (Fexp p))%R.
Theorem Fulp_zero :
forall x : float, is_Fzero x -> Fulp x = powerRZ radix (- dExp b).
Theorem FulpLe2 :
forall p : float,
Fbounded b p ->
Fnormal radix b (Fnormalize radix b precision p) ->
(Fulp p <= Rabs p * powerRZ radix (Zsucc (- precision)))%R.
Theorem FulpGe :
forall p : float,
Fbounded b p -> (Rabs p <= (powerRZ radix precision - 1) * Fulp p)%R.
Theorem LeFulpPos :
forall x y : float,
Fbounded b x ->
Fbounded b y -> (0 <= x)%R -> (x <= y)%R -> (Fulp x <= Fulp y)%R.
Theorem FulpSucCan :
forall p : float,
Fcanonic radix b p -> (FSucc b radix precision p - p <= Fulp p)%R.
Theorem FulpSuc :
forall p : float,
Fbounded b p -> (FNSucc b radix precision p - p <= Fulp p)%R.
Theorem FulpPredCan :
forall p : float,
Fcanonic radix b p -> (p - FPred b radix precision p <= Fulp p)%R.
Theorem FulpPred :
forall p : float,
Fbounded b p -> (p - FNPred b radix precision p <= Fulp p)%R.
Theorem FSuccDiffPos :
forall x : float,
(0 <= x)%R ->
Fminus radix (FSucc b radix precision x) x = Float 1%nat (Fexp x) :>R.
Theorem FulpFPredGePos :
forall f : float,
Fbounded b f ->
Fcanonic radix b f ->
(0 < f)%R -> (Fulp (FPred b radix precision f) <= Fulp f)%R.
Theorem CanonicFulp :
forall p : float, Fcanonic radix b p -> Fulp p = Float 1%nat (Fexp p).
Theorem FSuccUlpPos :
forall x : float,
Fcanonic radix b x ->
(0 <= x)%R -> Fminus radix (FSucc b radix precision x) x = Fulp x :>R.
Theorem FNSuccUlpPos :
forall x : float,
Fcanonic radix b x ->
(0 <= x)%R -> Fminus radix (FNSucc b radix precision x) x = Fulp x :>R.
Theorem FulpFabs : forall f : float, Fulp f = Fulp (Fabs f) :>R.
Theorem RoundedModeUlp :
forall P,
RoundedModeP b radix P ->
forall (p : R) (q : float), P p q -> (Rabs (p - q) < Fulp q)%R.
Theorem RoundedModeErrorExpStrict :
forall P,
RoundedModeP b radix P ->
forall (p q : float) (x : R),
Fbounded b p ->
Fbounded b q ->
P x p -> q = (x - p)%R :>R -> q <> 0%R :>R -> (Fexp q < Fexp p)%Z.
Theorem RoundedModeProjectorIdem :
forall P (p : float), RoundedModeP b radix P -> Fbounded b p -> P p p.
Theorem RoundedModeBounded :
forall P (r : R) (q : float),
RoundedModeP b radix P -> P r q -> Fbounded b q.
Theorem RoundedModeProjectorIdemEq :
forall (P : R -> float -> Prop) (p q : float),
RoundedModeP b radix P -> Fbounded b p -> P (FtoR radix p) q -> p = q :>R.
Theorem RoundedModeMult :
forall P,
RoundedModeP b radix P ->
forall (r : R) (q q' : float),
P r q -> Fbounded b q' -> (r <= radix * q')%R -> (q <= radix * q')%R.
Theorem RoundedModeMultLess :
forall P,
RoundedModeP b radix P ->
forall (r : R) (q q' : float),
P r q -> Fbounded b q' -> (radix * q' <= r)%R -> (radix * q' <= q)%R.
Theorem RleMinR0 :
forall (r : R) (min : float),
(0 <= r)%R -> isMin b radix r min -> (0 <= min)%R.
Theorem RleRoundedR0 :
forall (P : R -> float -> Prop) (p : float) (r : R),
RoundedModeP b radix P -> P r p -> (0 <= r)%R -> (0 <= p)%R.
Theorem RleMaxR0 :
forall (r : R) (max : float),
(r <= 0)%R -> isMax b radix r max -> (max <= 0)%R.
Theorem RleRoundedLessR0 :
forall (P : R -> float -> Prop) (p : float) (r : R),
RoundedModeP b radix P -> P r p -> (r <= 0)%R -> (p <= 0)%R.
Theorem PminPos :
forall p min : float,
(0 <= p)%R ->
Fbounded b p ->
isMin b radix (/ 2%nat * p) min ->
exists c : float, Fbounded b c /\ c = (p - min)%R :>R.
Theorem div2IsBetweenPos :
forall p min max : float,
(0 <= p)%R ->
Fbounded b p ->
isMin b radix (/ 2%nat * p) min ->
isMax b radix (/ 2%nat * p) max -> p = (min + max)%R :>R.
Theorem div2IsBetween :
forall p min max : float,
Fbounded b p ->
isMin b radix (/ 2%nat * p) min ->
isMax b radix (/ 2%nat * p) max -> p = (min + max)%R :>R.
Theorem RoundedModeMultAbs :
forall P,
RoundedModeP b radix P ->
forall (r : R) (q q' : float),
P r q ->
Fbounded b q' -> (Rabs r <= radix * q')%R -> (Rabs q <= radix * q')%R.
Theorem isMinComp :
forall (r1 r2 : R) (min max : float),
isMin b radix r1 min ->
isMax b radix r1 max -> (min < r2)%R -> (r2 < max)%R -> isMin b radix r2 min.
Theorem isMaxComp :
forall (r1 r2 : R) (min max : float),
isMin b radix r1 min ->
isMax b radix r1 max -> (min < r2)%R -> (r2 < max)%R -> isMax b radix r2 max.
Theorem roundedModeLessMult :
forall (P : R -> float -> Prop) (p : float) (r : R),
RoundedModeP b radix P ->
P r p -> (Float 1%nat (- dExp b) <= r)%R -> (p <= radix * r)%R.
Theorem roundedModeMoreMult :
forall (P : R -> float -> Prop) (p : float) (r : R),
RoundedModeP b radix P ->
P r p -> (r <= Float (- 1%nat) (- dExp b))%R -> (radix * r <= p)%R.
Theorem roundedModeAbsMult :
forall (P : R -> float -> Prop) (p : float) (r : R),
RoundedModeP b radix P ->
P r p ->
(Float 1%nat (- dExp b) <= Rabs r)%R -> (Rabs p <= radix * Rabs r)%R.
Theorem RleBoundRoundl :
forall P,
RoundedModeP b radix P ->
forall (p q : float) (r : R),
Fbounded b p -> (p <= r)%R -> P r q -> (p <= q)%R.
Theorem RleBoundRoundr :
forall P,
RoundedModeP b radix P ->
forall (p q : float) (r : R),
Fbounded b p -> (r <= p)%R -> P r q -> (q <= p)%R.
Theorem RoundAbsMonotoner :
forall (P : R -> float -> Prop) (p : R) (q r : float),
RoundedModeP b radix P ->
Fbounded b r -> P p q -> (Rabs p <= r)%R -> (Rabs q <= r)%R.
Theorem RoundAbsMonotonel :
forall (P : R -> float -> Prop) (p : R) (q r : float),
RoundedModeP b radix P ->
Fbounded b r -> P p q -> (r <= Rabs p)%R -> (r <= Rabs q)%R.
Theorem ZroundZ :
forall (P : R -> float -> Prop) (z : Z) (p : float),
RoundedModeP b radix P -> P z p -> exists z' : Z, p = z' :>R.
Theorem NroundN :
forall (P : R -> float -> Prop) (n : nat) (p : float),
RoundedModeP b radix P -> P n p -> exists n' : nat, p = n' :>R.
Theorem FUlp_Le_LSigB :
forall x : float, Fbounded b x -> (Fulp x <= Float 1%nat (LSB radix x))%R.
Theorem MSBisMin :
forall f1 f2 : float,
(0 <= f1)%R ->
isMin b radix f1 f2 ->
~ is_Fzero f1 -> ~ is_Fzero f2 -> MSB radix f1 = MSB radix f2.
Theorem MSBtoZero :
forall f1 f2 : float,
ToZeroP b radix f1 f2 ->
~ is_Fzero f1 -> ~ is_Fzero f2 -> MSB radix f1 = MSB radix f2.
Theorem MSBBoundNotZero :
forall P : R -> float -> Prop,
RoundedModeP b radix P ->
forall f1 f2 : float,
P f1 f2 -> f1 <> 0%R :>R -> (- dExp b <= MSB radix f1)%Z -> f2 <> 0%R :>R.
Theorem RoundMSBmax :
forall (P : R -> float -> Prop) (p q : float),
RoundedModeP b radix P ->
P p q ->
p <> 0%R :>R ->
(- dExp b <= MSB radix p)%Z -> (MSB radix q <= Zsucc (MSB radix p))%Z.
Theorem RoundMSBmin :
forall (P : R -> float -> Prop) (p q : float),
RoundedModeP b radix P ->
P p q ->
p <> 0%R :>R ->
(- dExp b <= MSB radix p)%Z -> (MSB radix p <= MSB radix q)%Z.
Theorem RoundLSBMax :
forall (P : R -> float -> Prop) (p q : float),
RoundedModeP b radix P ->
P p q -> ~ is_Fzero q -> (LSB radix p <= LSB radix q)%Z.
Theorem InBinade :
forall (P : R -> float -> Prop) (p q r : float) (e : Z),
RoundedModeP b radix P ->
Fbounded b p ->
Fbounded b q ->
P (p + q)%R r ->
(- dExp b <= e)%Z ->
(Float (Zpower_nat radix (pred precision)) e <= p)%R ->
(p <= Float (pPred (vNum b)) e)%R ->
(0%nat < q)%R ->
(q < powerRZ radix e)%R -> r = p :>R \/ r = (p + powerRZ radix e)%R :>R.
End FRoundP.
Hint Resolve FulpSucCan FulpSuc FulpPredCan FulpPred: float.
`