1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/RELATIONAL/NPlus/props".
17 include "NPlus/fwd.ma".
19 theorem nplus_zero_1: \forall q. zero + q == q.
20 intros. elim q; clear q; auto.
23 theorem nplus_succ_1: \forall p,q,r. NPlus p q r \to
24 (succ p) + q == (succ r).
25 intros 2. elim q; clear q;
26 [ lapply linear nplus_gen_zero_2 to H as H0.
28 | lapply linear nplus_gen_succ_2 to H1 as H0.
34 theorem nplus_sym: \forall p,q,r. (p + q == r) \to q + p == r.
35 intros 2. elim q; clear q;
36 [ lapply linear nplus_gen_zero_2 to H as H0.
38 | lapply linear nplus_gen_succ_2 to H1 as H0.
44 theorem nplus_shift_succ_sx: \forall p,q,r.
45 (p + (succ q) == r) \to (succ p) + q == r.
47 lapply linear nplus_gen_succ_2 to H as H0.
48 decompose. subst. auto.
51 theorem nplus_shift_succ_dx: \forall p,q,r.
52 ((succ p) + q == r) \to p + (succ q) == r.
54 lapply linear nplus_gen_succ_1 to H as H0.
55 decompose. subst. auto.
58 theorem nplus_trans_1: \forall p,q1,r1. (p + q1 == r1) \to
59 \forall q2,r2. (r1 + q2 == r2) \to
60 \exists q. (q1 + q2 == q) \land p + q == r2.
61 intros 2; elim q1; clear q1; intros;
62 [ lapply linear nplus_gen_zero_2 to H as H0.
64 | lapply linear nplus_gen_succ_2 to H1 as H0.
66 lapply linear nplus_gen_succ_1 to H2 as H0.
68 lapply linear H to H4, H3 as H0.
70 ]; apply ex_intro; [| auto || auto ]. (**)
73 theorem nplus_trans_2: \forall p1,q,r1. (p1 + q == r1) \to
74 \forall p2,r2. (p2 + r1 == r2) \to
75 \exists p. (p1 + p2 == p) \land p + q == r2.
76 intros 2; elim q; clear q; intros;
77 [ lapply linear nplus_gen_zero_2 to H as H0.
79 | lapply linear nplus_gen_succ_2 to H1 as H0.
81 lapply linear nplus_gen_succ_2 to H2 as H0.
83 lapply linear H to H4, H3 as H0.
85 ]; apply ex_intro; [| auto || auto ]. (**)
88 theorem nplus_conf: \forall p,q,r1. (p + q == r1) \to
89 \forall r2. (p + q == r2) \to r1 = r2.
90 intros 2. elim q; clear q; intros;
91 [ lapply linear nplus_gen_zero_2 to H as H0.
93 | lapply linear nplus_gen_succ_2 to H1 as H0.
95 lapply linear nplus_gen_succ_2 to H2 as H0.