FexpDiv

# Library FexpDiv

`Require Export AllFloat.
Section Div.
Variables wi wi1 qi D N qi1 wi2 ai bi eps1 eps2 eps3 ep : R.
Hypothesis Hw : wi = (wi1 - qi * D)%R :>R.
Hypothesis Ha : (Rabs (/ wi1 * (ai - wi1)) <= eps1)%R.
Hypothesis Hb : (Rabs (/ D * (bi - D)) <= eps2)%R.
Hypothesis Hq : (Rabs (/ (/ bi * ai) * (qi - / bi * ai)) <= eps3)%R.
Hypothesis NZwi : wi1 <> 0%R.
Hypothesis NZD : D <> 0%R.
Hypothesis NZbi : bi <> 0%R.
Hypothesis NZai : ai <> 0%R.
Hypothesis PosEps1 : (0 <= eps1)%R.
Hypothesis PosEps2 : (0 <= eps2)%R.
Hypothesis PosEps3 : (0 <= eps3)%R.
Hypothesis LeEps1 : (eps1 < 1)%R.
Hypothesis LeEps2 : (eps2 < 1)%R.
Hypothesis LeEps3 : (eps3 < 1)%R.
Hypothesis Hep : ep = Rmax (Rmax eps1 eps2) eps3 :>R.
Theorem InegAbsInf :
forall x y eps : R,
x <> 0%R ->
(Rabs (/ x * (y - x)) <= eps)%R -> (Rabs y <= (1 + eps) * Rabs x)%R.
Theorem InegAbsSup :
forall x y eps : R,
x <> 0%R ->
(Rabs (/ x * (y - x)) <= eps)%R -> ((1 - eps) * Rabs x <= Rabs y)%R.
Theorem DivFirstCase :
((Rabs wi1 - Rabs (qi * D)) * / Rabs wi1 <=
1 - (1 - eps3) * (1 - eps1) * / (1 + eps2))%R.
Theorem DivSecondCase :
((Rabs (qi * D) - Rabs wi1) * / Rabs wi1 <=
(1 + eps3) * (1 + eps1) * / (1 - eps2) - 1)%R.
Definition dsd (x y : R) :=
(0 <= x)%R /\ (0 <= y)%R \/ (x <= 0)%R /\ (y <= 0)%R.
Theorem dsdAbs :
forall x y : R, dsd x y -> Rabs (x - y) = Rabs (Rabs x - Rabs y).
Theorem dsdsym : forall x y : R, dsd x y -> dsd y x.
Theorem Inegdsd :
forall x y eps : R,
x <> 0%R -> (eps < 1)%R -> (Rabs (/ x * (y - x)) <= eps)%R -> dsd x y.
Theorem dsdtrans :
forall x y z : R, dsd x y -> dsd y z -> y <> 0%R -> dsd x z.
Theorem dsdinv : forall x y : R, dsd x y -> y <> 0%R -> dsd x (/ y).
Theorem dsdmult : forall x y r : R, dsd x y -> dsd (r * x) (r * y).
Theorem dsdwi1qiD : dsd wi1 (qi * D).
Theorem Maxwiwi1 :
(Rabs wi * / Rabs wi1 <=
Rmax (1 - (1 - eps3) * (1 - eps1) * / (1 + eps2))
((1 + eps3) * (1 + eps1) * / (1 - eps2) - 1))%R.
Theorem Rmax_simpl1 : forall p q : R, (p <= q)%R -> Rmax p q = q.
Theorem RmaxProp :
forall (P : R -> Prop) (x y : R), P x -> P y -> P (Rmax x y).
Theorem FexpEpsilon_aux :
((0 <= ep)%R /\ (ep < 1)%R) /\
(eps1 <= ep)%R /\ (eps2 <= ep)%R /\ (eps3 <= ep)%R.
Theorem FexpDivConv :
(Rabs wi * / Rabs wi1 <= (ep + (ep + (ep + ep * ep))) * / (1 - ep))%R.
End Div.
Section Div2.
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.
Theorem FulpDiv :
forall x y p : float,
Fbounded b x ->
Fbounded b y ->
Fbounded b p ->
Closest b radix (x * / y) p ->
y <> 0%R :>R ->
Fnormal radix b (Fnormalize radix b precision x) ->
(Fulp b radix precision x * / Rabs y <= radix * Fulp b radix precision p)%R.
End Div2.
`