444
|
1 |
theory ClosedForms imports
|
|
2 |
"BasicIdentities"
|
443
|
3 |
begin
|
|
4 |
|
453
|
5 |
lemma add0_isomorphic:
|
|
6 |
shows "rsimp_ALTs (rdistinct (rflts [rsimp r, RZERO]) {}) = rsimp r"
|
|
7 |
sorry
|
|
8 |
|
|
9 |
|
456
|
10 |
|
|
11 |
|
|
12 |
lemma distinct_removes_last:
|
|
13 |
shows "\<lbrakk>(a::rrexp) \<in> set as\<rbrakk>
|
|
14 |
\<Longrightarrow> rdistinct as rset = rdistinct (as @ [a]) rset"
|
|
15 |
and "rdistinct (ab # as @ [ab]) rset1 = rdistinct (ab # as) rset1"
|
|
16 |
apply(induct as arbitrary: rset ab rset1 a)
|
|
17 |
apply simp
|
|
18 |
apply simp
|
|
19 |
apply(case_tac "aa \<in> rset")
|
|
20 |
apply(case_tac "a = aa")
|
|
21 |
apply (metis append_Cons)
|
|
22 |
apply simp
|
|
23 |
apply(case_tac "a \<in> set as")
|
|
24 |
apply (metis append_Cons rdistinct.simps(2) set_ConsD)
|
|
25 |
apply(case_tac "a = aa")
|
|
26 |
prefer 2
|
|
27 |
apply simp
|
|
28 |
apply (metis append_Cons)
|
|
29 |
apply(case_tac "ab \<in> rset1")
|
|
30 |
prefer 2
|
|
31 |
apply(subgoal_tac "rdistinct (ab # (a # as) @ [ab]) rset1 =
|
|
32 |
ab # (rdistinct ((a # as) @ [ab]) (insert ab rset1))")
|
|
33 |
prefer 2
|
|
34 |
apply force
|
|
35 |
apply(simp only:)
|
|
36 |
apply(subgoal_tac "rdistinct (ab # a # as) rset1 = ab # (rdistinct (a # as) (insert ab rset1))")
|
|
37 |
apply(simp only:)
|
|
38 |
apply(subgoal_tac "rdistinct ((a # as) @ [ab]) (insert ab rset1) = rdistinct (a # as) (insert ab rset1)")
|
|
39 |
apply blast
|
|
40 |
apply(case_tac "a \<in> insert ab rset1")
|
|
41 |
apply simp
|
|
42 |
apply (metis insertI1)
|
|
43 |
apply simp
|
|
44 |
apply (meson insertI1)
|
|
45 |
apply simp
|
|
46 |
apply(subgoal_tac "rdistinct ((a # as) @ [ab]) rset1 = rdistinct (a # as) rset1")
|
|
47 |
apply simp
|
|
48 |
by (metis append_Cons insert_iff insert_is_Un rdistinct.simps(2))
|
|
49 |
|
|
50 |
|
|
51 |
lemma distinct_removes_last2:
|
|
52 |
shows "\<lbrakk>(a::rrexp) \<in> set as\<rbrakk>
|
|
53 |
\<Longrightarrow> rdistinct as rset = rdistinct (as @ [a]) rset"
|
|
54 |
using distinct_removes_last(1) by presburger
|
|
55 |
|
453
|
56 |
lemma distinct_append_simp:
|
|
57 |
shows " rsimp (rsimp_ALTs rs1) = rsimp (rsimp_ALTs rs2) \<Longrightarrow>
|
|
58 |
rsimp (rsimp_ALTs (f a # rs1)) =
|
|
59 |
rsimp (rsimp_ALTs (f a # rs2))"
|
|
60 |
apply(case_tac rs1)
|
|
61 |
apply simp
|
|
62 |
apply(case_tac rs2)
|
|
63 |
apply simp
|
|
64 |
apply simp
|
|
65 |
prefer 2
|
|
66 |
apply(case_tac list)
|
|
67 |
apply(case_tac rs2)
|
|
68 |
apply simp
|
|
69 |
using add0_isomorphic apply blast
|
|
70 |
apply simp
|
|
71 |
sorry
|
|
72 |
|
|
73 |
(* apply (smt (z3) append.right_neutral empty_iff list.distinct(1) list.inject no_alt_short_list_after_simp no_further_dB_after_simp rdistinct.elims rflts.elims rflts.simps(2) rsimp_ALTs.simps(1) rsimp_ALTs.simps(2)))*)
|
|
74 |
|
|
75 |
|
|
76 |
|
451
|
77 |
|
|
78 |
|
|
79 |
lemma simp_rdistinct_f: shows
|
|
80 |
"f ` rset = frset \<Longrightarrow> rsimp (rsimp_ALTs (map f (rdistinct rs rset))) = rsimp (rsimp_ALTs (rdistinct (map f rs) frset)) "
|
|
81 |
apply(induct rs arbitrary: rset)
|
|
82 |
apply simp
|
|
83 |
apply(case_tac "a \<in> rset")
|
|
84 |
apply(case_tac " f a \<in> frset")
|
|
85 |
apply simp
|
|
86 |
apply blast
|
|
87 |
apply(subgoal_tac "f a \<notin> frset")
|
|
88 |
apply(simp)
|
|
89 |
apply(subgoal_tac "f ` (insert a rset) = insert (f a) frset")
|
|
90 |
prefer 2
|
|
91 |
apply (meson image_insert)
|
|
92 |
|
453
|
93 |
oops
|
451
|
94 |
|
453
|
95 |
lemma spawn_simp_rsimpalts:
|
|
96 |
shows "rsimp (rsimp_ALTs rs) = rsimp (rsimp_ALTs (map rsimp rs))"
|
|
97 |
apply(cases rs)
|
|
98 |
apply simp
|
|
99 |
apply(case_tac list)
|
|
100 |
apply simp
|
|
101 |
apply(subst rsimp_idem[symmetric])
|
|
102 |
apply simp
|
|
103 |
apply(subgoal_tac "rsimp_ALTs rs = RALTS rs")
|
|
104 |
apply(simp only:)
|
|
105 |
apply(subgoal_tac "rsimp_ALTs (map rsimp rs) = RALTS (map rsimp rs)")
|
|
106 |
apply(simp only:)
|
|
107 |
prefer 2
|
|
108 |
apply simp
|
|
109 |
prefer 2
|
|
110 |
using rsimp_ALTs.simps(3) apply presburger
|
|
111 |
apply auto
|
|
112 |
apply(subst rsimp_idem)+
|
|
113 |
by (metis comp_apply rsimp_idem)
|
|
114 |
|
|
115 |
lemma spawn_simp_distinct:
|
|
116 |
shows "rsimp (rsimp_ALTs (rsa @ (rdistinct rs (set rsa)))) = rsimp (rsimp_ALTs (rsa @ rs))
|
|
117 |
\<and> (a1 \<in> set rsa1 \<longrightarrow> rsimp (rsimp_ALTs (rsa1 @ rs)) = rsimp (rsimp_ALTs (rsa1 @ a1 # rs)))
|
|
118 |
\<and> rsimp (rsimp_ALTs (rsc @ rs)) = rsimp (rsimp_ALTs (rsc @ (rdistinct rs (set rsc))))"
|
|
119 |
apply(induct rs arbitrary: rsa rsa1 a1 rsc)
|
|
120 |
apply simp
|
|
121 |
apply(subgoal_tac "rsimp (rsimp_ALTs (rsa1 @ [a1])) = rsimp (rsimp_ALTs (rsa1 @ (rdistinct [a1] (set rsa1))))")
|
|
122 |
prefer 2
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
oops
|
|
128 |
|
|
129 |
lemma inv_one_derx:
|
|
130 |
shows " RONE = rder xa r2 \<Longrightarrow> r2 = RCHAR xa"
|
|
131 |
apply(case_tac r2)
|
|
132 |
apply simp+
|
|
133 |
using rrexp.distinct(1) apply presburger
|
|
134 |
apply (metis rder.simps(5) rrexp.distinct(13) rrexp.simps(20))
|
|
135 |
apply simp+
|
|
136 |
done
|
|
137 |
|
|
138 |
lemma shape_of_derseq:
|
|
139 |
shows "rder x (RSEQ r1 r2) = RSEQ (rder x r1) r2 \<or> rder x (RSEQ r1 r2) = (RALT (RSEQ (rder x r1) r2) (rder x r2))"
|
|
140 |
using rder.simps(5) by presburger
|
|
141 |
lemma shape_of_derseq2:
|
|
142 |
shows "rder x (RSEQ r11 r12) = RSEQ x41 x42 \<Longrightarrow> x41 = rder x r11"
|
|
143 |
by (metis rrexp.distinct(25) rrexp.inject(2) shape_of_derseq)
|
|
144 |
|
|
145 |
lemma alts_preimage_case1:
|
|
146 |
shows "rder x r = RALTS [r] \<Longrightarrow> \<exists>ra. r = RALTS [ra]"
|
|
147 |
apply(case_tac r)
|
|
148 |
apply simp+
|
|
149 |
apply (metis rrexp.simps(12) rrexp.simps(20))
|
|
150 |
apply (metis rrexp.inject(3) rrexp.simps(30) rsimp_ALTs.simps(2) rsimp_ALTs.simps(3) shape_of_derseq)
|
|
151 |
apply auto[1]
|
|
152 |
by auto
|
|
153 |
|
|
154 |
lemma alts_preimage_case2:
|
|
155 |
shows "rder x r = RALT r1 r2 \<Longrightarrow> \<exists>ra rb. (r = RSEQ ra rb \<or> r = RALT ra rb)"
|
|
156 |
apply(case_tac r)
|
|
157 |
apply simp+
|
|
158 |
apply (metis rrexp.distinct(15) rrexp.distinct(7))
|
|
159 |
apply simp
|
|
160 |
apply auto[1]
|
|
161 |
by auto
|
|
162 |
|
|
163 |
lemma alts_preimage_case2_2:
|
|
164 |
shows "rder x r = RALT r1 r2 \<Longrightarrow> (\<exists>ra rb. r = RSEQ ra rb) \<or> (\<exists>rc rd. r = RALT rc rd)"
|
|
165 |
using alts_preimage_case2 by blast
|
|
166 |
|
|
167 |
lemma alts_preimage_case3:
|
|
168 |
shows "rder x r = RALT r1 r2 \<Longrightarrow> (\<exists>ra rb. r = RSEQ ra rb) \<or> (\<exists>rcs rc rd. r = RALTS rcs \<and> rcs = [rc, rd])"
|
|
169 |
using alts_preimage_case2 by blast
|
|
170 |
|
|
171 |
lemma star_seq:
|
|
172 |
shows "rder x (RSEQ (RSTAR a) b) = RALT (RSEQ (RSEQ (rder x a) (RSTAR a)) b) (rder x b)"
|
|
173 |
using rder.simps(5) rder.simps(6) rnullable.simps(6) by presburger
|
|
174 |
|
|
175 |
lemma language_equality_id1:
|
|
176 |
shows "\<not>rnullable a \<Longrightarrow> rder x (RSEQ (RSTAR a) b) = rder x (RALT (RSEQ (RSEQ a (RSTAR a)) b) b)"
|
|
177 |
apply (subst star_seq)
|
|
178 |
apply simp
|
|
179 |
done
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
lemma distinct_der_set:
|
|
184 |
shows "(rder x) ` rset = dset \<Longrightarrow>
|
|
185 |
rsimp (rsimp_ALTs (map (rder x) (rdistinct rs rset))) = rsimp ( rsimp_ALTs (rdistinct (map (rder x) rs) dset))"
|
|
186 |
apply(induct rs arbitrary: rset dset)
|
|
187 |
apply simp
|
|
188 |
apply(case_tac "a \<in> rset")
|
|
189 |
apply(subgoal_tac "rder x a \<in> dset")
|
|
190 |
prefer 2
|
|
191 |
apply blast
|
|
192 |
apply simp
|
|
193 |
apply(case_tac "rder x a \<notin> dset")
|
|
194 |
prefer 2
|
|
195 |
apply simp
|
|
196 |
|
|
197 |
oops
|
|
198 |
|
|
199 |
lemma map_concat_cons:
|
|
200 |
shows "map f rsa @ f a # rs = map f (rsa @ [a]) @ rs"
|
|
201 |
by simp
|
|
202 |
|
|
203 |
lemma neg_removal_element_of:
|
|
204 |
shows " \<not> a \<notin> aset \<Longrightarrow> a \<in> aset"
|
|
205 |
by simp
|
|
206 |
|
|
207 |
lemma simp_more_flts:
|
|
208 |
shows "rsimp (rsimp_ALTs (rdistinct rs {})) = rsimp (rsimp_ALTs (rdistinct (rflts rs) {}))"
|
|
209 |
|
|
210 |
oops
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
lemma simp_more_distinct:
|
|
215 |
shows "rsimp (rsimp_ALTs (rsa @ rs)) = rsimp (rsimp_ALTs (rsa @ (rdistinct rs (set rsa)))) \<and>
|
|
216 |
rsimp (rsimp_ALTs (rsb @ (rdistinct rs (set rsb)))) =
|
|
217 |
rsimp (rsimp_ALTs (rsb @ (rdistinct (rflts rs) (set rsb))))"
|
|
218 |
apply(induct rs arbitrary: rsa rsb)
|
|
219 |
apply simp
|
|
220 |
|
|
221 |
sorry
|
|
222 |
|
|
223 |
lemma non_empty_list:
|
|
224 |
shows "a \<in> set as \<Longrightarrow> as \<noteq> []"
|
|
225 |
by (metis empty_iff empty_set)
|
|
226 |
|
456
|
227 |
lemma distinct_comp:
|
|
228 |
shows "rdistinct (rs1@rs2) {} = (rdistinct rs1 {}) @ (rdistinct rs2 (set rs1))"
|
|
229 |
apply(induct rs2 arbitrary: rs1)
|
|
230 |
apply simp
|
|
231 |
apply(subgoal_tac "rs1 @ a # rs2 = (rs1 @ [a]) @ rs2")
|
|
232 |
apply(simp only:)
|
|
233 |
apply(case_tac "a \<in> set rs1")
|
|
234 |
apply simp
|
|
235 |
oops
|
453
|
236 |
|
456
|
237 |
lemma instantiate1:
|
|
238 |
shows "\<lbrakk>\<And>ab rset1. rdistinct (ab # as) rset1 = rdistinct (ab # as @ [ab]) rset1\<rbrakk> \<Longrightarrow>
|
|
239 |
rdistinct (aa # as) rset = rdistinct (aa # as @ [aa]) rset"
|
|
240 |
apply(drule_tac x = "aa" in meta_spec)
|
|
241 |
apply(drule_tac x = "rset" in meta_spec)
|
453
|
242 |
apply simp
|
456
|
243 |
done
|
|
244 |
|
|
245 |
|
|
246 |
lemma not_head_elem:
|
|
247 |
shows " \<lbrakk>aa \<in> set (a # as); aa \<notin> (set as)\<rbrakk> \<Longrightarrow> a = aa"
|
|
248 |
|
|
249 |
by fastforce
|
|
250 |
|
|
251 |
(*
|
|
252 |
apply simp
|
|
253 |
apply (metis append_Cons)
|
|
254 |
apply(case_tac "ab \<in> rset1")
|
|
255 |
apply (metis (no_types, opaque_lifting) Un_insert_left append_Cons insert_iff rdistinct.simps(2) sup_bot_left)
|
|
256 |
apply(subgoal_tac "rdistinct (ab # (aa # as) @ [ab]) rset1 =
|
|
257 |
ab # (rdistinct ((aa # as) @ [ab]) (insert ab rset1))")
|
|
258 |
apply(simp only:)
|
|
259 |
apply(subgoal_tac "rdistinct (ab # aa # as) rset1 = ab # (rdistinct (aa # as) (insert ab rset1))")
|
|
260 |
apply(simp only:)
|
|
261 |
apply(subgoal_tac "rdistinct ((aa # as) @ [ab]) (insert ab rset1) = rdistinct (aa # as) (insert ab rset1)")
|
|
262 |
apply blast
|
|
263 |
*)
|
|
264 |
|
453
|
265 |
|
|
266 |
lemma flts_identity1:
|
|
267 |
shows "rflts (rs @ [RONE]) = rflts rs @ [RONE] "
|
|
268 |
apply(induct rs)
|
|
269 |
apply simp+
|
|
270 |
apply(case_tac a)
|
|
271 |
apply simp
|
|
272 |
apply simp+
|
|
273 |
done
|
|
274 |
|
|
275 |
lemma flts_identity10:
|
|
276 |
shows " rflts (rs @ [RCHAR c]) = rflts rs @ [RCHAR c]"
|
|
277 |
apply(induct rs)
|
|
278 |
apply simp+
|
|
279 |
apply(case_tac a)
|
|
280 |
apply simp+
|
|
281 |
done
|
|
282 |
|
|
283 |
lemma flts_identity11:
|
|
284 |
shows " rflts (rs @ [RSEQ r1 r2]) = rflts rs @ [RSEQ r1 r2]"
|
|
285 |
apply(induct rs)
|
|
286 |
apply simp+
|
|
287 |
apply(case_tac a)
|
|
288 |
apply simp+
|
|
289 |
done
|
|
290 |
|
|
291 |
lemma flts_identity12:
|
|
292 |
shows " rflts (rs @ [RSTAR r0]) = rflts rs @ [RSTAR r0]"
|
|
293 |
apply(induct rs)
|
|
294 |
apply simp+
|
|
295 |
apply(case_tac a)
|
|
296 |
apply simp+
|
|
297 |
done
|
|
298 |
|
|
299 |
lemma flts_identity2:
|
|
300 |
shows "a \<noteq> RZERO \<and> (\<forall>rs. a \<noteq> RALTS rs) \<Longrightarrow> rflts (rs @ [a]) = rflts rs @ [a]"
|
|
301 |
apply(case_tac a)
|
|
302 |
apply simp
|
|
303 |
using flts_identity1 apply auto[1]
|
|
304 |
using flts_identity10 apply blast
|
|
305 |
using flts_identity11 apply auto[1]
|
|
306 |
apply blast
|
|
307 |
using flts_identity12 by presburger
|
456
|
308 |
|
|
309 |
lemma flts_identity3:
|
|
310 |
shows "a = RZERO \<Longrightarrow> rflts (rs @ [a]) = rflts rs"
|
|
311 |
apply simp
|
|
312 |
apply(induct rs)
|
|
313 |
apply simp+
|
|
314 |
apply(case_tac aa)
|
|
315 |
apply simp+
|
|
316 |
done
|
|
317 |
|
|
318 |
lemma distinct_removes_last3:
|
|
319 |
shows "\<lbrakk>(a::rrexp) \<in> set as\<rbrakk>
|
|
320 |
\<Longrightarrow> rdistinct as {} = rdistinct (as @ [a]) {}"
|
|
321 |
using distinct_removes_last2 by blast
|
|
322 |
|
|
323 |
lemma set_inclusion_with_flts1:
|
|
324 |
shows " \<lbrakk>RONE \<in> set rs\<rbrakk> \<Longrightarrow> RONE \<in> set (rflts rs)"
|
|
325 |
apply(induct rs)
|
|
326 |
apply simp
|
|
327 |
apply(case_tac " RONE \<in> set rs")
|
|
328 |
apply simp
|
|
329 |
apply (metis Un_upper2 insert_absorb insert_subset list.set_intros(2) rflts.simps(2) rflts.simps(3) rflts_def_idiot set_append)
|
|
330 |
apply(case_tac "RONE = a")
|
|
331 |
apply simp
|
|
332 |
apply simp
|
|
333 |
done
|
|
334 |
|
|
335 |
lemma set_inclusion_with_flts10:
|
|
336 |
shows " \<lbrakk>RCHAR x \<in> set rs\<rbrakk> \<Longrightarrow> RCHAR x \<in> set (rflts rs)"
|
|
337 |
apply(induct rs)
|
|
338 |
apply simp
|
|
339 |
apply(case_tac " RCHAR x \<in> set rs")
|
|
340 |
apply simp
|
|
341 |
apply (metis Un_upper2 insert_absorb insert_subset rflts.simps(2) rflts.simps(3) rflts_def_idiot set_append set_subset_Cons)
|
|
342 |
apply(case_tac "RCHAR x = a")
|
|
343 |
apply simp
|
|
344 |
apply fastforce
|
|
345 |
apply simp
|
|
346 |
done
|
|
347 |
|
|
348 |
lemma set_inclusion_with_flts11:
|
|
349 |
shows " \<lbrakk>RSEQ r1 r2 \<in> set rs\<rbrakk> \<Longrightarrow> RSEQ r1 r2 \<in> set (rflts rs)"
|
|
350 |
apply(induct rs)
|
|
351 |
apply simp
|
|
352 |
apply(case_tac " RSEQ r1 r2 \<in> set rs")
|
|
353 |
apply simp
|
|
354 |
apply (metis Un_upper2 insert_absorb insert_subset rflts.simps(2) rflts.simps(3) rflts_def_idiot set_append set_subset_Cons)
|
|
355 |
apply(case_tac "RSEQ r1 r2 = a")
|
|
356 |
apply simp
|
|
357 |
apply fastforce
|
|
358 |
apply simp
|
|
359 |
done
|
|
360 |
|
|
361 |
|
|
362 |
lemma set_inclusion_with_flts:
|
|
363 |
shows " \<lbrakk>a \<in> set as; rsimp a \<in> set (map rsimp as); rsimp a = RONE\<rbrakk> \<Longrightarrow> rsimp a \<in> set (rflts (map rsimp as))"
|
|
364 |
by (simp add: set_inclusion_with_flts1)
|
453
|
365 |
|
456
|
366 |
lemma "\<And>x5. \<lbrakk>a \<in> set as; rsimp a \<in> set (map rsimp as); rsimp a = RALTS x5\<rbrakk>
|
|
367 |
\<Longrightarrow> rsimp_ALTs (rdistinct (rflts (map rsimp as @ [rsimp a])) {}) =
|
|
368 |
rsimp_ALTs (rdistinct (rflts (map rsimp as @ x5)) {})"
|
|
369 |
|
453
|
370 |
|
|
371 |
lemma last_elem_dup1:
|
|
372 |
shows " a \<in> set as \<Longrightarrow> rsimp (RALTS (as @ [a] )) = rsimp (RALTS (as ))"
|
|
373 |
apply simp
|
|
374 |
apply(subgoal_tac "rsimp a \<in> set (map rsimp as)")
|
|
375 |
prefer 2
|
|
376 |
apply simp
|
456
|
377 |
apply(case_tac "rsimp a")
|
|
378 |
apply simp
|
|
379 |
|
|
380 |
using flts_identity3 apply presburger
|
|
381 |
apply(subst flts_identity2)
|
|
382 |
using rrexp.distinct(1) rrexp.distinct(15) apply presburger
|
|
383 |
apply(subst distinct_removes_last3[symmetric])
|
|
384 |
using set_inclusion_with_flts apply blast
|
|
385 |
apply simp
|
|
386 |
apply (metis distinct_removes_last3 flts_identity10 set_inclusion_with_flts10)
|
|
387 |
apply (metis distinct_removes_last3 flts_identity11 set_inclusion_with_flts11)
|
453
|
388 |
sorry
|
|
389 |
|
|
390 |
lemma last_elem_dup:
|
|
391 |
shows " a \<in> set as \<Longrightarrow> rsimp (rsimp_ALTs (as @ [a] )) = rsimp (rsimp_ALTs (as ))"
|
|
392 |
apply(induct as rule: rev_induct)
|
|
393 |
apply simp
|
|
394 |
apply simp
|
|
395 |
apply(subgoal_tac "xs \<noteq> []")
|
|
396 |
prefer 2
|
|
397 |
|
|
398 |
|
|
399 |
|
|
400 |
|
|
401 |
sorry
|
|
402 |
|
|
403 |
lemma appeared_before_remove_later:
|
|
404 |
shows "a \<in> set as \<Longrightarrow> rsimp (rsimp_ALTs ( as @ a # rs)) = rsimp (rsimp_ALTs (as @ rs))"
|
|
405 |
and "a \<in> set as \<Longrightarrow> rsimp (rsimp_ALTs as ) = rsimp (rsimp_ALTs (as @ [a]))"
|
|
406 |
apply(induct rs arbitrary: as)
|
|
407 |
apply simp
|
|
408 |
|
|
409 |
|
|
410 |
sorry
|
|
411 |
|
|
412 |
lemma distinct_remove_later:
|
|
413 |
shows "\<lbrakk>rder x a \<in> rder x ` set rsa\<rbrakk>
|
|
414 |
\<Longrightarrow> rsimp (rsimp_ALTs (map (rder x) rsa @ rder x a # map (rder x) (rdistinct rs (insert a (set rsa))))) =
|
|
415 |
rsimp (rsimp_ALTs (map (rder x) rsa @ map (rder x) (rdistinct rs (set rsa))))"
|
451
|
416 |
|
|
417 |
sorry
|
|
418 |
|
|
419 |
|
453
|
420 |
lemma distinct_der_general:
|
|
421 |
shows "rsimp (rsimp_ALTs (map (rder x) (rsa @ (rdistinct rs (set rsa))))) =
|
|
422 |
rsimp ( rsimp_ALTs ((map (rder x) rsa)@(rdistinct (map (rder x) rs) (set (map (rder x) rsa)))) )"
|
|
423 |
apply(induct rs arbitrary: rsa)
|
|
424 |
apply simp
|
|
425 |
apply(case_tac "a \<in> set rsa")
|
|
426 |
apply(subgoal_tac "rder x a \<in> set (map (rder x) rsa)")
|
|
427 |
apply simp
|
|
428 |
apply simp
|
|
429 |
apply(case_tac "rder x a \<notin> set (map (rder x) rsa)")
|
|
430 |
apply(simp)
|
|
431 |
apply(subst map_concat_cons)+
|
|
432 |
apply(drule_tac x = "rsa @ [a]" in meta_spec)
|
|
433 |
apply simp
|
|
434 |
apply(drule neg_removal_element_of)
|
|
435 |
apply simp
|
|
436 |
apply(subst distinct_remove_later)
|
|
437 |
apply simp
|
|
438 |
apply(drule_tac x = "rsa" in meta_spec)
|
|
439 |
by blast
|
|
440 |
|
|
441 |
|
|
442 |
|
|
443 |
|
451
|
444 |
lemma distinct_der:
|
|
445 |
shows "rsimp (rsimp_ALTs (map (rder x) (rdistinct rs {}))) = rsimp ( rsimp_ALTs (rdistinct (map (rder x) rs) {}))"
|
453
|
446 |
by (metis distinct_der_general list.simps(8) self_append_conv2 set_empty)
|
451
|
447 |
|
453
|
448 |
|
|
449 |
|
|
450 |
|
|
451 |
lemma rders_simp_lambda:
|
|
452 |
shows " rsimp \<circ> rder x \<circ> (\<lambda>r. rders_simp r xs) = (\<lambda>r. rders_simp r (xs @ [x]))"
|
|
453 |
using rders_simp_append by auto
|
451
|
454 |
|
453
|
455 |
lemma rders_simp_nonempty_simped:
|
|
456 |
shows "xs \<noteq> [] \<Longrightarrow> rsimp \<circ> (\<lambda>r. rders_simp r xs) = (\<lambda>r. rders_simp r xs)"
|
|
457 |
using rders_simp_same_simpders rsimp_idem by auto
|
|
458 |
|
|
459 |
lemma repeated_altssimp:
|
|
460 |
shows "\<forall>r \<in> set rs. rsimp r = r \<Longrightarrow> rsimp (rsimp_ALTs (rdistinct (rflts rs) {})) =
|
|
461 |
rsimp_ALTs (rdistinct (rflts rs) {})"
|
|
462 |
by (metis map_idI rsimp.simps(2) rsimp_idem)
|
451
|
463 |
|
444
|
464 |
lemma alts_closed_form: shows
|
|
465 |
"rsimp (rders_simp (RALTS rs) s) =
|
|
466 |
rsimp (RALTS (map (\<lambda>r. rders_simp r s) rs))"
|
|
467 |
apply(induct s rule: rev_induct)
|
|
468 |
apply simp
|
|
469 |
apply simp
|
|
470 |
apply(subst rders_simp_append)
|
|
471 |
apply(subgoal_tac " rsimp (rders_simp (rders_simp (RALTS rs) xs) [x]) =
|
|
472 |
rsimp(rders_simp (rsimp_ALTs (rdistinct (rflts (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs)) {})) [x])")
|
|
473 |
prefer 2
|
|
474 |
apply (metis inside_simp_removal rders_simp_one_char)
|
|
475 |
apply(simp only: )
|
451
|
476 |
apply(subst rders_simp_one_char)
|
|
477 |
apply(subst rsimp_idem)
|
|
478 |
apply(subgoal_tac "rsimp (rder x (rsimp_ALTs (rdistinct (rflts (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs)) {}))) =
|
|
479 |
rsimp ((rsimp_ALTs (map (rder x) (rdistinct (rflts (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs)) {})))) ")
|
|
480 |
prefer 2
|
|
481 |
using rder_rsimp_ALTs_commute apply presburger
|
|
482 |
apply(simp only:)
|
|
483 |
apply(subgoal_tac "rsimp (rsimp_ALTs (map (rder x) (rdistinct (rflts (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs)) {})))
|
|
484 |
= rsimp (rsimp_ALTs (rdistinct (map (rder x) (rflts (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs))) {}))")
|
|
485 |
prefer 2
|
|
486 |
|
|
487 |
using distinct_der apply presburger
|
|
488 |
apply(simp only:)
|
453
|
489 |
apply(subgoal_tac " rsimp (rsimp_ALTs (rdistinct (map (rder x) (rflts (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs))) {})) =
|
|
490 |
rsimp (rsimp_ALTs (rdistinct ( (rflts (map (rder x) (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs)))) {}))")
|
|
491 |
apply(simp only:)
|
|
492 |
apply(subgoal_tac " rsimp (rsimp_ALTs (rdistinct (rflts (map (rder x) (map (rsimp \<circ> (\<lambda>r. rders_simp r xs)) rs))) {})) =
|
|
493 |
rsimp (rsimp_ALTs (rdistinct (rflts ( (map (rsimp \<circ> (rder x) \<circ> (\<lambda>r. rders_simp r xs)) rs))) {}))")
|
|
494 |
apply(simp only:)
|
|
495 |
apply(subst rders_simp_lambda)
|
|
496 |
apply(subst rders_simp_nonempty_simped)
|
|
497 |
apply simp
|
|
498 |
apply(subgoal_tac "\<forall>r \<in> set (map (\<lambda>r. rders_simp r (xs @ [x])) rs). rsimp r = r")
|
|
499 |
prefer 2
|
|
500 |
apply (simp add: rders_simp_same_simpders rsimp_idem)
|
|
501 |
apply(subst repeated_altssimp)
|
|
502 |
apply simp
|
|
503 |
apply fastforce
|
|
504 |
apply (metis inside_simp_removal list.map_comp rder.simps(4) rsimp.simps(2) rsimp_idem)
|
|
505 |
|
|
506 |
(* apply (metis head_one_more_simp list.inject list.map_comp list.simps(9) rders_simp_lambda rsimp.simps(2))
|
|
507 |
*)
|
451
|
508 |
|
444
|
509 |
sorry
|
443
|
510 |
|
444
|
511 |
lemma alts_closed_form_variant: shows
|
|
512 |
"s \<noteq> [] \<Longrightarrow> rders_simp (RALTS rs) s =
|
|
513 |
rsimp (RALTS (map (\<lambda>r. rders_simp r s) rs))"
|
|
514 |
sorry
|
443
|
515 |
|
|
516 |
|
|
517 |
|
444
|
518 |
lemma star_closed_form:
|
|
519 |
shows "rders_simp (RSTAR r0) (c#s) =
|
|
520 |
rsimp ( RALTS ( (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0) ) (star_updates s r0 [[c]]) ) ))"
|
|
521 |
apply(induct s)
|
|
522 |
apply simp
|
|
523 |
sorry
|
443
|
524 |
|
|
525 |
|
|
526 |
|
|
527 |
lemma seq_closed_form: shows
|
|
528 |
"rsimp (rders_simp (RSEQ r1 r2) s) =
|
|
529 |
rsimp ( RALTS ( (RSEQ (rders_simp r1 s) r2) #
|
445
|
530 |
(map (rders_simp r2) (vsuf s r1))
|
443
|
531 |
)
|
|
532 |
)"
|
|
533 |
apply(induct s)
|
|
534 |
apply simp
|
|
535 |
sorry
|
|
536 |
|
|
537 |
|
444
|
538 |
lemma seq_closed_form_variant: shows
|
|
539 |
"s \<noteq> [] \<Longrightarrow> (rders_simp (RSEQ r1 r2) s) =
|
|
540 |
rsimp (RALTS ((RSEQ (rders_simp r1 s) r2) # (map (rders_simp r2) (vsuf s r1))))"
|
445
|
541 |
apply(induct s rule: rev_induct)
|
|
542 |
apply simp
|
|
543 |
apply(subst rders_simp_append)
|
|
544 |
apply(subst rders_simp_one_char)
|
|
545 |
apply(subst rsimp_idem[symmetric])
|
|
546 |
apply(subst rders_simp_one_char[symmetric])
|
|
547 |
apply(subst rders_simp_append[symmetric])
|
|
548 |
apply(insert seq_closed_form)
|
|
549 |
apply(subgoal_tac "rsimp (rders_simp (RSEQ r1 r2) (xs @ [x]))
|
|
550 |
= rsimp (RALTS (RSEQ (rders_simp r1 (xs @ [x])) r2 # map (rders_simp r2) (vsuf (xs @ [x]) r1)))")
|
|
551 |
apply force
|
|
552 |
by presburger
|
443
|
553 |
|
444
|
554 |
end |