Module MyNat.
End MyNat.
Open Scope R_scope.
(** * Integers *)
(** Integer part in Z *)
Definition floor x := proj1_sig (floor_ex x).
Definition floor1 x := proj1_sig (floor1_ex x).
(** Interger part in nat *)
Definition nfloor x pr := proj1_sig (nfloor_ex x pr).
Definition nfloor1 x pr := proj1_sig (nfloor1_ex x pr).
(** More theorems about INR *)
Fixpoint pow2 (n : nat) : nat :=
match n with
| O => 1%nat
| S n => (2 * pow2 n)%nat
end.
(** * Rinv *)
(** * Rdiv *)
(** Rewritings *)
(** Order *)
(** * Rmult *)
(** * Rminus *)
(** Rewritings *)
(** Order *)
(** * Rplus *)
(** Sums *)
(** * Rmin and Rmax *)
(** Rewritings *)
intros x y z; unfold Rmin.
destruct (Rle_dec y z);
destruct (Rle_dec x y);
destruct (Rle_dec x z);
destruct (Rle_dec y z) ; try intuition.
contradict n.
apply Rle_trans with y ; auto.
contradict r.
apply Rlt_not_le, Rlt_trans with y ; apply Rnot_le_lt ; auto.
Qed.
intros x y z; unfold Rmax.
destruct (Rle_dec y z);
destruct (Rle_dec x y);
destruct (Rle_dec x z);
destruct (Rle_dec y z) ; try intuition.
contradict n.
apply Rle_trans with y ; auto.
contradict r.
apply Rlt_not_le, Rlt_trans with y ; apply Rnot_le_lt ; auto.
Qed.
(** Order *)
(** * Rabs *)
(** Rewritings *)
(** Order *)

Lemma Rabs_le_between_Rmax : forall x m M,
m <= x <= M -> Rabs x <= Rmax M (-m).