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 "delayed_updating/syntax/path.ma".
16 include "delayed_updating/notation/functions/circled_times_1.ma".
17 include "ground/xoa/ex_3_2.ma".
19 (* STRUCTURE FOR PATH *******************************************************)
21 rec definition structure (p) on p ≝
26 [ label_d k ⇒ structure q
27 | label_d2 k d ⇒ structure q
28 | label_m ⇒ structure q
29 | label_L ⇒ (structure q)◖𝗟
30 | label_A ⇒ (structure q)◖𝗔
31 | label_S ⇒ (structure q)◖𝗦
37 'CircledTimes p = (structure p).
39 (* Basic constructions ******************************************************)
41 lemma structure_empty:
45 lemma structure_d_dx (p) (k):
49 lemma structure_d2_dx (p) (k) (d):
53 lemma structure_m_dx (p):
57 lemma structure_L_dx (p):
61 lemma structure_A_dx (p):
65 lemma structure_S_dx (p):
69 (* Main constructions *******************************************************)
71 theorem structure_idem (p):
74 * [ #k | #k #d ] #p #IH //
77 theorem structure_append (p) (q):
80 * [ #k | #k #d ] #q #IH //
81 <list_append_lcons_sn //
84 (* Constructions with path_lcons ********************************************)
86 lemma structure_d_sn (p) (k):
88 #p #k <structure_append //
91 lemma structure_d2_sn (p) (k) (d):
93 #p #k #d <structure_append //
96 lemma structure_m_sn (p):
98 #p <structure_append //
101 lemma structure_L_sn (p):
103 #p <structure_append //
106 lemma structure_A_sn (p):
108 #p <structure_append //
111 lemma structure_S_sn (p):
113 #p <structure_append //
116 (* Basic inversions *********************************************************)
118 lemma eq_inv_d_dx_structure (h) (q) (p):
120 #h #q #p elim p -p [| * [ #k | #k #d ] #p #IH ]
121 [ <structure_empty #H0 destruct
122 | <structure_d_dx #H0 /2 width=1 by/
123 | <structure_d2_dx #H0 /2 width=1 by/
124 | <structure_m_dx #H0 /2 width=1 by/
125 | <structure_L_dx #H0 destruct
126 | <structure_A_dx #H0 destruct
127 | <structure_S_dx #H0 destruct
131 lemma eq_inv_d2_dx_structure (d) (h) (q) (p):
133 #d #h #q #p elim p -p [| * [ #k | #k #d ] #p #IH ]
134 [ <structure_empty #H0 destruct
135 | <structure_d_dx #H0 /2 width=1 by/
136 | <structure_d2_dx #H0 /2 width=1 by/
137 | <structure_m_dx #H0 /2 width=1 by/
138 | <structure_L_dx #H0 destruct
139 | <structure_A_dx #H0 destruct
140 | <structure_S_dx #H0 destruct
144 lemma eq_inv_m_dx_structure (q) (p):
146 #q #p elim p -p [| * [ #k | #k #d ] #p #IH ]
147 [ <structure_empty #H0 destruct
148 | <structure_d_dx #H0 /2 width=1 by/
149 | <structure_d2_dx #H0 /2 width=1 by/
150 | <structure_m_dx #H0 /2 width=1 by/
151 | <structure_L_dx #H0 destruct
152 | <structure_A_dx #H0 destruct
153 | <structure_S_dx #H0 destruct
157 lemma eq_inv_L_dx_structure (q) (p):
159 ∃∃r1,r2. q = ⊗r1 & 𝐞 = ⊗r2 & r1●𝗟◗r2 = p.
160 #q #p elim p -p [| * [ #k | #k #d ] #p #IH ]
161 [ <structure_empty #H0 destruct
162 | <structure_d_dx #H0
163 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
164 /2 width=5 by ex3_2_intro/
165 | <structure_d2_dx #H0
166 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
167 /2 width=5 by ex3_2_intro/
168 | <structure_m_dx #H0
169 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
170 /2 width=5 by ex3_2_intro/
171 | <structure_L_dx #H0 destruct -IH
172 /2 width=5 by ex3_2_intro/
173 | <structure_A_dx #H0 destruct
174 | <structure_S_dx #H0 destruct
178 lemma eq_inv_A_dx_structure (q) (p):
180 ∃∃r1,r2. q = ⊗r1 & 𝐞 = ⊗r2 & r1●𝗔◗r2 = p.
181 #q #p elim p -p [| * [ #k | #k #d ] #p #IH ]
182 [ <structure_empty #H0 destruct
183 | <structure_d_dx #H0
184 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
185 /2 width=5 by ex3_2_intro/
186 | <structure_d2_dx #H0
187 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
188 /2 width=5 by ex3_2_intro/
189 | <structure_m_dx #H0
190 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
191 /2 width=5 by ex3_2_intro/
192 | <structure_L_dx #H0 destruct
193 | <structure_A_dx #H0 destruct -IH
194 /2 width=5 by ex3_2_intro/
195 | <structure_S_dx #H0 destruct
199 lemma eq_inv_S_dx_structure (q) (p):
201 ∃∃r1,r2. q = ⊗r1 & 𝐞 = ⊗r2 & r1●𝗦◗r2 = p.
202 #q #p elim p -p [| * [ #k | #k #d ] #p #IH ]
203 [ <structure_empty #H0 destruct
204 | <structure_d_dx #H0
205 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
206 /2 width=5 by ex3_2_intro/
207 | <structure_d2_dx #H0
208 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
209 /2 width=5 by ex3_2_intro/
210 | <structure_m_dx #H0
211 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
212 /2 width=5 by ex3_2_intro/
213 | <structure_L_dx #H0 destruct
214 | <structure_A_dx #H0 destruct
215 | <structure_S_dx #H0 destruct -IH
216 /2 width=5 by ex3_2_intro/
220 (* Main inversions **********************************************************)
222 theorem eq_inv_append_structure (p) (q) (r):
224 ∃∃r1,r2.p = ⊗r1 & q = ⊗r2 & r1●r2 = r.
225 #p #q elim q -q [| * [ #k | #k #d ] #q #IH ] #r
226 [ <list_append_empty_sn #H0 destruct
227 /2 width=5 by ex3_2_intro/
228 | #H0 elim (eq_inv_d_dx_structure … H0)
229 | #H0 elim (eq_inv_d2_dx_structure … H0)
230 | #H0 elim (eq_inv_m_dx_structure … H0)
231 | #H0 elim (eq_inv_L_dx_structure … H0) -H0 #r1 #r2 #Hr1 #Hr2 #H0 destruct
232 elim (IH … Hr1) -IH -Hr1 #s1 #s2 #H1 #H2 #H3 destruct
233 @(ex3_2_intro … s1 (s2●𝗟◗r2)) //
234 <structure_append <structure_L_sn <Hr2 -Hr2 //
235 | #H0 elim (eq_inv_A_dx_structure … H0) -H0 #r1 #r2 #Hr1 #Hr2 #H0 destruct
236 elim (IH … Hr1) -IH -Hr1 #s1 #s2 #H1 #H2 #H3 destruct
237 @(ex3_2_intro … s1 (s2●𝗔◗r2)) //
238 <structure_append <structure_A_sn <Hr2 -Hr2 //
239 | #H0 elim (eq_inv_S_dx_structure … H0) -H0 #r1 #r2 #Hr1 #Hr2 #H0 destruct
240 elim (IH … Hr1) -IH -Hr1 #s1 #s2 #H1 #H2 #H3 destruct
241 @(ex3_2_intro … s1 (s2●𝗦◗r2)) //
242 <structure_append <structure_S_sn <Hr2 -Hr2 //
246 (* Inversions with path_lcons ***********************************************)
248 lemma eq_inv_d_sn_structure (h) (q) (p):
250 #h #q #p >list_cons_comm #H0
251 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
252 <list_cons_comm #H0 #H1 #H2 destruct
253 elim (eq_inv_d_dx_structure … H0)
256 lemma eq_inv_d2_sn_structure (d) (h) (q) (p):
258 #d #h #q #p >list_cons_comm #H0
259 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
260 <list_cons_comm #H0 #H1 #H2 destruct
261 elim (eq_inv_d2_dx_structure … H0)
264 lemma eq_inv_m_sn_structure (q) (p):
266 #q #p >list_cons_comm #H0
267 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
268 <list_cons_comm #H0 #H1 #H2 destruct
269 elim (eq_inv_m_dx_structure … H0)
272 lemma eq_inv_L_sn_structure (q) (p):
274 ∃∃r1,r2. 𝐞 = ⊗r1 & q = ⊗r2 & r1●𝗟◗r2 = p.
275 #q #p >list_cons_comm #H0
276 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
277 <list_cons_comm #H0 #H1 #H2 destruct
278 elim (eq_inv_L_dx_structure … H0) -H0 #s1 #s2 #H1 #H2 #H3 destruct
279 @(ex3_2_intro … s1 (s2●r2)) // -s1
280 <structure_append <H2 -s2 //
283 lemma eq_inv_A_sn_structure (q) (p):
285 ∃∃r1,r2. 𝐞 = ⊗r1 & q = ⊗r2 & r1●𝗔◗r2 = p.
286 #q #p >list_cons_comm #H0
287 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
288 <list_cons_comm #H0 #H1 #H2 destruct
289 elim (eq_inv_A_dx_structure … H0) -H0 #s1 #s2 #H1 #H2 #H3 destruct
290 @(ex3_2_intro … s1 (s2●r2)) // -s1
291 <structure_append <H2 -s2 //
294 lemma eq_inv_S_sn_structure (q) (p):
296 ∃∃r1,r2. 𝐞 = ⊗r1 & q = ⊗r2 & r1●𝗦◗r2 = p.
297 #q #p >list_cons_comm #H0
298 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
299 <list_cons_comm #H0 #H1 #H2 destruct
300 elim (eq_inv_S_dx_structure … H0) -H0 #s1 #s2 #H1 #H2 #H3 destruct
301 @(ex3_2_intro … s1 (s2●r2)) // -s1
302 <structure_append <H2 -s2 //