]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/library_auto/auto/nat/plus.ma
Preparing for 0.5.9 release.
[helm.git] / helm / software / 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 interpretation "natural plus" 'plus x y = (plus x y).
25
26 theorem plus_n_O: \forall n:nat. n = n+O.
27 intros.elim n
28 [ autobatch
29   (*simplify.
30   reflexivity*)
31 | autobatch
32   (*simplify.
33   apply eq_f.
34   assumption.*)
35 ]
36 qed.
37
38 theorem plus_n_Sm : \forall n,m:nat. S (n+m) = n+(S m).
39 intros.elim n
40 [ autobatch
41   (*simplify.
42   reflexivity.*)
43 | simplify.
44   autobatch
45   (*
46   apply eq_f.
47   assumption.*)]
48 qed.
49
50 theorem sym_plus: \forall n,m:nat. n+m = m+n.
51 intros.elim n
52 [ autobatch
53   (*simplify.
54   apply plus_n_O.*)
55 | simplify.
56   autobatch
57   (*rewrite > H.
58   apply plus_n_Sm.*)]
59 qed.
60
61 theorem associative_plus : associative nat plus.
62 unfold associative.intros.elim x
63 [autobatch
64  (*simplify.
65  reflexivity.*)
66 |simplify.
67  autobatch
68  (*apply eq_f.
69  assumption.*)
70 ]
71 qed.
72
73 theorem assoc_plus : \forall n,m,p:nat. (n+m)+p = n+(m+p)
74 \def associative_plus.
75
76 theorem injective_plus_r: \forall n:nat.injective nat nat (\lambda m.n+m).
77 intro.simplify.intros 2.elim n
78 [ exact H
79 | autobatch
80   (*apply H.apply inj_S.apply H1.*)
81 ]
82 qed.
83
84 theorem inj_plus_r: \forall p,n,m:nat. p+n = p+m \to n=m
85 \def injective_plus_r.
86
87 theorem injective_plus_l: \forall m:nat.injective nat nat (\lambda n.n+m).
88 intro.simplify.intros.autobatch.
89 (*apply (injective_plus_r m).
90 rewrite < sym_plus.
91 rewrite < (sym_plus y).
92 assumption.*)
93 qed.
94
95 theorem inj_plus_l: \forall p,n,m:nat. n+p = m+p \to n=m
96 \def injective_plus_l.