1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/relocation/tr_uni_pap.ma".
16 include "delayed_updating/syntax/path.ma".
17 include "delayed_updating/notation/functions/black_downtriangle_4.ma".
18 include "delayed_updating/notation/functions/black_downtriangle_2.ma".
20 (* UNWIND FOR PATH **********************************************************)
22 definition unwind_continuation (A:Type[0]) ≝
25 rec definition unwind_gen (A:Type[0]) (k:unwind_continuation A) (f) (p) on p ≝
27 [ list_empty ⇒ k f (𝐞)
32 [ list_empty ⇒ unwind_gen (A) (λg,p. k g (𝗱(f@⧣❨n❩)◗p)) (𝐮❨f@⧣❨n❩❩) q
33 | list_lcons _ _ ⇒ unwind_gen (A) k (𝐮❨f@⧣❨n❩❩) q
35 | label_m ⇒ unwind_gen (A) k f q
36 | label_L ⇒ unwind_gen (A) (λg,p. k g (𝗟◗p)) (⫯f) q
37 | label_A ⇒ unwind_gen (A) (λg,p. k g (𝗔◗p)) f q
38 | label_S ⇒ unwind_gen (A) (λg,p. k g (𝗦◗p)) f q
44 'BlackDownTriangle A k f p = (unwind_gen A k f p).
46 definition proj_path: unwind_continuation … ≝
49 definition proj_rmap: unwind_continuation … ≝
54 'BlackDownTriangle f p = (unwind_gen ? proj_path f p).
57 "unwind (relocation map)"
58 'BlackDownTriangle p f = (unwind_gen ? proj_rmap f p).
60 (* Basic constructions ******************************************************)
62 lemma unwind_empty (A) (k) (f):
63 k f (𝐞) = ▼{A}❨k, f, 𝐞❩.
66 lemma unwind_d_empty (A) (k) (n) (f):
67 ▼❨(λg,p. k g (𝗱(f@⧣❨n❩)◗p)), 𝐮❨f@⧣❨n❩❩, 𝐞❩ = ▼{A}❨k, f, 𝗱n◗𝐞❩.
70 lemma unwind_d_lcons (A) (k) (p) (l) (n) (f):
71 ▼❨k, 𝐮❨f@⧣❨n❩❩, l◗p❩ = ▼{A}❨k, f, 𝗱n◗l◗p❩.
74 lemma unwind_m_sn (A) (k) (p) (f):
75 ▼❨k, f, p❩ = ▼{A}❨k, f, 𝗺◗p❩.
78 lemma unwind_L_sn (A) (k) (p) (f):
79 ▼❨(λg,p. k g (𝗟◗p)), ⫯f, p❩ = ▼{A}❨k, f, 𝗟◗p❩.
82 lemma unwind_A_sn (A) (k) (p) (f):
83 ▼❨(λg,p. k g (𝗔◗p)), f, p❩ = ▼{A}❨k, f, 𝗔◗p❩.
86 lemma unwind_S_sn (A) (k) (p) (f):
87 ▼❨(λg,p. k g (𝗦◗p)), f, p❩ = ▼{A}❨k, f, 𝗦◗p❩.
90 (* Basic constructions with proj_path ***************************************)
92 lemma unwind_path_empty (f):
96 lemma unwind_path_d_empty (f) (n):
97 𝗱(f@⧣❨n❩)◗𝐞 = ▼[f](𝗱n◗𝐞).
100 lemma unwind_path_d_lcons (f) (p) (l) (n):
101 ▼[𝐮❨f@⧣❨n❩❩](l◗p) = ▼[f](𝗱n◗l◗p).
104 lemma unwind_path_m_sn (f) (p):
108 (* Basic constructions with proj_rmap ***************************************)
110 lemma unwind_rmap_empty (f):
114 lemma unwind_rmap_d_sn (f) (p) (n):
115 ▼[p](𝐮❨f@⧣❨n❩❩) = ▼[𝗱n◗p]f.
118 lemma unwind_rmap_m_sn (f) (p):
122 lemma unwind_rmap_L_sn (f) (p):
126 lemma unwind_rmap_A_sn (f) (p):
130 lemma unwind_rmap_S_sn (f) (p):
134 (* Advanced constructions with proj_rmap and path_append ********************)
136 lemma unwind_rmap_append (p2) (p1) (f):
137 ▼[p2]▼[p1]f = ▼[p1●p2]f.
138 #p2 #p1 elim p1 -p1 // * [ #n ] #p1 #IH #f //
139 [ <unwind_rmap_m_sn <unwind_rmap_m_sn //
140 | <unwind_rmap_A_sn <unwind_rmap_A_sn //
141 | <unwind_rmap_S_sn <unwind_rmap_S_sn //
145 (* Advanced constructions with proj_rmap and path_rcons *********************)
147 lemma unwind_rmap_d_dx (f) (p) (n):
148 (𝐮❨(▼[p]f)@⧣❨n❩❩) = ▼[p◖𝗱n]f.
151 lemma unwind_rmap_m_dx (f) (p):
155 lemma unwind_rmap_L_dx (f) (p):
159 lemma unwind_rmap_A_dx (f) (p):
163 lemma unwind_rmap_S_dx (f) (p):
167 lemma unwind_rmap_pap_d_dx (f) (p) (n) (m):
168 ▼[p]f@⧣❨n❩+m = ▼[p◖𝗱n]f@⧣❨m❩.
170 <unwind_rmap_d_dx <tr_uni_pap <pplus_comm //
173 (* Advanced eliminations with path ******************************************)
175 lemma path_ind_unwind (Q:predicate …):
177 (∀n. Q (𝐞) → Q (𝗱n◗𝐞)) →
178 (∀n,l,p. Q (l◗p) → Q (𝗱n◗l◗p)) →
179 (∀p. Q p → Q (𝗺◗p)) →
180 (∀p. Q p → Q (𝗟◗p)) →
181 (∀p. Q p → Q (𝗔◗p)) →
182 (∀p. Q p → Q (𝗦◗p)) →
184 #Q #IH1 #IH2 #IH3 #IH4 #IH5 #IH6 #IH7 #p
185 elim p -p [| * [ #n * ] ]