]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/ynat_le.ma
propagating the arithmetics library, partial commit
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / ynat_le.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 include "ground/arith/ynat_nat.ma".
17
18 (* ORDER FOR NON-NEGATIVE INTEGERS WITH INFINITY ****************************)
19
20 (*** yle *)
21 inductive yle: relation ynat ≝
22 | yle_inj: ∀m,n. m ≤ n → yle (yinj_nat m) (yinj_nat n)
23 | yle_inf: ∀x. yle x (∞)
24 .
25
26 interpretation
27   "less equal (non-negative integers with infinity)"
28   'leq x y = (yle x y).
29
30 (* Basic inversions *********************************************************)
31
32 (*** yle_inv_inj2 *)
33 lemma yle_inv_inj_dx (x) (n):
34       x ≤ yinj_nat n →
35       ∃∃m. m ≤ n & x = yinj_nat m.
36 #x #n0 @(insert_eq_1 … (yinj_nat n0))
37 #y #H elim H -x -y
38 [ #m #n #Hmn #H
39   lapply (eq_inv_yinj_nat_bi … H) -H #H destruct
40   /2 width=3 by ex2_intro/
41 | #x #H
42   elim (eq_inv_yinj_nat_inf … H)
43 ]
44 qed-.
45
46 (*** yle_inv_inj *)
47 lemma yle_inv_inj_bi (m) (n):
48       yinj_nat m ≤ yinj_nat n → m ≤ n.
49 #m #n #H
50 elim (yle_inv_inj_dx … H) -H #x #Hxn #H
51 lapply (eq_inv_yinj_nat_bi … H) -H #H destruct //
52 qed-.
53
54 (*** yle_inv_O2 *)
55 lemma yle_inv_zero_dx (x):
56       x ≤ 𝟎 → 𝟎 = x.
57 #x #H
58 elim (yle_inv_inj_dx ? (𝟎) H) -H #m #Hm #H destruct
59 <(nle_inv_zero_dx … Hm) -m //
60 qed-.
61
62 (*** yle_inv_Y1 *)
63 lemma yle_inv_inf_sn (y): ∞ ≤ y → ∞ = y.
64 #y @(insert_eq_1 … (∞))
65 #x #H elim H -x -y //
66 #m #n #_ #H
67 elim (eq_inv_inf_yinj_nat … H)
68 qed-.
69
70 (*** yle_antisym *)
71 lemma yle_antisym (x) (y):
72       x ≤ y → y ≤ x → x = y.
73 #x #y #H elim H -x -y
74 [ #m #n #Hmn #Hnm
75   <(nle_antisym … Hmn) -Hmn /2 width=1 by yle_inv_inj_bi/
76 | /2 width=1 by yle_inv_inf_sn/
77
78 qed-.
79
80 (* Basic constructions ******************************************************)
81
82 (*** le_O1 *)
83 lemma yle_zero_sn (y): 𝟎 ≤ y.
84 #y @(ynat_split_nat_inf … y) -y
85 /2 width=1 by yle_inj/
86 qed.
87
88 (*** yle_refl *)
89 lemma yle_refl: reflexive … yle.
90 #x @(ynat_split_nat_inf … x) -x
91 /2 width=1 by yle_inj, yle_inf, nle_refl/
92 qed.
93
94 (*** yle_split *)
95 lemma ynat_split_le_ge (x) (y):
96       ∨∨ x ≤ y | y ≤ x.
97 #x @(ynat_split_nat_inf … x) -x
98 [| /2 width=1 by or_intror/ ]
99 #m #y @(ynat_split_nat_inf … y) -y
100 [| /3 width=1 by yle_inf, or_introl/ ]
101 #n elim (nat_split_le_ge m n)
102 /3 width=1 by yle_inj, or_introl, or_intror/  
103 qed-.
104
105 (* Main constructions *******************************************************)
106
107 (*** yle_trans *)
108 theorem yle_trans: Transitive … yle.
109 #x #y * -x -y
110 [ #m #n #Hxy #z @(ynat_split_nat_inf … z) -z //
111   /4 width=3 by yle_inv_inj_bi, nle_trans, yle_inj/
112 | #x #z #H <(yle_inv_inf_sn … H) -H //
113 ]
114 qed-.