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 (* \ / Matita is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 include "nat/primes.ma".
16 include "Z/sigma_p.ma".
19 definition dirichlet_product : (nat \to Z) \to (nat \to Z) \to nat \to Z \def
20 \lambda f,g.\lambda n.
22 (\lambda d.divides_b d n) (\lambda d. (f d)*(g (div n d))).
24 (* dirichlet_product is associative only up to extensional equality *)
25 theorem associative_dirichlet_product:
26 \forall f,g,h:nat\to Z.\forall n:nat.O < n \to
27 dirichlet_product (dirichlet_product f g) h n
28 = dirichlet_product f (dirichlet_product g h) n.
30 unfold dirichlet_product.
31 unfold dirichlet_product.
33 (sigma_p (S n) (\lambda d:nat.divides_b d n)
35 .sigma_p (S n) (\lambda d1:nat.divides_b d1 d) (\lambda d1:nat.f d1*g (d/d1)*h (n/d)))))
40 (sigma_p (S x) (\lambda d1:nat.divides_b d1 x) (\lambda d1:nat.f d1*g (x/d1)*h (n/x))))
41 [apply Ztimes_sigma_pr
42 |(* hint solleva unification uncertain ?? *)
44 apply false_to_eq_sigma_p
47 apply not_divides_to_divides_b_false
48 [apply (lt_to_le_to_lt ? (S x))
49 [apply lt_O_S|assumption]
51 apply (lt_to_not_le ? ? H3).
53 [apply (divides_b_true_to_lt_O ? ? H H2).
61 (sigma_p (S n) (\lambda d:nat.divides_b d n)
63 .sigma_p (S n) (\lambda d1:nat.divides_b d1 (n/d))
64 (\lambda d1:nat.f d*g d1*h ((n/d)/d1)))))
66 (sigma_p (S n) (\lambda d:nat.divides_b d n)
68 .sigma_p (S n) (\lambda d1:nat.divides_b d1 (n/d))
69 (\lambda d1:nat.f d*g ((times d d1)/d)*h ((n/times d d1))))))
71 (\lambda d,d1.f d1*g (d/d1)*h (n/d))
72 (\lambda d,d1:nat.times d d1)
75 (\lambda d,d1:nat.d/d1)
82 (\lambda d,d1:nat.divides_b d1 d)
83 (\lambda d,d1:nat.divides_b d1 (n/d))
91 [apply divides_to_divides_b_true1
93 |apply (witness ? ? ((n/i)/j)).
94 rewrite > assoc_times.
95 rewrite > sym_times in \vdash (? ? ? (? ? %)).
96 rewrite > divides_to_div
98 rewrite > divides_to_div
100 |apply divides_b_true_to_divides.
103 |apply divides_b_true_to_divides.
107 |apply divides_to_divides_b_true
108 [apply (divides_b_true_to_lt_O ? ? H H3)
109 |apply (witness ? ? j).
115 |rewrite < sym_times.
116 rewrite > (plus_n_O (j*i)).
117 apply div_plus_times.
118 apply (divides_b_true_to_lt_O ? ? H H3)
120 |apply (le_to_lt_to_lt ? (i*(n/i)))
124 [elim (le_to_or_lt_eq ? ? (le_O_n (n/i)))
127 apply (lt_to_not_le ? ? H).
128 rewrite < (divides_to_div i n)
131 |apply divides_b_true_to_divides.
135 |apply divides_b_true_to_divides.
139 |rewrite < sym_times.
140 rewrite > divides_to_div
142 |apply divides_b_true_to_divides.
155 [apply divides_to_divides_b_true1
157 |apply (transitive_divides ? i)
158 [apply divides_b_true_to_divides.
160 |apply divides_b_true_to_divides.
164 |apply divides_to_divides_b_true
165 [apply (divides_b_true_to_lt_O i (i/j))
166 [apply (divides_b_true_to_lt_O ? ? ? H3).
168 |apply divides_to_divides_b_true1
169 [apply (divides_b_true_to_lt_O ? ? ? H3).
171 |apply (witness ? ? j).
173 apply divides_to_div.
174 apply divides_b_true_to_divides.
178 |apply (witness ? ? (n/i)).
179 apply (inj_times_l1 j)
180 [apply (divides_b_true_to_lt_O ? ? ? H4).
181 apply (divides_b_true_to_lt_O ? ? ? H3).
183 |rewrite > divides_to_div
184 [rewrite > sym_times in \vdash (? ? ? (? % ?)).
185 rewrite > assoc_times.
186 rewrite > divides_to_div
187 [rewrite > divides_to_div
189 |apply divides_b_true_to_divides.
192 |apply divides_b_true_to_divides.
195 |apply (transitive_divides ? i)
196 [apply divides_b_true_to_divides.
198 |apply divides_b_true_to_divides.
205 |rewrite < sym_times.
206 apply divides_to_div.
207 apply divides_b_true_to_divides.
214 |apply (le_to_lt_to_lt ? i)
216 apply (divides_b_true_to_lt_O ? ? ? H4).
217 apply (divides_b_true_to_lt_O ? ? ? H3).
234 rewrite > (plus_n_O (x1*x)).
235 apply div_plus_times.
236 apply (divides_b_true_to_lt_O ? ? ? H2).
242 [apply (inj_times_l1 (x*x1))
243 [rewrite > (times_n_O O).
244 apply lt_times;assumption
245 |rewrite > divides_to_div
246 [rewrite > sym_times in \vdash (? ? ? (? ? %)).
247 rewrite < assoc_times.
248 rewrite > divides_to_div
249 [rewrite > divides_to_div
251 |apply divides_b_true_to_divides.
254 |apply divides_b_true_to_divides.
257 |elim (divides_b_true_to_divides ? ? H4).
258 apply (witness ? ? n1).
259 rewrite > assoc_times.
263 apply divides_to_div.
264 apply divides_b_true_to_divides.
268 |apply (divides_b_true_to_lt_O ? ? ? H4).
269 apply (lt_times_n_to_lt x)
272 rewrite > divides_to_div
274 |apply (divides_b_true_to_divides ? ? H2).
279 |apply (divides_b_true_to_lt_O ? ? ? H2).
290 (sigma_p (S n) (\lambda d1:nat.divides_b d1 (n/x)) (\lambda d1:nat.f x*(g d1*h (n/x/d1)))))
293 |intros.apply assoc_Ztimes
296 (sigma_p (S (n/x)) (\lambda d1:nat.divides_b d1 (n/x)) (\lambda d1:nat.f x*(g d1*h (n/x/d1)))))
297 [apply false_to_eq_sigma_p
300 [apply (le_times_to_le x)
302 |rewrite > sym_times.
303 rewrite > divides_to_div
306 |apply divides_b_true_to_divides.
310 |apply (divides_b_true_to_lt_O ? ? ? H2).
314 apply not_divides_to_divides_b_false
315 [apply (trans_le ? ? ? ? H3).
319 apply (le_to_not_lt ? ? H3).
322 [apply (lt_times_n_to_lt x)
323 [apply (divides_b_true_to_lt_O ? ? ? H2).
326 rewrite > divides_to_div
328 |apply (divides_b_true_to_divides ? ? H2).
337 apply Ztimes_sigma_pl
345 definition is_one: nat \to Z \def
351 [ O \Rightarrow pos O
352 | (S q) \Rightarrow OZ]]
355 theorem is_one_OZ: \forall n. n \neq S O \to is_one n = OZ.
356 intro.apply (nat_case n)
358 |intro. apply (nat_case m)
359 [intro.apply False_ind.apply H.reflexivity
366 \forall p: nat \to bool.\forall n.sigma_p n p (\lambda m.OZ) = OZ.
369 |apply (bool_elim ? (p n1));intro
370 [rewrite > true_to_sigma_p_Sn
371 [rewrite > sym_Zplus.
372 rewrite > Zplus_z_OZ.
376 |rewrite > false_to_sigma_p_Sn
384 theorem dirichlet_product_is_one_r:
385 \forall f:nat\to Z.\forall n:nat.
386 dirichlet_product f is_one n = f n.
389 [unfold dirichlet_product.
390 rewrite > true_to_sigma_p_Sn
391 [rewrite > Ztimes_Zone_r.
392 rewrite > Zplus_z_OZ.
396 |unfold dirichlet_product.
397 rewrite > true_to_sigma_p_Sn
399 [rewrite > Ztimes_Zone_r.
400 rewrite < Zplus_z_OZ in \vdash (? ? ? %).
403 |apply (trans_eq ? ? (sigma_p (S n1)
404 (\lambda d:nat.divides_b d (S n1)) (\lambda d:nat.OZ)))
405 [apply eq_sigma_p1;intros
410 apply (lt_to_not_le ? ? H1).
411 rewrite > (times_n_SO x).
414 rewrite > (div_mod ? x) in \vdash (? % ?)
415 [rewrite > divides_to_mod_O
418 |apply (divides_b_true_to_lt_O ? ? ? H2).
420 |apply divides_b_true_to_divides.
423 |apply (divides_b_true_to_lt_O ? ? ? H2).
433 |apply divides_to_divides_b_true
441 theorem commutative_dirichlet_product: \forall f,g:nat \to Z.\forall n. O < n \to
442 dirichlet_product f g n = dirichlet_product g f n.
444 unfold dirichlet_product.
446 (sigma_p (S n) (\lambda d:nat.divides_b d n)
447 (\lambda d:nat.g (n/d) * f (n/(n/d)))))
448 [apply eq_sigma_p1;intros
453 |apply divides_b_true_to_divides.
457 |apply (eq_sigma_p_gh ? (\lambda d.(n/d)) (\lambda d.(n/d)))
459 apply divides_b_div_true;assumption
463 |apply divides_b_true_to_divides.
469 apply (divides_b_true_to_lt_O ? ? H H2)
471 apply divides_b_div_true;assumption
475 |apply divides_b_true_to_divides.
481 apply (divides_b_true_to_lt_O ? ? H H2)
486 theorem dirichlet_product_is_one_l:
487 \forall f:nat\to Z.\forall n:nat.
488 O < n \to dirichlet_product is_one f n = f n.
490 rewrite > commutative_dirichlet_product.
491 apply dirichlet_product_is_one_r.
495 theorem dirichlet_product_one_r:
496 \forall f:nat\to Z.\forall n:nat. O < n \to
497 dirichlet_product f (\lambda n.Zone) n =
498 sigma_p (S n) (\lambda d.divides_b d n) f.
500 unfold dirichlet_product.
501 apply eq_sigma_p;intros
503 |simplify in \vdash (? ? (? ? %) ?).
508 theorem dirichlet_product_one_l:
509 \forall f:nat\to Z.\forall n:nat. O < n \to
510 dirichlet_product (\lambda n.Zone) f n =
511 sigma_p (S n) (\lambda d.divides_b d n) f.
513 rewrite > commutative_dirichlet_product
514 [apply dirichlet_product_one_r.