]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/nat_lt.ma
arithmetics for λδ
[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/arith/nat_le.ma".
16
17 (* NON-NEGATIVE INTEGERS ****************************************************)
18
19 (*** lt *)
20 definition nlt: relation2 nat nat ≝
21            λm,n. ↑m ≤ n.
22
23 interpretation
24   "less (non-negative integers)"
25   'lt m n = (nlt m n).
26
27 (* Basic constructions ******************************************************)
28
29 (*** lt_O_S *)
30 lemma nlt_zero_succ (m): 𝟎 < ↑m.
31 /2 width=1 by nle_succ_bi/ qed.
32
33 (*** le_to_or_lt_eq *)
34 lemma nle_lt_eq_e (m) (n): m ≤ n → ∨∨ m < n | m = n.
35 #m #n * -n /3 width=1 by nle_succ_bi, or_introl/
36 qed-.
37
38 (*** eq_or_gt *)
39 lemma eq_gt_e (n): ∨∨ 𝟎 = n | 𝟎 < n.
40 #n elim (nle_lt_eq_e (𝟎) n ?)
41 /2 width=1 by or_introl, or_intror/
42 qed-.
43
44 (*** lt_or_ge *)
45 lemma nlt_ge_e (m) (n): ∨∨ m < n | n ≤ m.
46 #m #n elim (nle_ge_e m n) /2 width=1 by or_intror/
47 #H elim (nle_lt_eq_e … H) -H /2 width=1 by nle_refl, or_introl, or_intror/
48 qed-.
49
50 (*** not_le_to_lt *)
51 lemma le_false_nlt (m) (n): (n ≤ m → ⊥) → m < n.
52 #m #n elim (nlt_ge_e m n) [ // ]
53 #H #Hn elim Hn -Hn // 
54 qed.
55
56 (*** lt_to_le_to_lt *)
57 lemma nlt_le_trans (o) (m) (n): m < o → o ≤ n → m < n.
58 /2 width=3 by nle_trans/ qed-.
59
60 lemma le_nlt_trans (o) (m) (n): m ≤ o → o < n → m < n.
61 /3 width=3 by nle_succ_bi, nle_trans/ qed-.
62
63 (* Basic inversions *********************************************************)
64
65 (*** lt_to_not_le *)
66 lemma nlt_ge_false (m) (n): m < n → n ≤ m → ⊥.
67 /3 width=4 by nle_inv_succ_sn_refl, nlt_le_trans/ qed-.
68
69 (*** lt_to_not_eq *)
70 lemma nlt_inv_refl (m): m < m → ⊥.
71 /2 width=4 by nlt_ge_false/ qed-.
72
73 lemma nlt_inv_zero_dx (m): m < 𝟎 → ⊥.
74 /2 width=4 by nlt_ge_false/ qed-.
75
76 (* Basic destructions *******************************************************)
77
78 (*** lt_to_le *)
79 lemma nlt_des_le (m) (n): m < n → m ≤ n.
80 /2 width=3 by nle_trans/ qed-.
81
82 (*** ltn_to_ltO *)
83 lemma nlt_des_lt_O_sn (m) (n): m < n → 𝟎 < n.
84 /3 width=3 by le_nlt_trans/ qed-.
85
86 (* Main constructions *******************************************************)
87
88 (*** transitive_lt *)
89 theorem nlt_trans: Transitive … nlt.
90 /3 width=3 by nlt_des_le, nlt_le_trans/ qed-.
91
92 (* Advanced eliminations ****************************************************)
93
94 lemma nat_ind_lt_le (Q:predicate …):
95       (∀n. (∀m. m < n → Q m) → Q n) → ∀n,m. m ≤ n → Q m.
96 #Q #H1 #n @(nat_ind … n) -n
97 [ #m #H <(nle_inv_zero_dx … H) -m
98   @H1 -H1 #o #H elim (nlt_inv_zero_dx … H)
99 | /5 width=3 by nlt_le_trans, nle_inv_succ_bi/
100 ]
101 qed-.
102
103 (*** nat_elim1 *)
104 lemma nat_ind_lt (Q:predicate …):
105       (∀n. (∀m. m < n → Q m) → Q n) → ∀n. Q n.
106 /4 width=2 by nat_ind_lt_le/ qed-.