]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/nat.ma
arithmetics for λδ
[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 "zero (non-negative integers" 'Zero = nzero.
29
30 (* Basic inversions *********************************************************)
31
32 (* Note: destruct *)
33 lemma eq_inv_ninj_bi: injective … ninj.
34 #p #q #H destruct //
35 qed-.
36
37 (* Basic constructions ******************************************************)
38
39 lemma eq_nat_dec (n1,n2:nat): Decidable (n1 = n2).
40 * [| #p1 ] * [2,4: #p2 ]
41 [1,4: @or_intror #H destruct
42 | elim (eq_pnat_dec p1 p2)
43   /4 width=1 by eq_inv_ninj_bi, or_intror, or_introl/
44 | /2 width=1 by or_introl/
45 ]
46 qed-.