X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Flibrary%2Fnat%2Forders.ma;fp=matita%2Fmatita%2Flibrary%2Fnat%2Forders.ma;h=8255787f98988252369855dca4f5e075de451f2d;hb=2c01ff6094173915e7023076ea48b5804dca7778;hp=0000000000000000000000000000000000000000;hpb=a050e3f80d7ea084ce0184279af98e8251c7d2a6;p=helm.git diff --git a/matita/matita/library/nat/orders.ma b/matita/matita/library/nat/orders.ma new file mode 100644 index 000000000..8255787f9 --- /dev/null +++ b/matita/matita/library/nat/orders.ma @@ -0,0 +1,439 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +include "nat/nat.ma". +include "higher_order_defs/ordering.ma". + +(* definitions *) +inductive le (n:nat) : nat \to Prop \def + | le_n : le n n + | le_S : \forall m:nat. le n m \to le n (S m). + +interpretation "natural 'less or equal to'" 'leq x y = (le x y). + +interpretation "natural 'neither less nor equal to'" 'nleq x y = (Not (le x y)). + +definition lt: nat \to nat \to Prop \def +\lambda n,m:nat.(S n) \leq m. + +interpretation "natural 'less than'" 'lt x y = (lt x y). + +interpretation "natural 'not less than'" 'nless x y = (Not (lt x y)). + +definition ge: nat \to nat \to Prop \def +\lambda n,m:nat.m \leq n. + +interpretation "natural 'greater or equal to'" 'geq x y = (ge x y). + +definition gt: nat \to nat \to Prop \def +\lambda n,m:nat.m (S_pred m); + [ apply le_S_S; + assumption + | assumption + ] +]. +qed. + +theorem le_to_le_pred: + ∀n,m. n ≤ m → pred n ≤ pred m. +intros 2; +elim n; +[ simplify; + apply le_O_n +| simplify; + elim m in H1 ⊢ %; + [ elim (not_le_Sn_O ? H1) + | simplify; + apply le_S_S_to_le; + assumption + ] +]. +qed. + +(* le to lt or eq *) +theorem le_to_or_lt_eq : \forall n,m:nat. +n \leq m \to n < m \lor n = m. +intros.elim H. +right.reflexivity. +left.unfold lt.apply le_S_S.assumption. +qed. + +theorem Not_lt_n_n: ∀n. n ≮ n. +intro; +unfold Not; +intro; +unfold lt in H; +apply (not_le_Sn_n ? H). +qed. + +(* not eq *) +theorem lt_to_not_eq : \forall n,m:nat. n H in H1. +apply (lt_to_not_eq b b) +[ assumption +| reflexivity +] +qed. + +theorem lt_n_m_to_not_lt_m_Sn: ∀n,m. n < m → m ≮ S n. +intros; +unfold Not; +intro; +unfold lt in H; +unfold lt in H1; +generalize in match (le_S_S ? ? H); +intro; +generalize in match (transitive_le ? ? ? H2 H1); +intro; +apply (not_le_Sn_n ? H3). +qed. + +(* le vs. lt *) +theorem lt_to_le : \forall n,m:nat. n H7. +apply H. +apply le_to_or_lt_eq.apply H6. +qed.