]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/pnat.ma
arithmetics for λδ
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / pnat.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/one_0.ma".
16 include "ground/notation/functions/uparrow_1.ma".
17 include "ground/lib/relations.ma".
18
19 (* POSITIVE INTEGERS ********************************************************)
20
21 inductive pnat: Type[0] ≝
22 | punit: pnat
23 | psucc: pnat → pnat
24 .
25
26 interpretation
27   "unit (positive integers)"
28   'One = (punit).
29
30 interpretation
31   "successor (positive integers)"
32   'UpArrow p = (psucc p).
33
34 (* Basic inversions *********************************************************)
35
36 (* Note: destruct *)
37 lemma eq_inv_psucc_bi: injective … psucc.
38 #p #q #H destruct //
39 qed.
40
41 (* Basic constructions ******************************************************)
42
43 lemma eq_pnat_dec (p1,p2:pnat): Decidable (p1 = p2).
44 #p1 elim p1 -p1 [| #p1 #IH ] * [2,4: #p2 ]
45 [1,4: @or_intror #H destruct
46 | elim (IH p2) -IH #H destruct
47   /4 width=1 by eq_inv_psucc_bi, or_intror, or_introl/
48 | /2 width=1 by or_introl/
49 ]
50 qed-.