]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/pnat_plus.ma
update in ground
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / pnat_plus.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/arith/pnat_iter.ma".
16
17 (* ADDITION FOR POSITIVE INTEGERS *******************************************)
18
19 definition pplus: pnat → pnat → pnat ≝
20            λp,q. (psucc^q) p.
21
22 interpretation
23   "plus (positive integers)"
24   'plus p q = (pplus p q).
25
26 (* Basic constructions ******************************************************)
27
28 lemma pplus_unit_dx (p): ↑p = p + 𝟏.
29 // qed.
30
31 lemma pplus_succ_dx (p) (q): ↑(p+q) = p + ↑q.
32 // qed.
33
34 (* Advanced constructions (semigroup properties) ****************************)
35
36 lemma pplus_succ_sn (p) (q): ↑(p+q) = ↑p + q.
37 #p #q @(piter_appl … psucc)
38 qed.
39
40 lemma pplus_unit_sn (p): ↑p = 𝟏 + p.
41 #p elim p -p //
42 qed.
43
44 lemma pplus_comm: commutative … pplus.
45 #p elim p -p //
46 qed-. (* * gets in the way with auto *)
47
48 lemma pplus_assoc: associative … pplus.
49 #p #q #r elim r -r //
50 #r #IH <pplus_succ_dx <pplus_succ_dx <IH -IH //
51 qed.
52
53 (* Basic inversions *********************************************************)
54
55 lemma eq_inv_unit_pplus (p) (q): 𝟏 = p + q → ⊥.
56 #p #q elim q -q
57 [ <pplus_unit_dx #H destruct
58 | #q #_ <pplus_succ_dx #H destruct
59 ]
60 qed-.
61
62 lemma eq_inv_pplus_unit (p) (q):
63       p + q = 𝟏 → ⊥.
64 /2 width=3 by eq_inv_unit_pplus/ qed-.
65
66 lemma eq_inv_pplus_bi_dx (r) (p) (q): p + r = q + r → p = q.
67 #r elim r -r /3 width=1 by eq_inv_psucc_bi/
68 qed-.
69
70 lemma eq_inv_pplus_bi_sn (r) (p) (q): r + p = r + q → p = q.
71 #r #p #q <pplus_comm <pplus_comm in ⊢ (???%→?);
72 /2 width=2 by eq_inv_pplus_bi_dx/
73 qed-.