Fodd

# Library Fodd

`Require Export Fmin.
Section FOdd.
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 precisionGreaterThanOne : 1 < precision.
Hypothesis pGivesBound : Zpos (vNum b) = Zpower_nat radix precision.
Definition Even (z : Z) : Prop := exists z1 : _, z = (2 * z1)%Z.
Definition Odd (z : Z) : Prop := exists z1 : _, z = (2 * z1 + 1)%Z.
Theorem OddSEven : forall n : Z, Odd n -> Even (Zsucc n).
Theorem EvenSOdd : forall n : Z, Even n -> Odd (Zsucc n).
Hint Resolve OddSEven EvenSOdd: zarith.
Theorem OddSEvenInv : forall n : Z, Odd (Zsucc n) -> Even n.
Theorem EvenSOddInv : forall n : Z, Even (Zsucc n) -> Odd n.
Theorem EvenO : Even 0.
Hint Resolve EvenO: zarith.
Theorem Odd1 : Odd 1.
Hint Resolve Odd1: zarith.
Theorem OddOpp : forall z : Z, Odd z -> Odd (- z).
Theorem EvenOpp : forall z : Z, Even z -> Even (- z).
Hint Resolve OddOpp EvenOpp: zarith.
Theorem OddEvenDec : forall n : Z, {Odd n} + {Even n}.
Theorem OddNEven : forall n : Z, Odd n -> ~ Even n.
Theorem EvenNOdd : forall n : Z, Even n -> ~ Odd n.
Hint Resolve OddNEven EvenNOdd: zarith.
Theorem EvenPlus1 : forall n m : Z, Even n -> Even m -> Even (n + m).
Theorem EvenPlus2 : forall n m : Z, Odd n -> Odd m -> Even (n + m).
Theorem OddPlus1 : forall n m : Z, Odd n -> Even m -> Odd (n + m).
Theorem OddPlus2 : forall n m : Z, Even n -> Odd m -> Odd (n + m).
Hint Resolve EvenPlus1 EvenPlus2 OddPlus1 OddPlus2: zarith.
Theorem EvenPlusInv1 :
forall n m : Z, Even (n + m) -> Even n -> Even m.
Theorem EvenPlusInv2 : forall n m : Z, Even (n + m) -> Odd n -> Odd m.
Theorem OddPlusInv1 : forall n m : Z, Odd (n + m) -> Odd m -> Even n.
Theorem OddPlusInv2 : forall n m : Z, Odd (n + m) -> Even m -> Odd n.
Theorem EvenMult1 : forall n m : Z, Even n -> Even (n * m).
Theorem EvenMult2 : forall n m : Z, Even m -> Even (n * m).
Hint Resolve EvenMult1 EvenMult2: zarith.
Theorem OddMult : forall n m : Z, Odd n -> Odd m -> Odd (n * m).
Hint Resolve OddMult: zarith.
Theorem EvenMultInv : forall n m : Z, Even (n * m) -> Odd n -> Even m.
Theorem OddMultInv : forall n m : Z, Odd (n * m) -> Odd n.
Theorem EvenExp :
forall (n : Z) (m : nat), Even n -> Even (Zpower_nat n (S m)).
Theorem OddExp :
forall (n : Z) (m : nat), Odd n -> Odd (Zpower_nat n m).
Hint Resolve OddExp EvenExp: zarith.
Definition Feven (p : float) := Even (Fnum p).
Definition Fodd (p : float) := Odd (Fnum p).
Theorem FevenO : forall p : float, is_Fzero p -> Feven p.
Theorem FevenOrFodd : forall p : float, Feven p \/ Fodd p.
Theorem FevenSucProp :
forall p : float,
(Fodd p -> Feven (FSucc b radix precision p)) /\
(Feven p -> Fodd (FSucc b radix precision p)).
Theorem FoddSuc :
forall p : float, Fodd p -> Feven (FSucc b radix precision p).
Theorem FevenSuc :
forall p : float, Feven p -> Fodd (FSucc b radix precision p).
Theorem FevenFop : forall p : float, Feven p -> Feven (Fopp p).
Theorem FoddFop : forall p : float, Fodd p -> Fodd (Fopp p).
Theorem FevenPred :
forall p : float, Fodd p -> Feven (FPred b radix precision p).
Theorem FoddPred :
forall p : float, Feven p -> Fodd (FPred b radix precision p).
Definition FNodd (p : float) := Fodd (Fnormalize radix b precision p).
Definition FNeven (p : float) := Feven (Fnormalize radix b precision p).
Theorem FNoddEq :
forall f1 f2 : float,
Fbounded b f1 -> Fbounded b f2 -> f1 = f2 :>R -> FNodd f1 -> FNodd f2.
Theorem FNevenEq :
forall f1 f2 : float,
Fbounded b f1 -> Fbounded b f2 -> f1 = f2 :>R -> FNeven f1 -> FNeven f2.
Theorem FNevenFop : forall p : float, FNeven p -> FNeven (Fopp p).
Theorem FNoddFop : forall p : float, FNodd p -> FNodd (Fopp p).
Theorem FNoddSuc :
forall p : float,
Fbounded b p -> FNodd p -> FNeven (FNSucc b radix precision p).
Theorem FNevenSuc :
forall p : float,
Fbounded b p -> FNeven p -> FNodd (FNSucc b radix precision p).
Theorem FNevenPred :
forall p : float,
Fbounded b p -> FNodd p -> FNeven (FNPred b radix precision p).
Theorem FNoddPred :
forall p : float,
Fbounded b p -> FNeven p -> FNodd (FNPred b radix precision p).
Theorem FNevenOrFNodd : forall p : float, FNeven p \/ FNodd p.
Theorem FnOddNEven : forall n : float, FNodd n -> ~ FNeven n.
Theorem FEvenD :
forall p : float,
Fbounded b p ->
Feven p -> exists q : float, Fbounded b q /\ p = (2%nat * q)%R :>R.
Theorem FNEvenD :
forall p : float,
Fbounded b p ->
FNeven p -> exists q : float, Fbounded b q /\ p = (2%nat * q)%R :>R.
End FOdd.
Hint Resolve FevenO FoddSuc FevenSuc FevenFop FoddFop FevenPred FoddPred
FNevenFop FNoddFop FNoddSuc FNevenSuc FNevenPred FNoddPred: float.
`