1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/xoa/or_3.ma".
16 include "ground/arith/nat_le.ma".
18 (* STRICT ORDER FOR NON-NEGATIVE INTEGERS ***********************************)
21 definition nlt: relation2 nat nat ≝
25 "less (non-negative integers)"
28 (* Basic constructions ******************************************************)
30 lemma nlt_i (m) (n): ↑m ≤ n → m < n.
33 lemma nlt_refl_succ (n): n < ↑n.
37 lemma nlt_succ_dx (m) (n): m < n → m < ↑n.
38 /2 width=1 by nle_succ_dx/ qed.
41 lemma nlt_zero_succ (m): 𝟎 < ↑m.
42 /2 width=1 by nle_succ_bi/ qed.
45 lemma nlt_succ_bi (m) (n): m < n → ↑m < ↑n.
46 /2 width=1 by nle_succ_bi/ qed.
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/
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/
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/
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/
72 lemma le_false_nlt (m) (n): (n ≤ m → ⊥) → m < n.
73 #m #n elim (nlt_ge_dis m n) [ // ]
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-.
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-.
85 (* Basic inversions *********************************************************)
88 lemma nlt_inv_succ_bi (m) (n): ↑m < ↑n → m < n.
89 /2 width=1 by nle_inv_succ_bi/ qed-.
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-.
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-.
100 lemma nlt_inv_zero_dx (m): m < 𝟎 → ⊥.
101 /2 width=4 by nlt_ge_false/ qed-.
103 (* Basic destructions *******************************************************)
106 lemma nlt_des_le (m) (n): m < n → m ≤ n.
107 /2 width=3 by nle_trans/ qed-.
110 lemma nlt_des_lt_O_sn (m) (n): m < n → 𝟎 < n.
111 /3 width=3 by le_nlt_trans/ qed-.
113 (* Main constructions *******************************************************)
115 (*** transitive_lt *)
116 theorem nlt_trans: Transitive … nlt.
117 /3 width=3 by nlt_des_le, nlt_le_trans/ qed-.
119 (* Advanced eliminations ****************************************************)
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/
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-.
136 lemma nlt_ind_alt (Q: relation2 nat nat):
138 (∀m,n. m < n → Q m n → Q (↑m) (↑n)) →
140 #Q #IH1 #IH2 #m #n @(nat_ind_2_succ … n m) -m -n //
142 elim (nlt_inv_zero_dx … H)
143 | /4 width=1 by nlt_inv_succ_bi/