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