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_2/ynat/ynat_succ.ma".
17 (* NATURAL NUMBERS WITH INFINITY ********************************************)
20 inductive yle: relation ynat ≝
21 | yle_inj: ∀m,n. m ≤ n → yle m n
22 | yle_Y : ∀m. yle m (∞)
25 interpretation "ynat 'less or equal to'" 'leq x y = (yle x y).
27 (* Basic inversion lemmas ***************************************************)
29 fact yle_inv_inj2_aux: ∀x,y. x ≤ y → ∀n. y = yinj n →
30 ∃∃m. m ≤ n & x = yinj m.
32 [ #x #y #Hxy #n #Hy destruct /2 width=3 by ex2_intro/
37 lemma yle_inv_inj2: ∀x,n. x ≤ yinj n → ∃∃m. m ≤ n & x = yinj m.
38 /2 width=3 by yle_inv_inj2_aux/ qed-.
40 lemma yle_inv_inj: ∀m,n. yinj m ≤ yinj n → m ≤ n.
41 #m #n #H elim (yle_inv_inj2 … H) -H
42 #x #Hxn #H destruct //
45 fact yle_inv_O2_aux: ∀m:ynat. ∀x:ynat. m ≤ x → x = 0 → m = 0.
47 [ #m #n #Hmn #H destruct /3 width=1 by le_n_O_to_eq, eq_f/
52 lemma yle_inv_O2: ∀m:ynat. m ≤ 0 → m = 0.
53 /2 width =3 by yle_inv_O2_aux/ qed-.
55 fact yle_inv_Y1_aux: ∀x,n. x ≤ n → x = ∞ → n = ∞.
60 lemma yle_inv_Y1: ∀n. ∞ ≤ n → n = ∞.
61 /2 width=3 by yle_inv_Y1_aux/ qed-.
63 (* Inversion lemmas on successor ********************************************)
65 fact yle_inv_succ1_aux: ∀x,y. x ≤ y → ∀m. x = ⫯m → ∃∃n. m ≤ n & y = ⫯n.
67 [ #x #y #Hxy #m #H elim (ysucc_inv_inj_sn … H) -H
68 #n #H1 #H2 destruct elim (le_inv_S1 … Hxy) -Hxy
70 @(ex2_intro … m) /2 width=1 by yle_inj/ (**) (* explicit constructor *)
72 @(ex2_intro … (∞)) /2 width=1 by yle_Y/ (**) (* explicit constructor *)
76 lemma yle_inv_succ1: ∀m,y. ⫯m ≤ y → ∃∃n. m ≤ n & y = ⫯n.
77 /2 width=3 by yle_inv_succ1_aux/ qed-.
79 lemma yle_inv_succ: ∀m,n. ⫯m ≤ ⫯n → m ≤ n.
80 #m #n #H elim (yle_inv_succ1 … H) -H
84 (* Basic properties *********************************************************)
86 lemma yle_refl: reflexive … yle.
87 * /2 width=1 by le_n, yle_inj/
90 (* Properties on predecessor ************************************************)
92 lemma yle_pred_sn: ∀m,n. m ≤ n → ⫰m ≤ n.
93 #m #n * -m -n /3 width=3 by transitive_le, yle_inj/
96 lemma yle_refl_pred_sn: ∀x. ⫰x ≤ x.
97 /2 width=1 by yle_refl, yle_pred_sn/ qed.
99 (* Properties on successor **************************************************)
101 lemma yle_succ_dx: ∀m,n. m ≤ n → m ≤ ⫯n.
102 #m #n * -m -n /3 width=1 by le_S, yle_inj/
105 lemma yle_refl_S_dx: ∀x. x ≤ ⫯x.
106 /2 width=1 by yle_refl, yle_succ_dx/ qed.
108 (* Main properties **********************************************************)
110 theorem yle_trans: Transitive … yle.
113 #z #H lapply (yle_inv_inj … H) -H
114 /3 width=3 by transitive_le, yle_inj/ (**) (* full auto too slow *)
115 | #x #z #H lapply (yle_inv_Y1 … H) //