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_m ⇒ structure q
28 | label_L ⇒ (structure q)◖𝗟
29 | label_A ⇒ (structure q)◖𝗔
30 | label_S ⇒ (structure q)◖𝗦
36 'CircledTimes p = (structure p).
38 (* Basic constructions ******************************************************)
40 lemma structure_empty:
44 lemma structure_d_dx (p) (k):
48 lemma structure_m_dx (p):
52 lemma structure_L_dx (p):
56 lemma structure_A_dx (p):
60 lemma structure_S_dx (p):
64 (* Main constructions *******************************************************)
66 theorem structure_idem (p):
72 theorem structure_append (p) (q):
76 <list_append_lcons_sn //
79 (* Constructions with path_lcons ********************************************)
81 lemma structure_d_sn (p) (k):
83 #p #k <structure_append //
86 lemma structure_m_sn (p):
88 #p <structure_append //
91 lemma structure_L_sn (p):
93 #p <structure_append //
96 lemma structure_A_sn (p):
98 #p <structure_append //
101 lemma structure_S_sn (p):
103 #p <structure_append //
106 (* Basic inversions *********************************************************)
108 lemma eq_inv_d_dx_structure (h) (q) (p):
110 #h #q #p elim p -p [| * [ #k ] #p #IH ]
111 [ <structure_empty #H0 destruct
112 | <structure_d_dx #H0 /2 width=1 by/
113 | <structure_m_dx #H0 /2 width=1 by/
114 | <structure_L_dx #H0 destruct
115 | <structure_A_dx #H0 destruct
116 | <structure_S_dx #H0 destruct
120 lemma eq_inv_m_dx_structure (q) (p):
122 #q #p elim p -p [| * [ #k ] #p #IH ]
123 [ <structure_empty #H0 destruct
124 | <structure_d_dx #H0 /2 width=1 by/
125 | <structure_m_dx #H0 /2 width=1 by/
126 | <structure_L_dx #H0 destruct
127 | <structure_A_dx #H0 destruct
128 | <structure_S_dx #H0 destruct
132 lemma eq_inv_L_dx_structure (q) (p):
134 ∃∃r1,r2. q = ⊗r1 & 𝐞 = ⊗r2 & r1●𝗟◗r2 = p.
135 #q #p elim p -p [| * [ #k ] #p #IH ]
136 [ <structure_empty #H0 destruct
137 | <structure_d_dx #H0
138 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
139 /2 width=5 by ex3_2_intro/
140 | <structure_m_dx #H0
141 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
142 /2 width=5 by ex3_2_intro/
143 | <structure_L_dx #H0 destruct -IH
144 /2 width=5 by ex3_2_intro/
145 | <structure_A_dx #H0 destruct
146 | <structure_S_dx #H0 destruct
150 lemma eq_inv_A_dx_structure (q) (p):
152 ∃∃r1,r2. q = ⊗r1 & 𝐞 = ⊗r2 & r1●𝗔◗r2 = p.
153 #q #p elim p -p [| * [ #k ] #p #IH ]
154 [ <structure_empty #H0 destruct
155 | <structure_d_dx #H0
156 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
157 /2 width=5 by ex3_2_intro/
158 | <structure_m_dx #H0
159 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
160 /2 width=5 by ex3_2_intro/
161 | <structure_L_dx #H0 destruct
162 | <structure_A_dx #H0 destruct -IH
163 /2 width=5 by ex3_2_intro/
164 | <structure_S_dx #H0 destruct
168 lemma eq_inv_S_dx_structure (q) (p):
170 ∃∃r1,r2. q = ⊗r1 & 𝐞 = ⊗r2 & r1●𝗦◗r2 = p.
171 #q #p elim p -p [| * [ #k ] #p #IH ]
172 [ <structure_empty #H0 destruct
173 | <structure_d_dx #H0
174 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
175 /2 width=5 by ex3_2_intro/
176 | <structure_m_dx #H0
177 elim IH -IH // -H0 #r1 #r2 #H1 #H0 #H2 destruct
178 /2 width=5 by ex3_2_intro/
179 | <structure_L_dx #H0 destruct
180 | <structure_A_dx #H0 destruct
181 | <structure_S_dx #H0 destruct -IH
182 /2 width=5 by ex3_2_intro/
186 (* Main inversions **********************************************************)
188 theorem eq_inv_append_structure (p) (q) (r):
190 ∃∃r1,r2.p = ⊗r1 & q = ⊗r2 & r1●r2 = r.
191 #p #q elim q -q [| * [ #k ] #q #IH ] #r
192 [ <list_append_empty_sn #H0 destruct
193 /2 width=5 by ex3_2_intro/
194 | #H0 elim (eq_inv_d_dx_structure … H0)
195 | #H0 elim (eq_inv_m_dx_structure … H0)
196 | #H0 elim (eq_inv_L_dx_structure … H0) -H0 #r1 #r2 #Hr1 #Hr2 #H0 destruct
197 elim (IH … Hr1) -IH -Hr1 #s1 #s2 #H1 #H2 #H3 destruct
198 @(ex3_2_intro … s1 (s2●𝗟◗r2)) //
199 <structure_append <structure_L_sn <Hr2 -Hr2 //
200 | #H0 elim (eq_inv_A_dx_structure … H0) -H0 #r1 #r2 #Hr1 #Hr2 #H0 destruct
201 elim (IH … Hr1) -IH -Hr1 #s1 #s2 #H1 #H2 #H3 destruct
202 @(ex3_2_intro … s1 (s2●𝗔◗r2)) //
203 <structure_append <structure_A_sn <Hr2 -Hr2 //
204 | #H0 elim (eq_inv_S_dx_structure … H0) -H0 #r1 #r2 #Hr1 #Hr2 #H0 destruct
205 elim (IH … Hr1) -IH -Hr1 #s1 #s2 #H1 #H2 #H3 destruct
206 @(ex3_2_intro … s1 (s2●𝗦◗r2)) //
207 <structure_append <structure_S_sn <Hr2 -Hr2 //
211 (* Inversions with path_lcons ***********************************************)
213 lemma eq_inv_d_sn_structure (h) (q) (p):
215 #h #q #p >list_cons_comm #H0
216 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
217 <list_cons_comm #H0 #H1 #H2 destruct
218 elim (eq_inv_d_dx_structure … H0)
221 lemma eq_inv_m_sn_structure (q) (p):
223 #q #p >list_cons_comm #H0
224 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
225 <list_cons_comm #H0 #H1 #H2 destruct
226 elim (eq_inv_m_dx_structure … H0)
229 lemma eq_inv_L_sn_structure (q) (p):
231 ∃∃r1,r2. 𝐞 = ⊗r1 & q = ⊗r2 & r1●𝗟◗r2 = p.
232 #q #p >list_cons_comm #H0
233 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
234 <list_cons_comm #H0 #H1 #H2 destruct
235 elim (eq_inv_L_dx_structure … H0) -H0 #s1 #s2 #H1 #H2 #H3 destruct
236 @(ex3_2_intro … s1 (s2●r2)) // -s1
237 <structure_append <H2 -s2 //
240 lemma eq_inv_A_sn_structure (q) (p):
242 ∃∃r1,r2. 𝐞 = ⊗r1 & q = ⊗r2 & r1●𝗔◗r2 = p.
243 #q #p >list_cons_comm #H0
244 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
245 <list_cons_comm #H0 #H1 #H2 destruct
246 elim (eq_inv_A_dx_structure … H0) -H0 #s1 #s2 #H1 #H2 #H3 destruct
247 @(ex3_2_intro … s1 (s2●r2)) // -s1
248 <structure_append <H2 -s2 //
251 lemma eq_inv_S_sn_structure (q) (p):
253 ∃∃r1,r2. 𝐞 = ⊗r1 & q = ⊗r2 & r1●𝗦◗r2 = p.
254 #q #p >list_cons_comm #H0
255 elim (eq_inv_append_structure … H0) -H0 #r1 #r2
256 <list_cons_comm #H0 #H1 #H2 destruct
257 elim (eq_inv_S_dx_structure … H0) -H0 #s1 #s2 #H1 #H2 #H3 destruct
258 @(ex3_2_intro … s1 (s2●r2)) // -s1
259 <structure_append <H2 -s2 //