]> matita.cs.unibo.it Git - helm.git/blob - matita/library/nat/relevant_equations.ma
6e641708021d79d36c81b67283f889949e1fe43c
[helm.git] / matita / library / nat / relevant_equations.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/nat/relevant_equations".
16
17 include "nat/times.ma".
18 include "nat/minus.ma".
19 include "nat/gcd.ma". 
20 (* if gcd is compiled before this, the applys will take too much *)
21
22 theorem times_plus_l: \forall n,m,p:nat. (n+m)*p = n*p + m*p.
23 intros.
24 apply (trans_eq ? ? (p*(n+m))).
25 apply sym_times.
26 apply (trans_eq ? ? (p*n+p*m)).
27 apply distr_times_plus.
28 apply eq_f2.
29 apply sym_times.
30 apply sym_times.
31 qed.
32
33 theorem times_minus_l: \forall n,m,p:nat. (n-m)*p = n*p - m*p.
34 intros.
35 apply (trans_eq ? ? (p*(n-m))).
36 apply sym_times.
37 apply (trans_eq ? ? (p*n-p*m)).
38 apply distr_times_minus.
39 apply eq_f2.
40 apply sym_times.
41 apply sym_times.
42 qed.
43
44 theorem times_plus_plus: \forall n,m,p,q:nat. (n + m)*(p + q) =
45 n*p + n*q + m*p + m*q.
46 intros.
47 apply (trans_eq nat ? ((n*(p+q) + m*(p+q)))).
48 apply times_plus_l.
49 rewrite > distr_times_plus.
50 rewrite > distr_times_plus.
51 rewrite < assoc_plus.reflexivity.
52 qed.
53
54 theorem eq_pred_to_eq:
55  ∀n,m. O < n → O < m → pred n = pred m → n = m.
56 intros;
57 generalize in match (eq_f ? ? S ? ? H2);
58 intro;
59 rewrite < S_pred in H3;
60 rewrite < S_pred in H3;
61 assumption.
62 qed.