]> matita.cs.unibo.it Git - helm.git/blob - matita/contribs/library_auto/auto/nat/plus.ma
tagged 0.5.0-rc1
[helm.git] / matita / contribs / library_auto / auto / nat / plus.ma
1 (**************************************************************************)
2 (*       ___                                                                *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||       A.Asperti, C.Sacerdoti Coen,                          *)
8 (*      ||A||       E.Tassi, S.Zacchiroli                                 *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU Lesser General Public License Version 2.1         *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/library_autobatch/nat/plus".
16
17 include "auto/nat/nat.ma".
18
19 let rec plus n m \def 
20  match n with 
21  [ O \Rightarrow m
22  | (S p) \Rightarrow S (plus p m) ].
23
24 (*CSC: the URI must disappear: there is a bug now *)
25 interpretation "natural plus" 'plus x y = (cic:/matita/library_autobatch/nat/plus/plus.con x y).
26
27 theorem plus_n_O: \forall n:nat. n = n+O.
28 intros.elim n
29 [ autobatch
30   (*simplify.
31   reflexivity*)
32 | autobatch
33   (*simplify.
34   apply eq_f.
35   assumption.*)
36 ]
37 qed.
38
39 theorem plus_n_Sm : \forall n,m:nat. S (n+m) = n+(S m).
40 intros.elim n
41 [ autobatch
42   (*simplify.
43   reflexivity.*)
44 | simplify.
45   autobatch
46   (*
47   apply eq_f.
48   assumption.*)]
49 qed.
50
51 theorem sym_plus: \forall n,m:nat. n+m = m+n.
52 intros.elim n
53 [ autobatch
54   (*simplify.
55   apply plus_n_O.*)
56 | simplify.
57   autobatch
58   (*rewrite > H.
59   apply plus_n_Sm.*)]
60 qed.
61
62 theorem associative_plus : associative nat plus.
63 unfold associative.intros.elim x
64 [autobatch
65  (*simplify.
66  reflexivity.*)
67 |simplify.
68  autobatch
69  (*apply eq_f.
70  assumption.*)
71 ]
72 qed.
73
74 theorem assoc_plus : \forall n,m,p:nat. (n+m)+p = n+(m+p)
75 \def associative_plus.
76
77 theorem injective_plus_r: \forall n:nat.injective nat nat (\lambda m.n+m).
78 intro.simplify.intros 2.elim n
79 [ exact H
80 | autobatch
81   (*apply H.apply inj_S.apply H1.*)
82 ]
83 qed.
84
85 theorem inj_plus_r: \forall p,n,m:nat. p+n = p+m \to n=m
86 \def injective_plus_r.
87
88 theorem injective_plus_l: \forall m:nat.injective nat nat (\lambda n.n+m).
89 intro.simplify.intros.autobatch.
90 (*apply (injective_plus_r m).
91 rewrite < sym_plus.
92 rewrite < (sym_plus y).
93 assumption.*)
94 qed.
95
96 theorem inj_plus_l: \forall p,n,m:nat. n+p = m+p \to n=m
97 \def injective_plus_l.