MinOrMax

# Library MinOrMax

`Require Export AllFloat.
Section MinOrMax_def.
Variable radix : Z.
Let FtoRradix := FtoR radix.
Coercion FtoRradix : float >-> R.
Variable b : Fbound.
Variable precision : nat.
Hypothesis radixMoreThanOne : (1 < radix)%Z.
Hypothesis precisionGreaterThanOne : 1 < precision.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Definition MinOrMax (z : R) (f : float) :=
isMin b radix z f \/ isMax b radix z f.
Theorem MinOrMax_Rlt :
forall (z : R) (p : float),
1 < precision ->
Zpos (vNum b) = Zpower_nat radix precision ->
MinOrMax z p -> (Rabs (z - p) < Fulp b radix precision p)%R.
Theorem MinOrMax_Fopp :
forall (x : R) (f : float), MinOrMax (- x) (Fopp f) -> MinOrMax x f.
Theorem MinOrMax1 :
forall (z : R) (p : float),
Fbounded b p ->
Fcanonic radix b p ->
(0 < p)%R ->
(Rabs (z - p) < Fulp b radix precision (FPred b radix precision p))%R ->
MinOrMax z p.
Theorem MinOrMax2 :
forall (z : R) (p : float),
Fbounded b p ->
Fcanonic radix b p ->
(0 < p)%R ->
(Rabs (z - p) < Fulp b radix precision p)%R -> (p <= z)%R -> MinOrMax z p.
Theorem MinOrMax3_aux :
forall (z : R) (p : float),
Fbounded b p ->
Fcanonic radix b p ->
0%R = p ->
(z <= 0)%R ->
(- z < Fulp b radix precision (FPred b radix precision p))%R -> MinOrMax z p.
Theorem MinOrMax3 :
forall (z : R) (p : float),
Fbounded b p ->
Fcanonic radix b p ->
0%R = p ->
(Rabs (z - p) < Fulp b radix precision (FPred b radix precision p))%R ->
MinOrMax z p.
End MinOrMax_def.
`