1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| A.Asperti, C.Sacerdoti Coen, *)
8 (* ||A|| E.Tassi, S.Zacchiroli *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 include "nat/factorization.ma".
17 let rec times_f h g \def
19 [nf_last a \Rightarrow
21 [nf_last b \Rightarrow nf_last (S (a+b))
22 |nf_cons b g1 \Rightarrow nf_cons (S (a+b)) g1
24 |nf_cons a h1 \Rightarrow
26 [nf_last b \Rightarrow nf_cons (S (a+b)) h1
27 |nf_cons b g1 \Rightarrow nf_cons (a+b) (times_f h1 g1)
30 theorem eq_times_f_times1:\forall g,h,m. defactorize_aux (times_f g h) m
31 =defactorize_aux g m*defactorize_aux h m.
33 [elim h;simplify;autobatch
36 |simplify.rewrite > (H n3 (S m)).autobatch
41 (******************* times_fa *********************)
43 definition times_fa \def
46 [nfa_zero \Rightarrow nfa_zero
47 |nfa_one \Rightarrow g
48 |nfa_proper f1 \Rightarrow match g with
49 [nfa_zero \Rightarrow nfa_zero
50 |nfa_one \Rightarrow nfa_proper f1
51 |nfa_proper g1 \Rightarrow nfa_proper (times_f f1 g1)
54 theorem eq_times_fa_times: \forall f,g.
55 defactorize (times_fa f g) = defactorize f*defactorize g.
59 |simplify.apply plus_n_O
63 |apply eq_times_f_times1
67 theorem eq_times_times_fa: \forall n,m.
68 factorize (n*m) = times_fa (factorize n) (factorize m).
70 rewrite <(factorize_defactorize (times_fa (factorize n) (factorize m))).
71 rewrite > eq_times_fa_times.
72 rewrite > defactorize_factorize.
73 rewrite > defactorize_factorize.