]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/substitution/lift.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / substitution / lift.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/relocation/tr_compose.ma".
16 include "ground/relocation/tr_uni.ma".
17 include "delayed_updating/syntax/path.ma".
18 include "delayed_updating/notation/functions/uparrow_4.ma".
19 include "delayed_updating/notation/functions/uparrow_2.ma".
20
21 (* LIFT FOR PATH ***********************************************************)
22
23 definition lift_continuation (A:Type[0]) ≝
24            tr_map → path → A.
25
26 (* Note: inner numeric labels are not liftable, so they are removed *)
27 rec definition lift_gen (A:Type[0]) (k:lift_continuation A) (f) (p) on p ≝
28 match p with
29 [ list_empty     ⇒ k f (𝐞)
30 | list_lcons l q ⇒
31   match l with
32   [ label_node_d n ⇒
33     match q with
34     [ list_empty     ⇒ lift_gen (A) (λg,p. k g (𝗱(f@❨n❩)◗p)) (f∘𝐮❨n❩) q
35     | list_lcons _ _ ⇒ lift_gen (A) k (f∘𝐮❨n❩) q
36     ]
37   | label_edge_L   ⇒ lift_gen (A) (λg,p. k g (𝗟◗p)) (⫯f) q
38   | label_edge_A   ⇒ lift_gen (A) (λg,p. k g (𝗔◗p)) f q
39   | label_edge_S   ⇒ lift_gen (A) (λg,p. k g (𝗦◗p)) f q
40   ]
41 ].
42
43 interpretation
44   "lift (gneric)"
45   'UpArrow A k f p = (lift_gen A k f p).
46
47 definition proj_path: lift_continuation … ≝
48            λf,p.p.
49
50 definition proj_rmap: lift_continuation … ≝
51            λf,p.f.
52
53 interpretation
54   "lift (path)"
55   'UpArrow f p = (lift_gen ? proj_path f p).
56
57 interpretation
58   "lift (relocation map)"
59   'UpArrow p f = (lift_gen ? proj_rmap f p).
60
61 (* Basic constructions ******************************************************)
62
63 lemma lift_empty (A) (k) (f):
64       k f (𝐞) = ↑{A}❨k, f, 𝐞❩.
65 // qed.
66
67 lemma lift_d_empty_sn (A) (k) (n) (f):
68       ↑❨(λg,p. k g (𝗱(f@❨n❩)◗p)), f∘𝐮❨ninj n❩, 𝐞❩ = ↑{A}❨k, f, 𝗱n◗𝐞❩.
69 // qed.
70
71 lemma lift_d_lcons_sn (A) (k) (p) (l) (n) (f):
72       ↑❨k, f∘𝐮❨ninj n❩, l◗p❩ = ↑{A}❨k, f, 𝗱n◗l◗p❩.
73 // qed.
74
75 lemma lift_L_sn (A) (k) (p) (f):
76       ↑❨(λg,p. k g (𝗟◗p)), ⫯f, p❩ = ↑{A}❨k, f, 𝗟◗p❩.
77 // qed.
78
79 lemma lift_A_sn (A) (k) (p) (f):
80       ↑❨(λg,p. k g (𝗔◗p)), f, p❩ = ↑{A}❨k, f, 𝗔◗p❩.
81 // qed.
82
83 lemma lift_S_sn (A) (k) (p) (f):
84       ↑❨(λg,p. k g (𝗦◗p)), f, p❩ = ↑{A}❨k, f, 𝗦◗p❩.
85 // qed.
86
87 (* Basic constructions with proj_path ***************************************)
88
89 lemma lift_path_empty (f):
90       (𝐞) = ↑[f]𝐞.
91 // qed.
92
93 lemma lift_path_d_empty_sn (f) (n):
94       𝗱(f@❨n❩)◗𝐞 = ↑[f](𝗱n◗𝐞).
95 // qed.
96
97 lemma lift_path_d_lcons_sn (f) (p) (l) (n):
98       ↑[f∘𝐮❨ninj n❩](l◗p) = ↑[f](𝗱n◗l◗p).
99 // qed.
100
101 (* Basic constructions with proj_rmap ***************************************)
102
103 lemma lift_rmap_d_sn (f) (p) (n):
104       ↑[p](f∘𝐮❨ninj n❩) = ↑[𝗱n◗p]f.
105 #f * // qed.
106
107 lemma lift_rmap_L_sn (f) (p):
108       ↑[p](⫯f) = ↑[𝗟◗p]f.
109 // qed.
110
111 lemma lift_rmap_A_sn (f) (p):
112       ↑[p]f = ↑[𝗔◗p]f.
113 // qed.
114
115 lemma lift_rmap_S_sn (f) (p):
116       ↑[p]f = ↑[𝗦◗p]f.
117 // qed.
118
119 (* Advanced constructions with proj_rmap and path_append ********************)
120
121 lemma lift_rmap_append (p2) (p1) (f):
122       ↑[p2]↑[p1]f = ↑[p1●p2]f.
123 #p2 #p1 elim p1 -p1 // * [ #n ] #p1 #IH #f //
124 [ <lift_rmap_A_sn <lift_rmap_A_sn //
125 | <lift_rmap_S_sn <lift_rmap_S_sn //
126 ]
127 qed.
128
129 (* Advanced eliminations with path ******************************************)
130
131 lemma path_ind_lift (Q:predicate …):
132       Q (𝐞) →
133       (∀n. Q (𝐞) → Q (𝗱n◗𝐞)) →
134       (∀n,l,p. Q (l◗p) → Q (𝗱n◗l◗p)) →
135       (∀p. Q p → Q (𝗟◗p)) →
136       (∀p. Q p → Q (𝗔◗p)) →
137       (∀p. Q p → Q (𝗦◗p)) →
138       ∀p. Q p.
139 #Q #IH1 #IH2 #IH3 #IH4 #IH5 #IH6 #p
140 elim p -p [| * [ #n * ] ]
141 /2 width=1 by/
142 qed-.