FPred

# Library FPred

`Require Export FSucc.
Section pred.
Variable b : Fbound.
Variable radix : Z.
Variable precision : nat.
Coercion Local FtoRradix := FtoR radix.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Hypothesis precisionNotZero : precision <> 0.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Definition FPred (x : float) :=
match Z_eq_bool (Fnum x) (- pPred (vNum b)) with
| true => Float (- nNormMin radix precision) (Zsucc (Fexp x))
| false =>
match Z_eq_bool (Fnum x) (nNormMin radix precision) with
| true =>
match Z_eq_bool (Fexp x) (- dExp b) with
| true => Float (Zpred (Fnum x)) (Fexp x)
| false => Float (pPred (vNum b)) (Zpred (Fexp x))
end
| false => Float (Zpred (Fnum x)) (Fexp x)
end
end.
Theorem FPredSimpl1 :
forall x : float,
Fnum x = (- pPred (vNum b))%Z ->
FPred x = Float (- nNormMin radix precision) (Zsucc (Fexp x)).
Theorem FPredSimpl2 :
forall x : float,
Fnum x = nNormMin radix precision ->
Fexp x <> (- dExp b)%Z -> FPred x = Float (pPred (vNum b)) (Zpred (Fexp x)).
Theorem FPredSimpl3 :
FPred (Float (nNormMin radix precision) (- dExp b)) =
Float (Zpred (nNormMin radix precision)) (- dExp b).
Theorem FPredSimpl4 :
forall x : float,
Fnum x <> (- pPred (vNum b))%Z ->
Fnum x <> nNormMin radix precision ->
FPred x = Float (Zpred (Fnum x)) (Fexp x).
Theorem FPredFopFSucc :
forall x : float, FPred x = Fopp (FSucc b radix precision (Fopp x)).
Theorem FPredDiff1 :
forall x : float,
Fnum x <> nNormMin radix precision ->
Fminus radix x (FPred x) = Float 1%nat (Fexp x) :>R.
Theorem FPredDiff2 :
forall x : float,
Fnum x = nNormMin radix precision ->
Fexp x = (- dExp b)%Z -> Fminus radix x (FPred x) = Float 1%nat (Fexp x) :>R.
Theorem FPredDiff3 :
forall x : float,
Fnum x = nNormMin radix precision ->
Fexp x <> (- dExp b)%Z ->
Fminus radix x (FPred x) = Float 1%nat (Zpred (Fexp x)) :>R.
Theorem FBoundedPred : forall f : float, Fbounded b f -> Fbounded b (FPred f).
Theorem FPredCanonic :
forall a : float, Fcanonic radix b a -> Fcanonic radix b (FPred a).
Theorem FPredLt : forall a : float, (FPred a < a)%R.
Theorem R0RltRlePred : forall x : float, (0 < x)%R -> (0 <= FPred x)%R.
Theorem FPredProp :
forall x y : float,
Fcanonic radix b x -> Fcanonic radix b y -> (x < y)%R -> (x <= FPred y)%R.
Theorem FPredZleEq :
forall p q : float,
(FPred p < q)%R -> (q <= p)%R -> (Fexp p <= Fexp q)%Z -> p = q :>R.
Definition FNPred (x : float) := FPred (Fnormalize radix b precision x).
Theorem FNPredFopFNSucc :
forall x : float, FNPred x = Fopp (FNSucc b radix precision (Fopp x)).
Theorem FNPredCanonic :
forall a : float, Fbounded b a -> Fcanonic radix b (FNPred a).
Theorem FNPredLt : forall a : float, (FNPred a < a)%R.
Theorem FNPredProp :
forall x y : float,
Fbounded b x -> Fbounded b y -> (x < y)%R -> (x <= FNPred y)%R.
Theorem FPredSuc :
forall x : float,
Fcanonic radix b x -> FPred (FSucc b radix precision x) = x.
Theorem FSucPred :
forall x : float,
Fcanonic radix b x -> FSucc b radix precision (FPred x) = x.
Theorem FNPredSuc :
forall x : float,
Fbounded b x -> FNPred (FNSucc b radix precision x) = x :>R.
Theorem FNPredSucEq :
forall x : float,
Fcanonic radix b x -> FNPred (FNSucc b radix precision x) = x.
Theorem FNSucPred :
forall x : float,
Fbounded b x -> FNSucc b radix precision (FNPred x) = x :>R.
Theorem FNSucPredEq :
forall x : float,
Fcanonic radix b x -> FNSucc b radix precision (FNPred x) = x.
End pred.
Hint Resolve FBoundedPred FPredCanonic FPredLt R0RltRleSucc FPredProp
FNPredCanonic FNPredLt FNPredProp: float.
`