]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/library/nat/sigma_and_pi.ma
New entry: fermat's little theorem (almost complete).
[helm.git] / helm / matita / library / nat / sigma_and_pi.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 (*       \ /        Matita 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/sigma_and_pi".
16
17 include "nat/factorial.ma".
18 include "nat/lt_arith.ma".
19
20 let rec sigma n f \def
21   match n with 
22   [ O \Rightarrow O
23   | (S p) \Rightarrow (f p)+(sigma p f)].
24
25 let rec pi n f \def
26   match n with 
27   [ O \Rightarrow (S O)
28   | (S p) \Rightarrow (f p)*(pi p f)].
29   
30 theorem eq_sigma: \forall f,g:nat \to nat.
31 \forall n:nat. (\forall m:nat. m < n \to f m = g m) \to
32 (sigma n f) = (sigma n g).
33 intros 3.elim n.
34 simplify.reflexivity.
35 simplify.
36 apply eq_f2.apply H1.simplify. apply le_n.
37 apply H.intros.apply H1.
38 apply trans_lt ? n1.assumption.simplify.apply le_n.
39 qed.
40
41 theorem eq_pi: \forall f,g:nat \to nat.
42 \forall n:nat. (\forall m:nat. m < n \to f m = g m) \to
43 (pi n f) = (pi n g).
44 intros 3.elim n.
45 simplify.reflexivity.
46 simplify.
47 apply eq_f2.apply H1.simplify. apply le_n.
48 apply H.intros.apply H1.
49 apply trans_lt ? n1.assumption.simplify.apply le_n.
50 qed.
51
52 theorem eq_fact_pi: \forall n. n! = pi n S.
53 intro.elim n.
54 simplify.reflexivity.
55 change with (S n1)*n1! = (S n1)*(pi n1 S).
56 apply eq_f.assumption.
57 qed.