]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/pnat_iter.ma
made executable again
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / pnat_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/notation/functions/exp_3.ma".
16 include "ground/lib/exteq.ma".
17 include "ground/arith/pnat.ma".
18
19 (* ITERATED FUNCTION FOR POSITIVE INTEGERS **********************************)
20
21 (* Note: see also: lib/arithemetics/bigops.ma *)
22 rec definition piter (p:pnat) (A:Type[0]) (f:A→A) (a:A) ≝
23 match p with
24 [ punit   ⇒ f a
25 | psucc q ⇒ f (piter q A f a)
26 ].
27
28 interpretation
29   "iterated function (positive integers)"
30   'Exp A f p = (piter p A f).
31
32 (* Basic constructions ******************************************************)
33
34 lemma piter_unit (A) (f): f ⊜ f^{A}𝟏.
35 // qed.
36
37 lemma piter_succ (A) (f) (p): f ∘ f^p ⊜ f^{A}(↑p).
38 // qed.
39
40 (* Advanced constructions ***************************************************)
41
42 lemma piter_appl (A) (f) (p): f ∘ f^p ⊜ f^{A}p ∘ f.
43 #A #f #p elim p -p //
44 #p #IH @exteq_repl
45 /3 width=5 by compose_repl_fwd_dx, compose_repl_fwd_sn, exteq_canc_dx/
46 qed.
47
48 lemma piter_compose (A) (B) (f) (g) (h) (p):
49       h ∘ f ⊜ g ∘ h → h ∘ (f^{A}p) ⊜ (g^{B}p) ∘ h.
50 #A #B #f #g #h #p elim p -p
51 [ #H @exteq_repl
52   /2 width=5 by compose_repl_fwd_sn, compose_repl_fwd_dx/
53 | #p #IH #H @exteq_repl
54   [4: @compose_repl_fwd_dx [| @piter_succ ]
55   |5: @compose_repl_fwd_sn [| @piter_succ ]
56   |1,2: skip
57   ]
58   @exteq_trans [2: @compose_assoc |1: skip ]
59   @exteq_trans [2: @(compose_repl_fwd_sn … H) | 1:skip ]
60   @exteq_canc_sn [2: @compose_assoc |1: skip ]
61   /3 width=1 by compose_repl_fwd_dx/
62 ]
63 qed.