FSucc

# Library FSucc

`Require Export List.
Require Export Fnorm.
Section suc.
Variable b : Fbound.
Variable radix : Z.
Variable precision : nat.
Coercion Local FtoRradix := FtoR radix.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let radixMoreThanZERO := Zlt_1_O _ (Zlt_le_weak _ _ radixMoreThanOne).
Hint Resolve radixMoreThanZERO: zarith.
Hypothesis precisionNotZero : precision <> 0.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Definition FSucc (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 (Zsucc (Fnum x)) (Fexp x)
| false => Float (- pPred (vNum b)) (Zpred (Fexp x))
end
| false => Float (Zsucc (Fnum x)) (Fexp x)
end
end.
Theorem FSuccSimpl1 :
forall x : float,
Fnum x = pPred (vNum b) ->
FSucc x = Float (nNormMin radix precision) (Zsucc (Fexp x)).
Theorem FSuccSimpl2 :
forall x : float,
Fnum x = (- nNormMin radix precision)%Z ->
Fexp x <> (- dExp b)%Z ->
FSucc x = Float (- pPred (vNum b)) (Zpred (Fexp x)).
Theorem FSuccSimpl3 :
FSucc (Float (- nNormMin radix precision) (- dExp b)) =
Float (Zsucc (- nNormMin radix precision)) (- dExp b).
Theorem FSuccSimpl4 :
forall x : float,
Fnum x <> pPred (vNum b) ->
Fnum x <> (- nNormMin radix precision)%Z ->
FSucc x = Float (Zsucc (Fnum x)) (Fexp x).
Theorem FSuccDiff1 :
forall x : float,
Fnum x <> (- nNormMin radix precision)%Z ->
Fminus radix (FSucc x) x = Float 1%nat (Fexp x) :>R.
Theorem FSuccDiff2 :
forall x : float,
Fnum x = (- nNormMin radix precision)%Z ->
Fexp x = (- dExp b)%Z -> Fminus radix (FSucc x) x = Float 1%nat (Fexp x) :>R.
Theorem FSuccDiff3 :
forall x : float,
Fnum x = (- nNormMin radix precision)%Z ->
Fexp x <> (- dExp b)%Z ->
Fminus radix (FSucc x) x = Float 1%nat (Zpred (Fexp x)) :>R.
Theorem ZltNormMinVnum : (nNormMin radix precision < Zpos (vNum b))%Z.
Hint Resolve ZltNormMinVnum: float.
Theorem FSuccNormPos :
forall a : float,
(0 <= a)%R -> Fnormal radix b a -> Fnormal radix b (FSucc a).
Theorem FSuccSubnormNotNearNormMin :
forall a : float,
Fsubnormal radix b a ->
Fnum a <> Zpred (nNormMin radix precision) -> Fsubnormal radix b (FSucc a).
Theorem FSuccSubnormNearNormMin :
forall a : float,
Fsubnormal radix b a ->
Fnum a = Zpred (nNormMin radix precision) -> Fnormal radix b (FSucc a).
Theorem FBoundedSuc : forall f : float, Fbounded b f -> Fbounded b (FSucc f).
Theorem FSuccSubnormal :
forall a : float, Fsubnormal radix b a -> Fcanonic radix b (FSucc a).
Theorem FSuccPosNotMax :
forall a : float,
(0 <= a)%R -> Fcanonic radix b a -> Fcanonic radix b (FSucc a).
Theorem FSuccNormNegNotNormMin :
forall a : float,
(a <= 0)%R ->
Fnormal radix b a ->
a <> Float (- nNormMin radix precision) (- dExp b) ->
Fnormal radix b (FSucc a).
Theorem FSuccNormNegNormMin :
Fsubnormal radix b (FSucc (Float (- nNormMin radix precision) (- dExp b))).
Theorem FSuccNegCanonic :
forall a : float,
(a <= 0)%R -> Fcanonic radix b a -> Fcanonic radix b (FSucc a).
Theorem FSuccCanonic :
forall a : float, Fcanonic radix b a -> Fcanonic radix b (FSucc a).
Theorem FSuccLt : forall a : float, (a < FSucc a)%R.
Theorem FSuccPropPos :
forall x y : float,
(0 <= x)%R ->
Fcanonic radix b x -> Fcanonic radix b y -> (x < y)%R -> (FSucc x <= y)%R.
Theorem R0RltRleSucc : forall x : float, (x < 0)%R -> (FSucc x <= 0)%R.
Theorem FSuccPropNeg :
forall x y : float,
(x < 0)%R ->
Fcanonic radix b x -> Fcanonic radix b y -> (x < y)%R -> (FSucc x <= y)%R.
Theorem FSuccProp :
forall x y : float,
Fcanonic radix b x -> Fcanonic radix b y -> (x < y)%R -> (FSucc x <= y)%R.
Theorem FSuccZleEq :
forall p q : float,
(p <= q)%R -> (q < FSucc p)%R -> (Fexp p <= Fexp q)%Z -> p = q :>R.
Definition FNSucc x := FSucc (Fnormalize radix b precision x).
Theorem FNSuccCanonic :
forall a : float, Fbounded b a -> Fcanonic radix b (FNSucc a).
Theorem FNSuccLt : forall a : float, (a < FNSucc a)%R.
Theorem FNSuccProp :
forall x y : float,
Fbounded b x -> Fbounded b y -> (x < y)%R -> (FNSucc x <= y)%R.
Theorem FNSuccEq :
forall p q : float,
Fbounded b p -> Fbounded b q -> p = q :>R -> FNSucc p = FNSucc q.
End suc.
Hint Resolve FSuccNormPos FBoundedSuc FSuccSubnormal FSuccNegCanonic
FSuccCanonic FSuccLt FSuccPropPos R0RltRleSucc FSuccPropNeg FSuccProp
FNSuccCanonic FNSuccLt: float.
Section suc1.
Variable b : Fbound.
Variable radix : Z.
Variable precision : nat.
Coercion Local FtoRradix := FtoR radix.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Hypothesis precisionNotZero : 1 < precision.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Theorem nNormMimLtvNum : (nNormMin radix precision < pPred (vNum b))%Z.
Theorem FSucFSucMid :
forall p : float,
Fnum (FSucc b radix precision p) <> nNormMin radix precision ->
Fnum (FSucc b radix precision p) <> (- nNormMin radix precision)%Z ->
Fminus radix (FSucc b radix precision (FSucc b radix precision p))
(FSucc b radix precision p) = Fminus radix (FSucc b radix precision p) p
:>R.
Theorem FNSuccFNSuccMid :
forall p : float,
Fbounded b p ->
Fnum (FNSucc b radix precision p) <> nNormMin radix precision ->
Fnum (FNSucc b radix precision p) <> (- nNormMin radix precision)%Z ->
Fminus radix (FNSucc b radix precision (FNSucc b radix precision p))
(FNSucc b radix precision p) = Fminus radix (FNSucc b radix precision p) p
:>R.
End suc1.
Hint Resolve nNormMimLtvNum: float.
`