FnormI

# Library FnormI

`Require Export FboundI.
Section FboundedI_Def.
Variable radix : Z.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.
Theorem LexicoPosCanI :
forall (b : FboundI) (x y : float),
FcanonicI radix b x ->
FboundedI b y -> (0 <= x)%R -> (x <= y)%R -> (Fexp x <= Fexp y)%Z.
Theorem LexicoNegCanI :
forall (b : FboundI) (x y : float),
FcanonicI radix b x ->
FboundedI b y -> (x <= 0)%R -> (y <= x)%R -> (Fexp x <= Fexp y)%Z.
Theorem LexicoCanI :
forall (b : FboundI) (x y : float),
Zabs_nat (vNumInf b - vNumSup b) <= 1 ->
FcanonicI radix b x ->
FboundedI b y -> (Rabs x < Rabs y)%R -> (Fexp x <= Fexp y)%Z.
Theorem ReductRangeI :
forall (b b' : FboundI) (p : nat),
vNumInf b = vNumInf b' ->
dExpI b = dExpI b' ->
Z_of_nat (vNumSup b) = (vNumSup b' + 1)%Z ->
Z_of_nat (vNumSup b) = (radix * p)%Z ->
forall x : float,
FboundedI b x -> exists y : float, FboundedI b' y /\ x = y :>R.
Theorem ReductRangeIInv :
forall b b' : FboundI,
vNumInf b = vNumInf b' ->
dExpI b = dExpI b' ->
Z_of_nat (vNumSup b) = (vNumSup b' + 1)%Z ->
(forall x : float,
FboundedI b x -> exists y : float, FboundedI b' y /\ FtoRradix x = y) ->
exists p : Z, Z_of_nat (vNumSup b) = (radix * p)%Z.
End FboundedI_Def.
Section FroundI.
Variable radix : Z.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.
Variable b : FboundI.
Hypothesis vNumSupGreaterThanOne : (1 <= vNumSup b)%Z.
Hypothesis vNumInfGreaterThanOne : (1 <= vNumInf b)%Z.
Definition isMinI (r : R) (min : float) :=
FboundedI b min /\
(min <= r)%R /\
(forall f : float, FboundedI b f -> (f <= r)%R -> (f <= min)%R).
Definition isMaxI (r : R) (max : float) :=
FboundedI b max /\
(r <= max)%R /\
(forall f : float, FboundedI b f -> (r <= f)%R -> (max <= f)%R).
Definition ProjectorPI (P : R -> float -> Prop) :=
forall p q : float, FboundedI b p -> P p q -> p = q :>R.
Definition MonotonePI (P : R -> float -> Prop) :=
forall (p q : R) (p' q' : float),
(p < q)%R -> P p p' -> P q q' -> (p' <= q')%R.
Definition TotalPI (P : R -> float -> Prop) :=
forall r : R, exists p : float, P r p.
Definition CompatiblePI (P : R -> float -> Prop) :=
forall (r1 r2 : R) (p q : float),
P r1 p -> r1 = r2 -> p = q :>R -> FboundedI b q -> P r2 q.
Definition MinOrMaxPI (P : R -> float -> Prop) :=
forall (r : R) (p : float), P r p -> isMinI r p \/ isMaxI r p.
Definition RoundedModePI (P : R -> float -> Prop) :=
TotalPI P /\ CompatiblePI P /\ MinOrMaxPI P /\ MonotonePI P.
Theorem ProjectMinI : ProjectorPI isMinI.
Theorem ProjectMaxI : ProjectorPI isMaxI.
Theorem RoundedProjectorI : forall P, RoundedModePI P -> ProjectorPI P.
Theorem RoundedModeProjectorIdemI :
forall P (p : float), RoundedModePI P -> FboundedI b p -> P p p.
Theorem OppositeIUnique_1 :
forall (x y z : float) P,
RoundedModePI P ->
FboundedI b x ->
FboundedI b y ->
(- x < y)%R -> P (x + y)%R z -> (powerRZ radix (- dExpI b) <= z)%R.
Theorem OppositeIUnique_2 :
forall (x y z : float) P,
RoundedModePI P ->
FboundedI b x ->
FboundedI b y ->
(y < - x)%R -> P (x + y)%R z -> (powerRZ radix (- dExpI b) <= - z)%R.
Theorem OppositeIUnique :
forall (x y z : float) P,
RoundedModePI P ->
FboundedI b x ->
FboundedI b y ->
(- x)%R <> y -> P (x + y)%R z -> (powerRZ radix (- dExpI b) <= Rabs z)%R.
End FroundI.
Section FpropI.
Variable radix : Z.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.
Variable b : FboundI.
Theorem SterbenzIAux1 :
forall x y : float,
FboundedI b x ->
FboundedI b y ->
(y <= x)%R -> (x <= 2%nat * y)%R -> FboundedI b (Fminus radix x y).
Theorem SterbenzOppI :
forall x y : float,
(forall u : float, FboundedI b u ->
exists v : float, FtoRradix v = (- u)%R /\ FboundedI b v) ->
FboundedI b x -> FboundedI b y ->
(/ 2%nat * y <= x)%R -> (x <= 2%nat * y)%R ->
exists z : float,
FtoRradix z = (x - y)%R /\ FboundedI b z.
Theorem FoppBoundedI :
forall (b : FboundI) (x : float) (m : nat),
Z_of_nat (vNumSup b) = (radix * m - 1%nat)%Z ->
Z_of_nat (vNumInf b) = (radix * m)%Z ->
FboundedI b x ->
exists y : float,
FtoRradix y = (- x)%R /\ FboundedI b y.
Theorem FoppBoundedI2 :
forall (b0 : FboundI) (x : float) (p : nat),
Z_of_nat (vNumInf b0) = (radix * p - 1%nat)%Z ->
Z_of_nat (vNumSup b0) = (radix * p)%Z ->
FboundedI b0 x -> exists y : float, FtoRradix y = (- x)%R /\ FboundedI b0 y.
Theorem FoppBoundedIInv_aux :
forall n : Z,
(vNumSup b + 1%nat <= - n)%Z ->
(- n <= vNumInf b)%Z ->
(forall x : float,
FboundedI b x -> exists y : float, FtoRradix y = (- x)%R /\ FboundedI b y) ->
exists p : Z, n = (radix * p)%Z.
Theorem FoppBoundedIExp :
forall (x : float) (p : nat),
Z_of_nat (vNumSup b) = (radix * p - 1%nat)%Z ->
Z_of_nat (vNumInf b) = (radix * p)%Z ->
FboundedI b x ->
exists y : float,
FtoRradix y = (- x)%R /\
FboundedI b y /\ (Fexp y = Fexp x \/ Fexp y = Zsucc (Fexp x)).
Theorem nat_div_one : forall n m : nat, m * n = 1 -> m = 1.
Theorem Z_div_one :
forall (n : nat) (z : Z), (z * Z_of_nat n)%Z = Z_of_nat 1 -> n = 1.
Theorem FoppBoundedIInv :
(vNumSup b < vNumInf b)%Z ->
(forall x : float, FboundedI b x ->
exists y : float, FtoRradix y = (- x)%R /\ FboundedI b y) ->
(exists m : Z,
Z_of_nat (vNumInf b) = (radix * m)%Z) /\
Z_of_nat (vNumInf b) = (vNumSup b + 1%nat)%Z.
Theorem SterbenzIAux2A :
forall (x y : float) (n : nat),
Zabs_nat (vNumInf b - vNumSup b) <= n ->
FboundedI b x ->
FboundedI b y ->
(Fexp y <= Fexp x)%Z ->
(y <= x)%R ->
(x <= 2%nat * y - n * powerRZ radix (Fexp y))%R ->
(Fminus radix y x <= 0)%R ->
(- vNumInf b <= - vNumSup b + n)%Z -> FboundedI b (Fminus radix y x).
Theorem SterbenzIAux2B :
forall (x y : float) (n : nat),
Zabs_nat (vNumInf b - vNumSup b) <= n ->
FboundedI b x ->
FboundedI b y ->
(Fexp x <= Fexp y)%Z ->
(y <= 0)%R ->
(y <= x)%R ->
(x <= 2%nat * y - n * powerRZ radix (Fexp x))%R ->
(Fminus radix y x <= 0)%R ->
(- vNumInf b <= - vNumSup b + n)%Z -> FboundedI b (Fminus radix y x).
Theorem SterbenzIAux2 :
forall (x y : float) (n : nat),
Zabs_nat (vNumInf b - vNumSup b) <= n ->
FboundedI b x ->
FcanonicI radix b y ->
FboundedI b y ->
(y <= x)%R ->
(x <= 2%nat * y - n * powerRZ radix (Zmin (Fexp y) (Fexp x)))%R ->
FboundedI b (Fminus radix y x).
Theorem SterbenzI :
forall (x y : float) (n : nat),
Zabs_nat (vNumInf b - vNumSup b) <= n ->
FboundedI b x -> FcanonicI radix b x -> FboundedI b y ->
(/ 2%nat * y + / 2%nat * (n * powerRZ radix (Zmin (Fexp x) (Fexp y))) <= x)%R ->
(x <= 2%nat * y)%R ->
FboundedI b (Fminus radix x y).
End FpropI.
Section SterbenzApproxIAux.
Variable radix : Z.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.
Variables (b1 : FboundI) (b2 : FboundI).
Theorem SterbenzApproxI_aux1 :
forall (rho : R) (x y : float),
(0 < rho)%R ->
IZR (Zsucc (vNumSup b1)) = (rho * Zsucc (vNumSup b2))%R ->
(- dExpI b2 <= - dExpI b1)%Z ->
FboundedI b1 x ->
FboundedI b1 y ->
(0 <= y)%R ->
(y <= x)%R ->
(x <= (1 + / rho) * y)%R ->
FboundedI b2 (Fminus radix x (FnormalizeI radix b1 y)).
Theorem SterbenzApproxI_1 :
forall (rho : R) (x y : float),
(0 < rho)%R ->
IZR (Zsucc (vNumSup b1)) = (rho * Zsucc (vNumSup b2))%R ->
(- dExpI b2 <= - dExpI b1)%Z ->
(forall x : float,
FboundedI b2 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b2 y) ->
FboundedI b1 x ->
FboundedI b1 y ->
(/ (1 + / rho) * y <= x)%R ->
(x <= (1 + / rho) * y)%R ->
exists u : float, u = (x - y)%R :>R /\ FboundedI b2 u.
Theorem SterbenzApproxI_aux2 :
forall (rho : R) (x y : float),
(0 < rho)%R ->
IZR (Zsucc (vNumSup b1)) = (rho * Zsucc (vNumInf b2))%R ->
(- dExpI b2 <= - dExpI b1)%Z ->
FboundedI b1 x ->
FboundedI b1 y ->
(0 <= y)%R ->
(y <= x)%R ->
(x <= (1 + / rho) * y)%R ->
FboundedI b2 (Fminus radix (FnormalizeI radix b1 y) x).
Theorem SterbenzApproxI_2 :
forall (rho : R) (x y : float),
(0 < rho)%R ->
IZR (Zsucc (vNumSup b1)) = (rho * Zsucc (vNumInf b2))%R ->
(- dExpI b2 <= - dExpI b1)%Z ->
(forall x : float,
FboundedI b2 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b2 y) ->
FboundedI b1 x ->
FboundedI b1 y ->
(/ (1 + / rho) * y <= x)%R ->
(x <= (1 + / rho) * y)%R ->
exists u : float, u = (x - y)%R :>R /\ FboundedI b2 u.
End SterbenzApproxIAux.
Section SterbenzApproxI.
Variable radix : Z.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.
Variables (b1 : FboundI) (b2 : FboundI).
Theorem SterbenzApproxI_3 :
forall (rho : R) (x y : float),
(0 < rho)%R ->
IZR (Zsucc (vNumInf b1)) = (rho * Zsucc (vNumInf b2))%R ->
(- dExpI b2 <= - dExpI b1)%Z ->
(forall x : float,
FboundedI b2 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b2 y) ->
FboundedI b1 x ->
FboundedI b1 y ->
(x <= / (1 + / rho) * y)%R ->
((1 + / rho) * y <= x)%R ->
exists u : float, u = (x - y)%R :>R /\ FboundedI b2 u.
Theorem SterbenzApproxI_4 :
forall (rho : R) (x y : float),
(0 < rho)%R ->
IZR (Zsucc (vNumInf b1)) = (rho * Zsucc (vNumSup b2))%R ->
(- dExpI b2 <= - dExpI b1)%Z ->
(forall x : float,
FboundedI b2 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b2 y) ->
FboundedI b1 x ->
FboundedI b1 y ->
(x <= / (1 + / rho) * y)%R ->
((1 + / rho) * y <= x)%R ->
exists u : float, u = (x - y)%R :>R /\ FboundedI b2 u.
Theorem SterbenzApproxI_pos :
forall (rho : R) (x y : float),
(0 < rho)%R ->
rho =
Rmin
(Rmin (Zsucc (vNumInf b1) / Zsucc (vNumInf b2))
(Zsucc (vNumSup b1) / Zsucc (vNumSup b2)))
(Rmin (Zsucc (vNumInf b1) / Zsucc (vNumSup b2))
(Zsucc (vNumSup b1) / Zsucc (vNumInf b2))) ->
(- dExpI b2 <= - dExpI b1)%Z ->
(forall x : float,
FboundedI b2 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b2 y) ->
(forall x : float,
FboundedI b1 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b1 y) ->
FboundedI b1 x ->
FboundedI b1 y ->
(/ (1 + / rho) * y <= x)%R ->
(x <= (1 + / rho) * y)%R ->
exists u : float, u = (x - y)%R :>R /\ FboundedI b2 u.
Theorem SterbenzApproxI :
forall (rho : R) (x y : float),
(0 < rho)%R ->
rho = Rmin
(Rmin (Zsucc (vNumInf b1) / Zsucc (vNumInf b2))
(Zsucc (vNumSup b1) / Zsucc (vNumSup b2)))
(Rmin (Zsucc (vNumInf b1) / Zsucc (vNumSup b2))
(Zsucc (vNumSup b1) / Zsucc (vNumInf b2))) ->
(- dExpI b2 <= - dExpI b1)%Z ->
(forall x : float,
FboundedI b2 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b2 y) ->
(forall x : float,
FboundedI b1 x -> exists y : float, y = (- x)%R :>R /\ FboundedI b1 y) ->
FboundedI b1 x -> FboundedI b1 y ->
(0 <= x * y)%R ->
(/ (1 + / rho) * Rabs y <= Rabs x)%R ->
(Rabs x <= (1 + / rho) * Rabs y)%R ->
exists u : float,
u = (x - y)%R :>R /\ FboundedI b2 u.
End SterbenzApproxI.
`