]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/nat.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / nat.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/notation/functions/zero_0.ma".
16 include "ground/arith/pnat.ma".
17
18 (* NON-NEGATIVE INTEGERS ****************************************************)
19
20 (*** nat *)
21 inductive nat: Type[0] ≝
22 | nzero: nat
23 | ninj : pnat → nat
24 .
25
26 coercion ninj.
27
28 interpretation
29   "zero (non-negative integers)"
30   'Zero = nzero.
31
32 (* Basic inversions *********************************************************)
33
34 (* Note: destruct *)
35 lemma eq_inv_ninj_bi: injective … ninj.
36 #p #q #H destruct //
37 qed-.
38
39 (* Basic constructions ******************************************************)
40
41 (*** eq_nat_dec *)
42 lemma eq_nat_dec (n1,n2:nat): Decidable (n1 = n2).
43 * [| #p1 ] * [2,4: #p2 ]
44 [1,4: @or_intror #H destruct
45 | elim (eq_pnat_dec p1 p2)
46   /4 width=1 by eq_inv_ninj_bi, or_intror, or_introl/
47 | /2 width=1 by or_introl/
48 ]
49 qed-.