]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/syntax/path_height.ma
934df56d0dcce4c06942c958a004bc6090224d15
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / syntax / path_height.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/sharp_1.ma".
18
19 (* HEIGHT FOR PATH **********************************************************)
20
21 rec definition height (p) on p: nat ≝
22 match p with
23 [ list_empty     ⇒ 𝟎
24 | list_lcons l q ⇒
25   match l with
26   [ label_d k ⇒ height q + k
27   | label_m   ⇒ height q
28   | label_L   ⇒ height q
29   | label_A   ⇒ height q
30   | label_S   ⇒ height q
31   ]
32 ].
33
34 interpretation
35   "height (path)"
36   'Sharp p = (height p).
37
38 (* Basic constructions ******************************************************)
39
40 lemma height_empty: 𝟎 = ♯𝐞.
41 // qed.
42
43 lemma height_d_dx (p) (k:pnat):
44       (♯p)+k = ♯(p◖𝗱k).
45 // qed.
46
47 lemma height_m_dx (p):
48       (♯p) = ♯(p◖𝗺).
49 // qed.
50
51 lemma height_L_dx (p):
52       (♯p) = ♯(p◖𝗟).
53 // qed.
54
55 lemma height_A_dx (p):
56       (♯p) = ♯(p◖𝗔).
57 // qed.
58
59 lemma height_S_dx (p):
60       (♯p) = ♯(p◖𝗦).
61 // qed.
62
63 (* Main constructions *******************************************************)
64
65 theorem height_append (p) (q):
66         (♯p+♯q) = ♯(p●q).
67 #p #q elim q -q //
68 * [ #k ] #q #IH <list_append_lcons_sn
69 [ <height_d_dx <height_d_dx //
70 | <height_m_dx <height_m_dx //
71 | <height_L_dx <height_L_dx //
72 | <height_A_dx <height_A_dx //
73 | <height_S_dx <height_S_dx //
74 ]
75 qed.
76
77 (* Constructions with path_lcons ********************************************)
78
79 lemma height_d_sn (p) (k:pnat):
80       k+♯p = ♯(𝗱k◗p).
81 // qed.
82
83 lemma height_m_sn (p):
84       ♯p = ♯(𝗺◗p).
85 // qed.
86
87 lemma height_L_sn (p):
88       ♯p = ♯(𝗟◗p).
89 // qed.
90
91 lemma height_A_sn (p):
92       ♯p = ♯(𝗔◗p).
93 // qed.
94
95 lemma height_S_sn (p):
96       ♯p = ♯(𝗦◗p).
97 // qed.