]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/nat_iter.ma
arithmetics for λδ
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / nat_iter.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "ground/arith/pnat_iter.ma".
16 include "ground/arith/nat.ma".
17
18 (* NON-NEGATIVE INTEGERS ****************************************************)
19
20 definition niter (n:nat) (A:Type[0]) (f:A→A) (a:A) ≝
21 match n with
22 [ nzero  ⇒ a
23 | ninj p ⇒ f^{A}p a
24 ]
25 .
26
27 interpretation
28   "iterated function (non-negative integers)"
29   'Exp A f n = (niter n A f).
30
31 (* Basic rewrites ***********************************************************)
32
33 lemma niter_zero (A) (f) (a): a = (f^{A}𝟎) a.
34 // qed.
35
36 lemma niter_inj (A) (f) (p) (a): f^p a = f^{A}(ninj p) a.
37 // qed.
38
39 (* Advanced rewrites ********************************************************)
40
41 lemma niter_appl (A) (f) (n) (a): f (f^n a) = f^{A}n (f a).
42 #A #f * //
43 #p #a <niter_inj <niter_inj <piter_appl //
44 qed.