1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| A.Asperti, C.Sacerdoti Coen, *)
8 (* ||A|| E.Tassi, S.Zacchiroli *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/Z/orders".
18 include "nat/orders.ma".
20 definition Zle : Z \to Z \to Prop \def
26 | (pos m) \Rightarrow True
27 | (neg m) \Rightarrow False ]
30 [ OZ \Rightarrow False
31 | (pos m) \Rightarrow n \leq m
32 | (neg m) \Rightarrow False ]
36 | (pos m) \Rightarrow True
37 | (neg m) \Rightarrow m \leq n ]].
39 (*CSC: the URI must disappear: there is a bug now *)
40 interpretation "integer 'less or equal to'" 'leq x y = (cic:/matita/Z/orders/Zle.con x y).
41 (*CSC: the URI must disappear: there is a bug now *)
42 interpretation "integer 'neither less nor equal to'" 'nleq x y =
43 (cic:/matita/logic/connectives/Not.con (cic:/matita/Z/orders/Zle.con x y)).
45 definition Zlt : Z \to Z \to Prop \def
50 [ OZ \Rightarrow False
51 | (pos m) \Rightarrow True
52 | (neg m) \Rightarrow False ]
55 [ OZ \Rightarrow False
56 | (pos m) \Rightarrow n<m
57 | (neg m) \Rightarrow False ]
61 | (pos m) \Rightarrow True
62 | (neg m) \Rightarrow m<n ]].
64 (*CSC: the URI must disappear: there is a bug now *)
65 interpretation "integer 'less than'" 'lt x y = (cic:/matita/Z/orders/Zlt.con x y).
66 (*CSC: the URI must disappear: there is a bug now *)
67 interpretation "integer 'not less than'" 'nless x y =
68 (cic:/matita/logic/connectives/Not.con (cic:/matita/Z/orders/Zlt.con x y)).
70 theorem irreflexive_Zlt: irreflexive Z Zlt.
71 unfold irreflexive.unfold Not.
73 cut (neg n < neg n \to False).
74 apply Hcut.apply H.simplify.unfold lt.apply not_le_Sn_n.
75 cut (pos n < pos n \to False).
76 apply Hcut.apply H.simplify.unfold lt.apply not_le_Sn_n.
80 theorem transitive_Zle : transitive Z Zle.
91 | simplify. simplify in H1. assumption
97 | simplify. simplify in H. assumption
103 [ intros. apply False_ind. apply H
106 [ simplify. intro. assumption
107 | intro. generalize in match H. simplify. apply trans_le
108 | intro. simplify. intro. assumption
110 | intros 2. apply False_ind. apply H
116 [ simplify. intros. assumption
117 | intro. simplify. intros. assumption
118 | intro. simplify. intros. apply False_ind. apply H1
122 [ apply False_ind. apply H1
124 | apply False_ind. apply H1
128 [ simplify. intro. assumption
129 | intro. simplify. intro. assumption
130 | intros. simplify. simplify in H. simplify in H1.
131 generalize in match H. generalize in match H1. apply trans_le
137 variant trans_Zle: transitive Z Zle
140 theorem transitive_Zlt: transitive Z Zlt.
146 [ intros. apply False_ind. apply H
153 | intros 2. apply False_ind. apply H
158 [ intros. apply False_ind. apply H
161 [ simplify. intro. assumption
162 | intro. generalize in match H. simplify. apply trans_lt
163 | intro. simplify. intro. assumption
165 | intros 2. apply False_ind. apply H
171 [ intros. simplify. apply I
172 | intro. simplify. intros. assumption
173 | intro. simplify. intros. apply False_ind. apply H1
177 [ apply False_ind. apply H1
179 | apply False_ind. apply H1
183 [ simplify. intro. assumption
184 | intro. simplify. intro. assumption
185 | intros. simplify. simplify in H. simplify in H1.
186 generalize in match H. generalize in match H1. apply trans_lt
192 variant trans_Zlt: transitive Z Zlt
194 theorem irrefl_Zlt: irreflexive Z Zlt
195 \def irreflexive_Zlt.
197 theorem Zlt_neg_neg_to_lt:
198 \forall n,m:nat. neg n < neg m \to m < n.
202 theorem lt_to_Zlt_neg_neg: \forall n,m:nat.m < n \to neg n < neg m.
207 theorem Zlt_pos_pos_to_lt:
208 \forall n,m:nat. pos n < pos m \to n < m.
212 theorem lt_to_Zlt_pos_pos: \forall n,m:nat.n < m \to pos n < pos m.
217 theorem Zlt_to_Zle: \forall x,y:Z. x < y \to Zsucc x \leq y.
221 cut (OZ < y \to Zsucc OZ \leq y).
222 apply Hcut. assumption.
225 simplify.apply le_O_n.
230 cut (neg n < y \to Zsucc (neg n) \leq y).
231 apply Hcut. assumption.
233 cut (neg O < y \to Zsucc (neg O) \leq y).
234 apply Hcut. assumption.
238 simplify.apply (not_le_Sn_O n1 H2).
239 cut (neg (S n1) < y \to (Zsucc (neg (S n1))) \leq y).
240 apply Hcut. assumption.simplify.
244 simplify.apply (le_S_S_to_le n2 n1 H3).