]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/syntax/path_update.ma
1f629f709b3b945f5b96a4f8dc071de8fc76249d
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / syntax / path_update.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/nat_plus.ma".
16 include "delayed_updating/syntax/path.ma".
17 include "delayed_updating/notation/functions/hash_1.ma".
18
19 (* UPDATE COUNT FOR PATH ****************************************************)
20
21 rec definition update (p) on p: nat ≝
22 match p with
23 [ list_empty     ⇒ 𝟎
24 | list_lcons l q ⇒
25   match l with
26   [ label_d n ⇒ n + update q
27   | label_m   ⇒ update q
28   | label_L   ⇒ update q
29   | label_A   ⇒ update q
30   | label_S   ⇒ update q
31   ]
32 ].
33
34 interpretation
35   "update count (path)"
36   'Hash p = (update p).
37
38 (* Basic constructions ******************************************************)
39
40 lemma update_empty: 𝟎 = ⧣𝐞.
41 // qed.
42
43 lemma update_d_sn (q) (n): ninj n+⧣q = ⧣(𝗱n◗q).
44 // qed.
45
46 lemma update_m_sn (q): ⧣q = ⧣(𝗺◗q).
47 // qed.
48
49 lemma update_L_sn (q): ⧣q = ⧣(𝗟◗q).
50 // qed.
51
52 lemma update_A_sn (q): ⧣q = ⧣(𝗔◗q).
53 // qed.
54
55 lemma update_S_sn (q): ⧣q = ⧣(𝗦◗q).
56 // qed.
57
58 (* Main constructions *******************************************************)
59
60 theorem update_append (p1) (p2):
61         (⧣p2+⧣p1) = ⧣(p1●p2).
62 #p1 elim p1 -p1 //
63 * [ #n ] #p1 #IH #p2 <list_append_lcons_sn
64 [ <update_d_sn <update_d_sn //
65 | <update_m_sn <update_m_sn //
66 | <update_L_sn <update_L_sn //
67 | <update_A_sn <update_A_sn //
68 | <update_S_sn <update_S_sn //
69 ]
70 qed.
71
72 (* Constructions with list_rcons ********************************************)
73
74 lemma update_d_dx (p) (n):
75       (⧣p)+(ninj n) = ⧣(p◖𝗱n).
76 // qed.
77
78 lemma update_m_dx (p):
79       (⧣p) = ⧣(p◖𝗺).
80 // qed.
81
82 lemma update_L_dx (p):
83       (⧣p) = ⧣(p◖𝗟).
84 // qed.
85
86 lemma update_A_dx (p):
87       (⧣p) = ⧣(p◖𝗔).
88 // qed.
89
90 lemma update_S_dx (p):
91       (⧣p) = ⧣(p◖𝗦).
92 // qed.