]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/nat_iter.ma
milestone update in ground, partial commit
[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 (* ITERATED FUNCTION FOR NON-NEGATIVE INTEGERS ******************************)
19
20 (*** iter *)
21 definition niter (n:nat) (A:Type[0]) (f:A→A) (a:A) ≝
22 match n with
23 [ nzero  ⇒ a
24 | ninj p ⇒ f^{A}p a
25 ]
26 .
27
28 interpretation
29   "iterated function (non-negative integers)"
30   'Exp A f n = (niter n A f).
31
32 (* Basic constructions ******************************************************)
33
34 (*** iter_O *)
35 lemma niter_zero (A) (f) (a): a = (f^{A}𝟎) a.
36 // qed.
37
38 lemma niter_inj (A) (f) (p): f^p ≐ f^{A}(ninj p).
39 // qed.
40
41 (* Advanced constructions ***************************************************)
42
43 (*** iter_n_Sm *)
44 lemma niter_appl (A) (f) (n): f ∘ f^n ≐ f^{A}n ∘ f.
45 #A #f * //
46 #p @exteq_repl
47 /2 width=5 by piter_appl, compose_repl_fwd_dx/
48 qed.
49
50 lemma niter_compose (A) (B) (f) (g) (h) (n):
51       h ∘ f ≐ g ∘ h → h ∘ (f^{A}n) ≐ (g^{B}n) ∘ h.
52 #A #B #f #g #h * //
53 #p #H @exteq_repl
54 /2 width=5 by piter_compose, compose_repl_fwd_dx/
55 qed.