Fast2Sum

# Library Fast2Sum

`Require Export AllFloat.
Section Fast.
Variable b : Fbound.
Variable precision : nat.
Let radix := 2%Z.
Coercion Local FtoRradix := FtoR radix.
Hypothesis precisionGreaterThanOne : 1 < precision.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Variable Iplus : float -> float -> float.
Hypothesis
IplusCorrect :
forall p q : float,
Fbounded b p -> Fbounded b q -> Closest b radix (p + q) (Iplus p q).
Hypothesis IplusSym : forall p q : float, Iplus p q = Iplus q p.
Hypothesis
IplusOp : forall p q : float, Fopp (Iplus p q) = Iplus (Fopp p) (Fopp q).
Variable Iminus : float -> float -> float.
Hypothesis IminusPlus : forall p q : float, Iminus p q = Iplus p (Fopp q).
Let radixMoreThanOne : (1 < radix)%Z.
Let radixMoreThanZERO := Zlt_1_O _ (Zlt_le_weak _ _ radixMoreThanOne).
Hint Resolve radixMoreThanZERO radixMoreThanOne: zarith.
Theorem IminusCorrect :
forall p q : float,
Fbounded b p -> Fbounded b q -> Closest b radix (p - q) (Iminus p q).
Hint Resolve IminusCorrect.
Theorem ErrorBoundedIplus :
forall p q : float,
Fbounded b p ->
Fbounded b q ->
exists error : float, error = (p + q - Iplus p q)%R :>R /\ Fbounded b error.
Theorem IplusOr :
forall p q : float,
Fbounded b p -> Fbounded b q -> q = 0%R :>R -> Iplus p q = p :>R.
Theorem IminusId :
forall p q : float,
Fbounded b p -> Fbounded b q -> p = q :>R -> Iminus p q = 0%R :>R.
Theorem IminusOl :
forall p q : float,
Fbounded b p -> Fbounded b q -> p = 0%R :>R -> Iminus p q = (- q)%R :>R.
Theorem IplusBounded :
forall p q : float, Fbounded b p -> Fbounded b q -> Fbounded b (Iplus p q).
Theorem IminusBounded :
forall p q : float, Fbounded b p -> Fbounded b q -> Fbounded b (Iminus p q).
Theorem IminusInv :
forall p q r s : float,
Fbounded b p ->
Fbounded b q ->
Fbounded b r ->
Fbounded b s -> p = s :>R -> r = (s - q)%R :>R -> Iminus p q = r :>R.
Theorem IminusFminus :
forall p q : float,
Fbounded b p ->
Fbounded b q ->
Fbounded b (Fminus radix p q) -> Iminus p q = Fminus radix p q :>R.
Theorem MDekkerAux1 :
forall p q : float,
Iminus (Iplus p q) p = (Iplus p q - p)%R :>R ->
Fbounded b p ->
Fbounded b q -> Iminus q (Iminus (Iplus p q) p) = (p + q - Iplus p q)%R :>R.
Theorem MDekkerAux2 :
forall p q : float,
Iplus p q = (p + q)%R :>R ->
Fbounded b p -> Fbounded b q -> Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem MDekkerAux3 :
forall p q : float,
Fbounded b (Fplus radix p q) ->
Fbounded b p -> Fbounded b q -> Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem MDekkerAux4 :
forall p q : float,
Fbounded b (Fminus radix (Iplus p q) p) ->
Fbounded b p -> Fbounded b q -> Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem Dekker1 :
forall p q : float,
(0 <= q)%R ->
(q <= p)%R ->
Fbounded b p -> Fbounded b q -> Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem Dekker2 :
forall p q : float,
(0 <= p)%R ->
(- q <= p)%R ->
(p <= radix * - q)%R ->
Fbounded b p -> Fbounded b q -> Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem Dekker3 :
forall p q : float,
(q <= 0)%R ->
(radix * - q < p)%R ->
Fbounded b p -> Fbounded b q -> Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem MDekkerAux5 :
forall p q : float,
Fbounded b p ->
Fbounded b q ->
Iminus (Iplus (Fopp p) (Fopp q)) (Fopp p) =
(Iplus (Fopp p) (Fopp q) - Fopp p)%R :>R ->
Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem MDekker :
forall p q : float,
Fbounded b p ->
Fbounded b q ->
(Rabs q <= Rabs p)%R -> Iminus (Iplus p q) p = (Iplus p q - p)%R :>R.
Theorem Dekker :
forall p q : float,
Fbounded b p ->
Fbounded b q ->
(Rabs q <= Rabs p)%R ->
Iminus q (Iminus (Iplus p q) p) = (p + q - Iplus p q)%R :>R.
End Fast.
`