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 (**************************************************************************)
16 include "nat/orders.ma".
18 definition Zle : Z \to Z \to Prop \def
24 | (pos m) \Rightarrow True
25 | (neg m) \Rightarrow False ]
28 [ OZ \Rightarrow False
29 | (pos m) \Rightarrow n \leq m
30 | (neg m) \Rightarrow False ]
34 | (pos m) \Rightarrow True
35 | (neg m) \Rightarrow m \leq n ]].
37 interpretation "integer 'less or equal to'" 'leq x y = (Zle x y).
38 interpretation "integer 'neither less nor equal to'" 'nleq x y = (Not (Zle x y)).
40 definition Zlt : Z \to Z \to Prop \def
45 [ OZ \Rightarrow False
46 | (pos m) \Rightarrow True
47 | (neg m) \Rightarrow False ]
50 [ OZ \Rightarrow False
51 | (pos m) \Rightarrow n<m
52 | (neg m) \Rightarrow False ]
56 | (pos m) \Rightarrow True
57 | (neg m) \Rightarrow m<n ]].
59 interpretation "integer 'less than'" 'lt x y = (Zlt x y).
60 interpretation "integer 'not less than'" 'nless x y = (Not (Zlt x y)).
62 theorem irreflexive_Zlt: irreflexive Z Zlt.
63 unfold irreflexive.unfold Not.
65 cut (neg n < neg n \to False).
66 apply Hcut.apply H.simplify.unfold lt.apply not_le_Sn_n.
67 cut (pos n < pos n \to False).
68 apply Hcut.apply H.simplify.unfold lt.apply not_le_Sn_n.
72 theorem transitive_Zle : transitive Z Zle.
83 | simplify. simplify in H1. assumption
89 | simplify. simplify in H. assumption
95 [ intros. apply False_ind. apply H
98 [ simplify. intro. assumption
99 | intro. generalize in match H. simplify. apply trans_le
100 | intro. simplify. intro. assumption
102 | intros 2. apply False_ind. apply H
108 [ simplify. intros. assumption
109 | intro. simplify. intros. assumption
110 | intro. simplify. intros. apply False_ind. apply H1
114 [ apply False_ind. apply H1
116 | apply False_ind. apply H1
120 [ simplify. intro. assumption
121 | intro. simplify. intro. assumption
122 | intros. simplify. simplify in H. simplify in H1.
123 generalize in match H. generalize in match H1. apply trans_le
129 variant trans_Zle: transitive Z Zle
132 theorem transitive_Zlt: transitive Z Zlt.
138 [ intros. apply False_ind. apply H
145 | intros 2. apply False_ind. apply H
150 [ intros. apply False_ind. apply H
153 [ simplify. intro. assumption
154 | intro. generalize in match H. simplify. apply trans_lt
155 | intro. simplify. intro. assumption
157 | intros 2. apply False_ind. apply H
163 [ intros. simplify. apply I
164 | intro. simplify. intros. assumption
165 | intro. simplify. intros. apply False_ind. apply H1
169 [ apply False_ind. apply H1
171 | apply False_ind. apply H1
175 [ simplify. intro. assumption
176 | intro. simplify. intro. assumption
177 | intros. simplify. simplify in H. simplify in H1.
178 generalize in match H. generalize in match H1. apply trans_lt
184 variant trans_Zlt: transitive Z Zlt
186 theorem irrefl_Zlt: irreflexive Z Zlt
187 \def irreflexive_Zlt.
189 theorem Zlt_neg_neg_to_lt:
190 \forall n,m:nat. neg n < neg m \to m < n.
194 theorem lt_to_Zlt_neg_neg: \forall n,m:nat.m < n \to neg n < neg m.
199 theorem Zlt_pos_pos_to_lt:
200 \forall n,m:nat. pos n < pos m \to n < m.
204 theorem lt_to_Zlt_pos_pos: \forall n,m:nat.n < m \to pos n < pos m.
209 theorem Zlt_to_Zle: \forall x,y:Z. x < y \to Zsucc x \leq y.
213 cut (OZ < y \to Zsucc OZ \leq y).
214 apply Hcut. assumption.
217 simplify.apply le_O_n.
222 cut (neg n < y \to Zsucc (neg n) \leq y).
223 apply Hcut. assumption.
225 cut (neg O < y \to Zsucc (neg O) \leq y).
226 apply Hcut. assumption.
230 simplify.apply (not_le_Sn_O n1 H2).
231 cut (neg (S n1) < y \to (Zsucc (neg (S n1))) \leq y).
232 apply Hcut. assumption.simplify.
236 simplify.apply (le_S_S_to_le n2 n1 H3).