]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/nat_lt.ma
cb1021aad63d9c66bf10ebdab35df03d41cb65bc
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / nat_lt.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "ground/xoa/or_3.ma".
16 include "ground/arith/nat_le.ma".
17
18 (* STRICT ORDER FOR NON-NEGATIVE INTEGERS ***********************************)
19
20 (*** lt *)
21 definition nlt: relation2 nat nat ≝
22            λm,n. ↑m ≤ n.
23
24 interpretation
25   "less (non-negative integers)"
26   'lt m n = (nlt m n).
27
28 (* Basic constructions ******************************************************)
29
30 lemma nlt_i (m) (n): ↑m ≤ n → m < n.
31 // qed.
32
33 lemma nlt_refl_succ (n): n < ↑n.
34 // qed.
35
36 (*** lt_S *)
37 lemma nlt_succ_dx (m) (n): m < n → m < ↑n.
38 /2 width=1 by nle_succ_dx/ qed.
39
40 (*** lt_O_S *)
41 lemma nlt_zero_succ (m): 𝟎 < ↑m.
42 /2 width=1 by nle_succ_bi/ qed.
43
44 (*** lt_S_S *)
45 lemma nlt_succ_bi (m) (n): m < n → ↑m < ↑n.
46 /2 width=1 by nle_succ_bi/ qed.
47
48 (*** le_to_or_lt_eq *)
49 lemma nle_lt_eq_dis (m) (n): m ≤ n → ∨∨ m < n | m = n.
50 #m #n * -n /3 width=1 by nle_succ_bi, or_introl/
51 qed-.
52
53 (*** eq_or_gt *)
54 lemma eq_gt_dis (n): ∨∨ 𝟎 = n | 𝟎 < n.
55 #n elim (nle_lt_eq_dis (𝟎) n ?)
56 /2 width=1 by or_introl, or_intror/
57 qed-.
58
59 (*** lt_or_ge *)
60 lemma nlt_ge_dis (m) (n): ∨∨ m < n | n ≤ m.
61 #m #n elim (nle_ge_dis m n) /2 width=1 by or_intror/
62 #H elim (nle_lt_eq_dis … H) -H /2 width=1 by nle_refl, or_introl, or_intror/
63 qed-.
64
65 (*** lt_or_eq_or_gt *)
66 lemma nlt_eq_gt_dis (m) (n): ∨∨ m < n | n = m | n < m.
67 #m #n elim (nlt_ge_dis m n) /2 width=1 by or3_intro0/
68 #H elim (nle_lt_eq_dis … H) -H /2 width=1 by or3_intro1, or3_intro2/
69 qed-.
70
71 (*** not_le_to_lt *)
72 lemma le_false_nlt (m) (n): (n ≤ m → ⊥) → m < n.
73 #m #n elim (nlt_ge_dis m n) [ // ]
74 #H #Hn elim Hn -Hn // 
75 qed.
76
77 (*** lt_to_le_to_lt *)
78 lemma nlt_le_trans (o) (m) (n): m < o → o ≤ n → m < n.
79 /2 width=3 by nle_trans/ qed-.
80
81 (*** le_to_lt_to_lt *)
82 lemma le_nlt_trans (o) (m) (n): m ≤ o → o < n → m < n.
83 /3 width=3 by nle_succ_bi, nle_trans/ qed-.
84
85 (* Basic inversions *********************************************************)
86
87 (*** lt_S_S_to_lt *)
88 lemma nlt_inv_succ_bi (m) (n): ↑m < ↑n → m < n.
89 /2 width=1 by nle_inv_succ_bi/ qed-.
90
91 (*** lt_to_not_le lt_le_false *)
92 lemma nlt_ge_false (m) (n): m < n → n ≤ m → ⊥.
93 /3 width=4 by nle_inv_succ_sn_refl, nlt_le_trans/ qed-.
94
95 (*** lt_to_not_eq lt_refl_false *)
96 lemma nlt_inv_refl (m): m < m → ⊥.
97 /2 width=4 by nlt_ge_false/ qed-.
98
99 (*** lt_zero_false *)
100 lemma nlt_inv_zero_dx (m): m < 𝟎 → ⊥.
101 /2 width=4 by nlt_ge_false/ qed-.
102
103 (* Basic destructions *******************************************************)
104
105 (*** lt_to_le *)
106 lemma nlt_des_le (m) (n): m < n → m ≤ n.
107 /2 width=3 by nle_trans/ qed-.
108
109 (*** ltn_to_ltO *)
110 lemma nlt_des_lt_O_sn (m) (n): m < n → 𝟎 < n.
111 /3 width=3 by le_nlt_trans/ qed-.
112
113 (* Main constructions *******************************************************)
114
115 (*** transitive_lt *)
116 theorem nlt_trans: Transitive … nlt.
117 /3 width=3 by nlt_des_le, nlt_le_trans/ qed-.
118
119 (* Advanced eliminations ****************************************************)
120
121 lemma nat_ind_lt_le (Q:predicate …):
122       (∀n. (∀m. m < n → Q m) → Q n) → ∀n,m. m ≤ n → Q m.
123 #Q #H1 #n @(nat_ind_succ … n) -n
124 [ #m #H <(nle_inv_zero_dx … H) -m
125   @H1 -H1 #o #H elim (nlt_inv_zero_dx … H)
126 | /5 width=3 by nlt_le_trans, nle_inv_succ_bi/
127 ]
128 qed-.
129
130 (*** nat_elim1 *)
131 lemma nat_ind_lt (Q:predicate …):
132       (∀n. (∀m. m < n → Q m) → Q n) → ∀n. Q n.
133 /4 width=2 by nat_ind_lt_le/ qed-.
134
135 (*** lt_elim *)
136 lemma nlt_ind_alt (Q: relation2 nat nat):
137       (∀n. Q (𝟎) (↑n)) →
138       (∀m,n. m < n → Q m n → Q (↑m) (↑n)) →
139       ∀m,n. m < n → Q m n.
140 #Q #IH1 #IH2 #m #n @(nat_ind_2_succ … n m) -m -n //
141 [ #m #H
142   elim (nlt_inv_zero_dx … H)
143 | /4 width=1 by nlt_inv_succ_bi/
144 ]
145 qed-.