]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/ynat/ynat_minus.ma
1110f3e44cdd72f41555d45a6c82e80cb99bf234
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / ynat / ynat_minus.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_2/ynat/ynat_lt.ma".
16
17 (* NATURAL NUMBERS WITH INFINITY ********************************************)
18
19 (* subtraction *)
20 definition yminus: ynat → ynat → ynat ≝ λx,y. match y with
21 [ yinj n ⇒ ypred^n x
22 | Y      ⇒ yinj 0
23 ].
24
25 interpretation "ynat minus" 'minus x y = (yminus x y).
26
27 (* Basic properties *********************************************************)
28
29 lemma yminus_inj: ∀n,m. yinj m - yinj n = yinj (m - n).
30 #n elim n -n /2 width=3 by trans_eq/
31 qed.
32
33 lemma yminus_Y_inj: ∀n. ∞ - yinj n = ∞.
34 #n elim n -n // normalize
35 #n #IHn >IHn //
36 qed.
37
38 (* Properties on successor **************************************************)
39
40 lemma yminus_succ: ∀n,m. ⫯m - ⫯n = m - n.
41 * // #n * [2: >yminus_Y_inj // ]
42 #m >yminus_inj //
43 qed. 
44
45 (* Properties on order ******************************************************)
46
47 lemma yle_minus_sn: ∀n,m. m - n ≤ m.
48 * // #n * /2 width=1 by yle_inj/
49 qed.
50
51 lemma yle_to_minus: ∀m:ynat. ∀n:ynat. m ≤ n → m - n = 0.
52 #m #n * -m -n /3 width=3 by eq_minus_O, eq_f/
53 qed-.
54
55 lemma yminus_to_le: ∀n:ynat. ∀m:ynat. m - n = 0 → m ≤ n.
56 * // #n *
57 [ #m >yminus_inj #H lapply (yinj_inj … H) -H (**) (* destruct lemma needed *)
58   /2 width=1 by yle_inj/
59 | >yminus_Y_inj #H destruct
60 ]
61 qed.