author | Christian Urban <urbanc@in.tum.de> |
Mon, 26 Jun 2017 17:43:28 +0100 | |
changeset 248 | b90ff5abb437 |
parent 247 | f35753951058 |
child 254 | 7c89d3f6923e |
permissions | -rw-r--r-- |
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
theory Sulzmann |
204
cd9e40280784
added paper about size derivatives
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
185
diff
changeset
|
3 |
imports "Lexer" "~~/src/HOL/Library/Multiset" |
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
begin |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
section {* Sulzmann's "Ordering" of Values *} |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
|
245 | 9 |
fun |
10 |
size :: "val \<Rightarrow> nat" |
|
11 |
where |
|
12 |
"size (Void) = 0" |
|
13 |
| "size (Char c) = 0" |
|
14 |
| "size (Left v) = 1 + size v" |
|
15 |
| "size (Right v) = 1 + size v" |
|
16 |
| "size (Seq v1 v2) = 1 + (size v1) + (size v2)" |
|
17 |
| "size (Stars []) = 0" |
|
18 |
| "size (Stars (v#vs)) = 1 + (size v) + (size (Stars vs))" |
|
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
|
245 | 20 |
lemma Star_size [simp]: |
21 |
"\<lbrakk>n < length vs; 0 < length vs\<rbrakk> \<Longrightarrow> size (nth vs n) < size (Stars vs)" |
|
22 |
apply(induct vs arbitrary: n) |
|
23 |
apply(simp) |
|
24 |
apply(auto) |
|
25 |
by (metis One_nat_def Suc_pred less_Suc0 less_Suc_eq list.size(3) not_add_less1 not_less_eq nth_Cons' trans_less_add2) |
|
26 |
||
27 |
lemma Star_size0 [simp]: |
|
28 |
"0 < length vs \<Longrightarrow> 0 < size (Stars vs)" |
|
29 |
apply(induct vs) |
|
30 |
apply(auto) |
|
31 |
done |
|
32 |
||
33 |
||
34 |
fun |
|
35 |
at :: "val \<Rightarrow> nat list \<Rightarrow> val" |
|
36 |
where |
|
37 |
"at v [] = v" |
|
38 |
| "at (Left v) (0#ps)= at v ps" |
|
39 |
| "at (Right v) (Suc 0#ps)= at v ps" |
|
40 |
| "at (Seq v1 v2) (0#ps)= at v1 ps" |
|
41 |
| "at (Seq v1 v2) (Suc 0#ps)= at v2 ps" |
|
42 |
| "at (Stars vs) (n#ps)= at (nth vs n) ps" |
|
43 |
||
44 |
fun |
|
45 |
ato :: "val \<Rightarrow> nat list \<Rightarrow> val option" |
|
46 |
where |
|
47 |
"ato v [] = Some v" |
|
48 |
| "ato (Left v) (0#ps)= ato v ps" |
|
49 |
| "ato (Right v) (Suc 0#ps)= ato v ps" |
|
50 |
| "ato (Seq v1 v2) (0#ps)= ato v1 ps" |
|
51 |
| "ato (Seq v1 v2) (Suc 0#ps)= ato v2 ps" |
|
52 |
| "ato (Stars vs) (n#ps)= (if (n < length vs) then ato (nth vs n) ps else None)" |
|
53 |
| "ato v p = None" |
|
54 |
||
55 |
fun Pos :: "val \<Rightarrow> (nat list) set" |
|
56 |
where |
|
57 |
"Pos (Void) = {[]}" |
|
58 |
| "Pos (Char c) = {[]}" |
|
59 |
| "Pos (Left v) = {[]} \<union> {0#ps | ps. ps \<in> Pos v}" |
|
60 |
| "Pos (Right v) = {[]} \<union> {1#ps | ps. ps \<in> Pos v}" |
|
61 |
| "Pos (Seq v1 v2) = {[]} \<union> {0#ps | ps. ps \<in> Pos v1} \<union> {1#ps | ps. ps \<in> Pos v2}" |
|
62 |
| "Pos (Stars []) = {[]}" |
|
63 |
| "Pos (Stars (v#vs)) = {[]} \<union> {0#ps | ps. ps \<in> Pos v} \<union> {(Suc n)#ps | n ps. n#ps \<in> Pos (Stars vs)}" |
|
64 |
||
65 |
lemma Pos_empty: |
|
66 |
shows "[] \<in> Pos v" |
|
67 |
apply(induct v rule: Pos.induct) |
|
68 |
apply(auto) |
|
69 |
done |
|
70 |
||
71 |
lemma Pos_finite_aux: |
|
72 |
assumes "\<forall>v \<in> set vs. finite (Pos v)" |
|
73 |
shows "finite (Pos (Stars vs))" |
|
74 |
using assms |
|
75 |
apply(induct vs) |
|
76 |
apply(simp) |
|
77 |
apply(simp) |
|
78 |
apply(subgoal_tac "finite (Pos (Stars vs) - {[]})") |
|
79 |
apply(rule_tac f="\<lambda>l. Suc (hd l) # tl l" in finite_surj) |
|
80 |
apply(assumption) |
|
81 |
back |
|
82 |
apply(auto simp add: image_def) |
|
83 |
apply(rule_tac x="n#ps" in bexI) |
|
84 |
apply(simp) |
|
85 |
apply(simp) |
|
86 |
done |
|
87 |
||
88 |
lemma Pos_finite: |
|
89 |
shows "finite (Pos v)" |
|
90 |
apply(induct v rule: val.induct) |
|
91 |
apply(auto) |
|
92 |
apply(simp add: Pos_finite_aux) |
|
93 |
done |
|
94 |
||
95 |
||
96 |
lemma ato_test: |
|
97 |
assumes "p \<in> Pos v" |
|
98 |
shows "\<exists>v'. ato v p = Some v'" |
|
99 |
using assms |
|
100 |
apply(induct v arbitrary: p rule: Pos.induct) |
|
101 |
apply(auto) |
|
102 |
apply force |
|
103 |
by (metis ato.simps(6) option.distinct(1)) |
|
104 |
||
105 |
definition pflat :: "val \<Rightarrow> nat list => string option" |
|
106 |
where |
|
107 |
"pflat v p \<equiv> (if p \<in> Pos v then Some (flat (at v p)) else None)" |
|
108 |
||
109 |
fun intlen :: "'a list \<Rightarrow> int" |
|
110 |
where |
|
111 |
"intlen [] = 0" |
|
112 |
| "intlen (x#xs) = 1 + intlen xs" |
|
113 |
||
114 |
lemma inlen_bigger: |
|
115 |
shows "0 \<le> intlen xs" |
|
116 |
apply(induct xs) |
|
117 |
apply(auto) |
|
118 |
done |
|
119 |
||
120 |
lemma intlen_append: |
|
121 |
shows "intlen (xs @ ys) = intlen xs + intlen ys" |
|
122 |
apply(induct xs arbitrary: ys) |
|
123 |
apply(auto) |
|
124 |
done |
|
125 |
||
126 |
lemma intlen_length: |
|
127 |
assumes "length xs < length ys" |
|
128 |
shows "intlen xs < intlen ys" |
|
129 |
using assms |
|
130 |
apply(induct xs arbitrary: ys) |
|
131 |
apply(auto) |
|
132 |
apply(case_tac ys) |
|
133 |
apply(simp_all) |
|
134 |
apply (smt inlen_bigger) |
|
135 |
by (smt Suc_lessE intlen.simps(2) length_Suc_conv) |
|
136 |
||
137 |
||
138 |
definition pflat_len :: "val \<Rightarrow> nat list => int" |
|
139 |
where |
|
140 |
"pflat_len v p \<equiv> (if p \<in> Pos v then intlen (flat (at v p)) else -1)" |
|
141 |
||
142 |
lemma pflat_len_simps: |
|
143 |
shows "pflat_len (Seq v1 v2) (0#p) = pflat_len v1 p" |
|
144 |
and "pflat_len (Seq v1 v2) (Suc 0#p) = pflat_len v2 p" |
|
145 |
and "pflat_len (Left v) (0#p) = pflat_len v p" |
|
146 |
and "pflat_len (Left v) (Suc 0#p) = -1" |
|
147 |
and "pflat_len (Right v) (Suc 0#p) = pflat_len v p" |
|
148 |
and "pflat_len (Right v) (0#p) = -1" |
|
149 |
and "pflat_len v [] = intlen (flat v)" |
|
150 |
apply(auto simp add: pflat_len_def Pos_empty) |
|
151 |
done |
|
152 |
||
153 |
lemma pflat_len_Stars_simps: |
|
154 |
assumes "n < length vs" |
|
155 |
shows "pflat_len (Stars vs) (n#p) = pflat_len (vs!n) p" |
|
156 |
using assms |
|
157 |
apply(induct vs arbitrary: n p) |
|
158 |
apply(simp) |
|
159 |
apply(simp) |
|
160 |
apply(simp add: pflat_len_def) |
|
161 |
apply(auto)[1] |
|
162 |
apply (metis at.simps(6)) |
|
163 |
apply (metis Suc_less_eq Suc_pred) |
|
164 |
by (metis diff_Suc_1 less_Suc_eq_0_disj nth_Cons') |
|
165 |
||
166 |
||
246 | 167 |
lemma pflat_len_Stars_simps2: |
168 |
shows "pflat_len (Stars (v#vs)) (Suc n # p) = pflat_len (Stars vs) (n#p)" |
|
169 |
and "pflat_len (Stars (v#vs)) (0 # p) = pflat_len v p" |
|
170 |
using assms |
|
171 |
apply(simp_all add: pflat_len_def) |
|
172 |
done |
|
173 |
||
245 | 174 |
lemma Two_to_Three_aux: |
175 |
assumes "p \<in> Pos v1 \<union> Pos v2" "pflat_len v1 p = pflat_len v2 p" |
|
176 |
shows "p \<in> Pos v1 \<inter> Pos v2" |
|
177 |
using assms |
|
178 |
apply(simp add: pflat_len_def) |
|
179 |
apply(auto split: if_splits) |
|
180 |
apply (smt inlen_bigger)+ |
|
181 |
done |
|
182 |
||
183 |
lemma Two_to_Three: |
|
184 |
assumes "\<forall>p \<in> Pos v1 \<union> Pos v2. pflat v1 p = pflat v2 p" |
|
185 |
shows "Pos v1 = Pos v2" |
|
186 |
using assms |
|
187 |
by (metis Un_iff option.distinct(1) pflat_def subsetI subset_antisym) |
|
188 |
||
189 |
lemma Two_to_Three_orig: |
|
190 |
assumes "\<forall>p \<in> Pos v1 \<union> Pos v2. pflat_len v1 p = pflat_len v2 p" |
|
191 |
shows "Pos v1 = Pos v2" |
|
192 |
using assms |
|
193 |
by (metis Un_iff inlen_bigger neg_0_le_iff_le not_one_le_zero pflat_len_def subsetI subset_antisym) |
|
194 |
||
195 |
lemma set_eq1: |
|
196 |
assumes "insert [] A = insert [] B" "[] \<notin> A" "[] \<notin> B" |
|
197 |
shows "A = B" |
|
198 |
using assms |
|
199 |
by (simp add: insert_ident) |
|
200 |
||
201 |
lemma set_eq2: |
|
202 |
assumes "A \<union> B = A \<union> C" |
|
203 |
and "A \<inter> B = {}" "A \<inter> C = {}" |
|
204 |
shows "B = C" |
|
205 |
using assms |
|
206 |
using Un_Int_distrib sup_bot.left_neutral sup_commute by blast |
|
207 |
||
208 |
||
209 |
||
210 |
lemma Three_to_One: |
|
211 |
assumes "\<turnstile> v1 : r" "\<turnstile> v2 : r" |
|
212 |
and "Pos v1 = Pos v2" |
|
213 |
shows "v1 = v2" |
|
214 |
using assms |
|
215 |
apply(induct v1 arbitrary: r v2 rule: Pos.induct) |
|
216 |
apply(erule Prf.cases) |
|
217 |
apply(simp_all) |
|
218 |
apply(erule Prf.cases) |
|
219 |
apply(simp_all) |
|
220 |
apply(erule Prf.cases) |
|
221 |
apply(simp_all) |
|
222 |
apply(erule Prf.cases) |
|
223 |
apply(simp_all) |
|
224 |
apply(erule Prf.cases) |
|
225 |
apply(simp_all) |
|
226 |
apply(erule Prf.cases) |
|
227 |
apply(simp_all) |
|
228 |
apply(clarify) |
|
229 |
apply(simp add: insert_ident) |
|
230 |
apply(drule_tac x="r1a" in meta_spec) |
|
231 |
apply(drule_tac x="v1a" in meta_spec) |
|
232 |
apply(simp) |
|
233 |
apply(drule_tac meta_mp) |
|
234 |
thm subset_antisym |
|
235 |
apply(rule subset_antisym) |
|
236 |
apply(auto)[3] |
|
237 |
apply(clarify) |
|
238 |
apply(simp add: insert_ident) |
|
239 |
using Pos_empty apply blast |
|
240 |
apply(erule Prf.cases) |
|
241 |
apply(simp_all) |
|
242 |
apply(erule Prf.cases) |
|
243 |
apply(simp_all) |
|
244 |
apply(clarify) |
|
245 |
apply(simp add: insert_ident) |
|
246 |
using Pos_empty apply blast |
|
247 |
apply(simp add: insert_ident) |
|
248 |
apply(drule_tac x="r2a" in meta_spec) |
|
249 |
apply(drule_tac x="v2b" in meta_spec) |
|
250 |
apply(simp) |
|
251 |
apply(drule_tac meta_mp) |
|
252 |
apply(rule subset_antisym) |
|
253 |
apply(auto)[3] |
|
254 |
apply(erule Prf.cases) |
|
255 |
apply(simp_all) |
|
256 |
apply(erule Prf.cases) |
|
257 |
apply(simp_all) |
|
258 |
apply(simp add: insert_ident) |
|
259 |
apply(clarify) |
|
260 |
apply(drule_tac x="r1a" in meta_spec) |
|
261 |
apply(drule_tac x="r2a" in meta_spec) |
|
262 |
apply(drule_tac x="v1b" in meta_spec) |
|
263 |
apply(drule_tac x="v2c" in meta_spec) |
|
264 |
apply(simp) |
|
265 |
apply(drule_tac meta_mp) |
|
266 |
apply(rule subset_antisym) |
|
267 |
apply(rule subsetI) |
|
268 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos v1a}") |
|
269 |
prefer 2 |
|
270 |
apply(auto)[1] |
|
271 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos v1b} \<union> {Suc 0 # ps |ps. ps \<in> Pos v2c}") |
|
272 |
prefer 2 |
|
273 |
apply (metis (no_types, lifting) Un_iff) |
|
274 |
apply(simp) |
|
275 |
apply(rule subsetI) |
|
276 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos v1b}") |
|
277 |
prefer 2 |
|
278 |
apply(auto)[1] |
|
279 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos v1a} \<union> {Suc 0 # ps |ps. ps \<in> Pos v2b}") |
|
280 |
prefer 2 |
|
281 |
apply (metis (no_types, lifting) Un_iff) |
|
282 |
apply(simp (no_asm_use)) |
|
283 |
apply(simp) |
|
284 |
apply(drule_tac meta_mp) |
|
285 |
apply(rule subset_antisym) |
|
286 |
apply(rule subsetI) |
|
287 |
apply(subgoal_tac "Suc 0 # x \<in> {Suc 0 # ps |ps. ps \<in> Pos v2b}") |
|
288 |
prefer 2 |
|
289 |
apply(auto)[1] |
|
290 |
apply(subgoal_tac "Suc 0 # x \<in> {0 # ps |ps. ps \<in> Pos v1b} \<union> {Suc 0 # ps |ps. ps \<in> Pos v2c}") |
|
291 |
prefer 2 |
|
292 |
apply (metis (no_types, lifting) Un_iff) |
|
293 |
apply(simp) |
|
294 |
apply(rule subsetI) |
|
295 |
apply(subgoal_tac "Suc 0 # x \<in> {Suc 0 # ps |ps. ps \<in> Pos v2c}") |
|
296 |
prefer 2 |
|
297 |
apply(auto)[1] |
|
298 |
apply(subgoal_tac "Suc 0 # x \<in> {0 # ps |ps. ps \<in> Pos v1b} \<union> {Suc 0 # ps |ps. ps \<in> Pos v2b}") |
|
299 |
prefer 2 |
|
300 |
apply (metis (no_types, lifting) Un_iff) |
|
301 |
apply(simp (no_asm_use)) |
|
302 |
apply(simp) |
|
303 |
apply(erule Prf.cases) |
|
304 |
apply(simp_all) |
|
305 |
apply(erule Prf.cases) |
|
306 |
apply(simp_all) |
|
307 |
apply(auto)[1] |
|
308 |
using Pos_empty apply fastforce |
|
309 |
apply(erule Prf.cases) |
|
310 |
apply(simp_all) |
|
311 |
apply(erule Prf.cases) |
|
312 |
apply(simp_all) |
|
313 |
apply(auto)[1] |
|
314 |
using Pos_empty apply fastforce |
|
315 |
apply(clarify) |
|
316 |
apply(simp add: insert_ident) |
|
317 |
apply(drule_tac x="rb" in meta_spec) |
|
318 |
apply(drule_tac x="STAR rb" in meta_spec) |
|
319 |
apply(drule_tac x="vb" in meta_spec) |
|
320 |
apply(drule_tac x="Stars vsb" in meta_spec) |
|
321 |
apply(simp) |
|
322 |
apply(drule_tac meta_mp) |
|
323 |
apply(rule subset_antisym) |
|
324 |
apply(rule subsetI) |
|
325 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos va}") |
|
326 |
prefer 2 |
|
327 |
apply(auto)[1] |
|
328 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos vb} \<union> {Suc n # ps |n ps. n # ps \<in> Pos (Stars vsb)}") |
|
329 |
prefer 2 |
|
330 |
apply (metis (no_types, lifting) Un_iff) |
|
331 |
apply(simp) |
|
332 |
apply(rule subsetI) |
|
333 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos vb}") |
|
334 |
prefer 2 |
|
335 |
apply(auto)[1] |
|
336 |
apply(subgoal_tac "0 # x \<in> {0 # ps |ps. ps \<in> Pos va} \<union> {Suc n # ps |n ps. n # ps \<in> Pos (Stars vsa)}") |
|
337 |
prefer 2 |
|
338 |
apply (metis (no_types, lifting) Un_iff) |
|
339 |
apply(simp (no_asm_use)) |
|
340 |
apply(simp) |
|
341 |
apply(drule_tac meta_mp) |
|
342 |
apply(rule subset_antisym) |
|
343 |
apply(rule subsetI) |
|
344 |
apply(case_tac vsa) |
|
345 |
apply(simp) |
|
346 |
apply (simp add: Pos_empty) |
|
347 |
apply(simp) |
|
348 |
apply(clarify) |
|
349 |
apply(erule disjE) |
|
350 |
apply (simp add: Pos_empty) |
|
351 |
apply(erule disjE) |
|
352 |
apply(clarify) |
|
353 |
apply(subgoal_tac |
|
354 |
"Suc 0 # ps \<in> {Suc n # ps |n ps. n = 0 \<and> ps \<in> Pos a \<or> (\<exists>na. n = Suc na \<and> na # ps \<in> Pos (Stars list))}") |
|
355 |
prefer 2 |
|
356 |
apply blast |
|
357 |
apply(subgoal_tac "Suc 0 # ps \<in> {0 # ps |ps. ps \<in> Pos vb} \<union> {Suc n # ps |n ps. n # ps \<in> Pos (Stars vsb)}") |
|
358 |
prefer 2 |
|
359 |
apply (metis (no_types, lifting) Un_iff) |
|
360 |
apply(simp) |
|
361 |
apply(clarify) |
|
362 |
apply(subgoal_tac |
|
363 |
"Suc (Suc n) # ps \<in> {Suc n # ps |n ps. n = 0 \<and> ps \<in> Pos a \<or> (\<exists>na. n = Suc na \<and> na # ps \<in> Pos (Stars list))}") |
|
364 |
prefer 2 |
|
365 |
apply blast |
|
366 |
apply(subgoal_tac "Suc (Suc n) # ps \<in> {0 # ps |ps. ps \<in> Pos vb} \<union> {Suc n # ps |n ps. n # ps \<in> Pos (Stars vsb)}") |
|
367 |
prefer 2 |
|
368 |
apply (metis (no_types, lifting) Un_iff) |
|
369 |
apply(simp) |
|
370 |
apply(rule subsetI) |
|
371 |
apply(case_tac vsb) |
|
372 |
apply(simp) |
|
373 |
apply (simp add: Pos_empty) |
|
374 |
apply(simp) |
|
375 |
apply(clarify) |
|
376 |
apply(erule disjE) |
|
377 |
apply (simp add: Pos_empty) |
|
378 |
apply(erule disjE) |
|
379 |
apply(clarify) |
|
380 |
apply(subgoal_tac |
|
381 |
"Suc 0 # ps \<in> {Suc n # ps |n ps. n = 0 \<and> ps \<in> Pos a \<or> (\<exists>na. n = Suc na \<and> na # ps \<in> Pos (Stars list))}") |
|
382 |
prefer 2 |
|
383 |
apply(simp) |
|
384 |
apply(subgoal_tac "Suc 0 # ps \<in> {Suc n # ps |n ps. n # ps \<in> Pos (Stars vsa)}") |
|
385 |
apply blast |
|
386 |
using list.inject apply blast |
|
387 |
apply(clarify) |
|
388 |
apply(subgoal_tac |
|
389 |
"Suc (Suc n) # ps \<in> {Suc n # ps |n ps. n = 0 \<and> ps \<in> Pos a \<or> (\<exists>na. n = Suc na \<and> na # ps \<in> Pos (Stars list))}") |
|
390 |
prefer 2 |
|
391 |
apply(simp) |
|
392 |
apply(subgoal_tac "Suc (Suc n) # ps \<in> {0 # ps |ps. ps \<in> Pos vb} \<union> {Suc n # ps |n ps. n # ps \<in> Pos (Stars vsa)}") |
|
393 |
prefer 2 |
|
394 |
apply (metis (no_types, lifting) Un_iff) |
|
395 |
apply(simp (no_asm_use)) |
|
396 |
apply(simp) |
|
397 |
done |
|
398 |
||
399 |
definition prefix_list:: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" ("_ \<sqsubseteq>pre _") |
|
400 |
where |
|
401 |
"ps1 \<sqsubseteq>pre ps2 \<equiv> (\<exists>ps'. ps1 @ps' = ps2)" |
|
402 |
||
403 |
definition sprefix_list:: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" ("_ \<sqsubset>spre _") |
|
404 |
where |
|
405 |
"ps1 \<sqsubset>spre ps2 \<equiv> (ps1 \<sqsubseteq>pre ps2 \<and> ps1 \<noteq> ps2)" |
|
406 |
||
407 |
inductive lex_lists :: "nat list \<Rightarrow> nat list \<Rightarrow> bool" ("_ \<sqsubset>lex _") |
|
408 |
where |
|
409 |
"[] \<sqsubset>lex p#ps" |
|
410 |
| "ps1 \<sqsubset>lex ps2 \<Longrightarrow> (p#ps1) \<sqsubset>lex (p#ps2)" |
|
411 |
| "p1 < p2 \<Longrightarrow> (p1#ps1) \<sqsubset>lex (p2#ps2)" |
|
412 |
||
413 |
lemma lex_irrfl: |
|
414 |
fixes ps1 ps2 :: "nat list" |
|
415 |
assumes "ps1 \<sqsubset>lex ps2" |
|
416 |
shows "ps1 \<noteq> ps2" |
|
417 |
using assms |
|
418 |
apply(induct rule: lex_lists.induct) |
|
419 |
apply(auto) |
|
420 |
done |
|
421 |
||
422 |
lemma lex_append: |
|
423 |
assumes "ps2 \<noteq> []" |
|
424 |
shows "ps \<sqsubset>lex ps @ ps2" |
|
425 |
using assms |
|
426 |
apply(induct ps) |
|
427 |
apply(auto intro: lex_lists.intros) |
|
428 |
apply(case_tac ps2) |
|
429 |
apply(simp) |
|
430 |
apply(simp) |
|
431 |
apply(auto intro: lex_lists.intros) |
|
432 |
done |
|
433 |
||
434 |
lemma lexordp_simps [simp]: |
|
435 |
fixes xs ys :: "nat list" |
|
436 |
shows "[] \<sqsubset>lex ys = (ys \<noteq> [])" |
|
437 |
and "xs \<sqsubset>lex [] = False" |
|
438 |
and "(x # xs) \<sqsubset>lex (y # ys) \<longleftrightarrow> (x < y \<or> (\<not> y < x \<and> xs \<sqsubset>lex ys))" |
|
439 |
apply - |
|
440 |
apply (metis lex_append lex_lists.simps list.simps(3)) |
|
441 |
using lex_lists.cases apply blast |
|
442 |
using lex_lists.cases lex_lists.intros(2) lex_lists.intros(3) not_less_iff_gr_or_eq by fastforce |
|
443 |
||
444 |
lemma lex_append_cancel [simp]: |
|
445 |
fixes ps ps1 ps2 :: "nat list" |
|
446 |
shows "ps @ ps1 \<sqsubset>lex ps @ ps2 \<longleftrightarrow> ps1 \<sqsubset>lex ps2" |
|
447 |
apply(induct ps) |
|
448 |
apply(auto) |
|
449 |
done |
|
450 |
||
451 |
lemma lex_trans: |
|
452 |
fixes ps1 ps2 ps3 :: "nat list" |
|
453 |
assumes "ps1 \<sqsubset>lex ps2" "ps2 \<sqsubset>lex ps3" |
|
454 |
shows "ps1 \<sqsubset>lex ps3" |
|
455 |
using assms |
|
456 |
apply(induct arbitrary: ps3 rule: lex_lists.induct) |
|
457 |
apply(erule lex_lists.cases) |
|
458 |
apply(simp_all) |
|
459 |
apply(rotate_tac 2) |
|
460 |
apply(erule lex_lists.cases) |
|
461 |
apply(simp_all) |
|
462 |
apply(erule lex_lists.cases) |
|
463 |
apply(simp_all) |
|
464 |
done |
|
465 |
||
466 |
lemma trichotomous_aux: |
|
467 |
fixes p q :: "nat list" |
|
468 |
assumes "p \<sqsubset>lex q" "p \<noteq> q" |
|
469 |
shows "\<not>(q \<sqsubset>lex p)" |
|
470 |
using assms |
|
471 |
apply(induct rule: lex_lists.induct) |
|
472 |
apply(auto) |
|
473 |
done |
|
474 |
||
475 |
lemma trichotomous_aux2: |
|
476 |
fixes p q :: "nat list" |
|
477 |
assumes "p \<sqsubset>lex q" "q \<sqsubset>lex p" |
|
478 |
shows "False" |
|
479 |
using assms |
|
480 |
apply(induct rule: lex_lists.induct) |
|
481 |
apply(auto) |
|
482 |
done |
|
483 |
||
484 |
lemma trichotomous: |
|
485 |
fixes p q :: "nat list" |
|
486 |
shows "p = q \<or> p \<sqsubset>lex q \<or> q \<sqsubset>lex p" |
|
487 |
apply(induct p arbitrary: q) |
|
488 |
apply(auto) |
|
489 |
apply(case_tac q) |
|
490 |
apply(auto) |
|
491 |
done |
|
492 |
||
493 |
definition dpos :: "val \<Rightarrow> val \<Rightarrow> nat list \<Rightarrow> bool" |
|
494 |
where |
|
495 |
"dpos v1 v2 p \<equiv> (p \<in> Pos v1 \<union> Pos v2) \<and> (p \<notin> Pos v1 \<inter> Pos v2)" |
|
496 |
||
497 |
definition |
|
498 |
"DPos v1 v2 \<equiv> {p. dpos v1 v2 p}" |
|
499 |
||
500 |
lemma outside_lemma: |
|
501 |
assumes "p \<notin> Pos v1 \<union> Pos v2" |
|
502 |
shows "pflat_len v1 p = pflat_len v2 p" |
|
503 |
using assms |
|
504 |
apply(auto simp add: pflat_len_def) |
|
505 |
done |
|
506 |
||
507 |
lemma dpos_lemma_aux: |
|
508 |
assumes "p \<in> Pos v1 \<union> Pos v2" |
|
509 |
and "pflat_len v1 p = pflat_len v2 p" |
|
510 |
shows "p \<in> Pos v1 \<inter> Pos v2" |
|
511 |
using assms |
|
512 |
apply(auto simp add: pflat_len_def) |
|
513 |
apply (smt inlen_bigger) |
|
514 |
apply (smt inlen_bigger) |
|
515 |
done |
|
516 |
||
517 |
lemma dpos_lemma: |
|
518 |
assumes "p \<in> Pos v1 \<union> Pos v2" |
|
519 |
and "pflat_len v1 p = pflat_len v2 p" |
|
520 |
shows "\<not>dpos v1 v2 p" |
|
521 |
using assms |
|
522 |
apply(auto simp add: dpos_def dpos_lemma_aux) |
|
523 |
using dpos_lemma_aux apply auto[1] |
|
524 |
using dpos_lemma_aux apply auto[1] |
|
525 |
done |
|
526 |
||
527 |
lemma dpos_lemma2: |
|
528 |
assumes "p \<in> Pos v1 \<union> Pos v2" |
|
529 |
and "dpos v1 v2 p" |
|
530 |
shows "pflat_len v1 p \<noteq> pflat_len v2 p" |
|
531 |
using assms |
|
532 |
using dpos_lemma by blast |
|
533 |
||
534 |
lemma DPos_lemma: |
|
535 |
assumes "p \<in> DPos v1 v2" |
|
536 |
shows "pflat_len v1 p \<noteq> pflat_len v2 p" |
|
537 |
using assms |
|
538 |
unfolding DPos_def |
|
539 |
apply(auto simp add: pflat_len_def dpos_def) |
|
540 |
apply (smt inlen_bigger) |
|
541 |
by (smt inlen_bigger) |
|
542 |
||
543 |
||
544 |
definition val_ord:: "val \<Rightarrow> nat list \<Rightarrow> val \<Rightarrow> bool" ("_ \<sqsubset>val _ _") |
|
545 |
where |
|
546 |
"v1 \<sqsubset>val p v2 \<equiv> (p \<in> Pos v1 \<and> pflat_len v1 p > pflat_len v2 p \<and> |
|
547 |
(\<forall>q \<in> Pos v1 \<union> Pos v2. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q))" |
|
548 |
||
549 |
||
550 |
definition val_ord_ex:: "val \<Rightarrow> val \<Rightarrow> bool" ("_ :\<sqsubset>val _") |
|
551 |
where |
|
552 |
"v1 :\<sqsubset>val v2 \<equiv> (\<exists>p. v1 \<sqsubset>val p v2)" |
|
553 |
||
554 |
definition val_ord_ex1:: "val \<Rightarrow> val \<Rightarrow> bool" ("_ :\<sqsubseteq>val _") |
|
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
555 |
where |
245 | 556 |
"v1 :\<sqsubseteq>val v2 \<equiv> v1 :\<sqsubset>val v2 \<or> v1 = v2" |
557 |
||
558 |
lemma val_ord_shorterI: |
|
559 |
assumes "length (flat v') < length (flat v)" |
|
560 |
shows "v :\<sqsubset>val v'" |
|
561 |
using assms(1) |
|
562 |
apply(subst val_ord_ex_def) |
|
563 |
apply(rule_tac x="[]" in exI) |
|
564 |
apply(subst val_ord_def) |
|
565 |
apply(rule conjI) |
|
566 |
apply (simp add: Pos_empty) |
|
567 |
apply(rule conjI) |
|
568 |
apply(simp add: pflat_len_simps) |
|
569 |
apply (simp add: intlen_length) |
|
570 |
apply(simp) |
|
571 |
done |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
572 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
573 |
lemma val_ord_spre: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
574 |
assumes "(flat v') \<sqsubset>spre (flat v)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
575 |
shows "v :\<sqsubset>val v'" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
576 |
using assms(1) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
577 |
apply(rule_tac val_ord_shorterI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
578 |
apply(simp add: sprefix_list_def prefix_list_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
579 |
apply(auto) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
580 |
apply(case_tac ps') |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
581 |
apply(auto) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
582 |
by (metis append_eq_conv_conj drop_all le_less_linear neq_Nil_conv) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
583 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
584 |
|
245 | 585 |
lemma val_ord_ALTI: |
586 |
assumes "v \<sqsubset>val p v'" "flat v = flat v'" |
|
587 |
shows "(Left v) \<sqsubset>val (0#p) (Left v')" |
|
588 |
using assms(1) |
|
589 |
apply(subst (asm) val_ord_def) |
|
590 |
apply(erule conjE) |
|
591 |
apply(subst val_ord_def) |
|
592 |
apply(rule conjI) |
|
593 |
apply(simp) |
|
594 |
apply(rule conjI) |
|
595 |
apply(simp add: pflat_len_simps) |
|
596 |
apply(rule ballI) |
|
597 |
apply(rule impI) |
|
598 |
apply(simp only: Pos.simps) |
|
599 |
apply(auto)[1] |
|
600 |
using assms(2) |
|
601 |
apply(simp add: pflat_len_simps) |
|
602 |
apply(auto simp add: pflat_len_simps)[2] |
|
603 |
done |
|
604 |
||
605 |
lemma val_ord_ALTI2: |
|
606 |
assumes "v \<sqsubset>val p v'" "flat v = flat v'" |
|
607 |
shows "(Right v) \<sqsubset>val (1#p) (Right v')" |
|
608 |
using assms(1) |
|
609 |
apply(subst (asm) val_ord_def) |
|
610 |
apply(erule conjE) |
|
611 |
apply(subst val_ord_def) |
|
612 |
apply(rule conjI) |
|
613 |
apply(simp) |
|
614 |
apply(rule conjI) |
|
615 |
apply(simp add: pflat_len_simps) |
|
616 |
apply(rule ballI) |
|
617 |
apply(rule impI) |
|
618 |
apply(simp only: Pos.simps) |
|
619 |
apply(auto)[1] |
|
620 |
using assms(2) |
|
621 |
apply(simp add: pflat_len_simps) |
|
622 |
apply(auto simp add: pflat_len_simps)[2] |
|
623 |
done |
|
624 |
||
246 | 625 |
lemma val_ord_ALTE: |
626 |
assumes "(Left v1) \<sqsubset>val (p # ps) (Left v2)" |
|
627 |
shows "p = 0 \<and> v1 \<sqsubset>val ps v2" |
|
628 |
using assms(1) |
|
629 |
apply(simp add: val_ord_def) |
|
630 |
apply(auto simp add: pflat_len_simps) |
|
631 |
apply (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(3) val_ord_def) |
|
632 |
by (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(3) val_ord_def) |
|
633 |
||
634 |
lemma val_ord_ALTE2: |
|
635 |
assumes "(Right v1) \<sqsubset>val (p # ps) (Right v2)" |
|
636 |
shows "p = 1 \<and> v1 \<sqsubset>val ps v2" |
|
637 |
using assms(1) |
|
638 |
apply(simp add: val_ord_def) |
|
639 |
apply(auto simp add: pflat_len_simps) |
|
640 |
apply (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(5) val_ord_def) |
|
641 |
by (metis (no_types, hide_lams) assms lex_lists.intros(2) outside_lemma pflat_len_simps(5) val_ord_def) |
|
642 |
||
245 | 643 |
lemma val_ord_STARI: |
644 |
assumes "v1 \<sqsubset>val p v2" "flat (Stars (v1#vs1)) = flat (Stars (v2#vs2))" |
|
645 |
shows "(Stars (v1#vs1)) \<sqsubset>val (0#p) (Stars (v2#vs2))" |
|
646 |
using assms(1) |
|
647 |
apply(subst (asm) val_ord_def) |
|
648 |
apply(erule conjE) |
|
649 |
apply(subst val_ord_def) |
|
650 |
apply(rule conjI) |
|
651 |
apply(simp) |
|
652 |
apply(rule conjI) |
|
653 |
apply(subst pflat_len_Stars_simps) |
|
654 |
apply(simp) |
|
655 |
apply(subst pflat_len_Stars_simps) |
|
656 |
apply(simp) |
|
657 |
apply(simp) |
|
658 |
apply(rule ballI) |
|
659 |
apply(rule impI) |
|
660 |
apply(simp) |
|
661 |
apply(auto) |
|
662 |
using assms(2) |
|
663 |
apply(simp add: pflat_len_simps) |
|
664 |
apply(auto simp add: pflat_len_Stars_simps) |
|
665 |
done |
|
666 |
||
667 |
lemma val_ord_STARI2: |
|
668 |
assumes "(Stars vs1) \<sqsubset>val n#p (Stars vs2)" "flat (Stars vs1) = flat (Stars vs2)" |
|
669 |
shows "(Stars (v#vs1)) \<sqsubset>val (Suc n#p) (Stars (v#vs2))" |
|
670 |
using assms(1) |
|
671 |
apply(subst (asm) val_ord_def) |
|
672 |
apply(erule conjE)+ |
|
673 |
apply(subst val_ord_def) |
|
674 |
apply(rule conjI) |
|
675 |
apply(simp) |
|
676 |
apply(rule conjI) |
|
677 |
apply(case_tac vs1) |
|
678 |
apply(simp) |
|
679 |
apply(simp) |
|
680 |
apply(auto)[1] |
|
681 |
apply(case_tac vs2) |
|
682 |
apply(simp) |
|
683 |
apply (simp add: pflat_len_def) |
|
684 |
apply(simp) |
|
685 |
apply(auto)[1] |
|
686 |
apply (simp add: pflat_len_Stars_simps) |
|
687 |
using pflat_len_def apply auto[1] |
|
688 |
apply(rule ballI) |
|
689 |
apply(rule impI) |
|
690 |
apply(simp) |
|
691 |
using assms(2) |
|
692 |
apply(auto) |
|
693 |
apply (simp add: pflat_len_simps(7)) |
|
694 |
apply (simp add: pflat_len_Stars_simps) |
|
695 |
using assms(2) |
|
696 |
apply(auto simp add: pflat_len_def)[1] |
|
697 |
apply force |
|
698 |
apply force |
|
699 |
apply(auto simp add: pflat_len_def)[1] |
|
700 |
apply force |
|
701 |
apply force |
|
702 |
apply(auto simp add: pflat_len_def)[1] |
|
703 |
apply(auto simp add: pflat_len_def)[1] |
|
704 |
apply force |
|
705 |
apply force |
|
706 |
apply(auto simp add: pflat_len_def)[1] |
|
707 |
apply force |
|
708 |
apply force |
|
709 |
done |
|
710 |
||
711 |
||
712 |
lemma val_ord_SEQI: |
|
713 |
assumes "v1 \<sqsubset>val p v1'" "flat (Seq v1 v2) = flat (Seq v1' v2')" |
|
714 |
shows "(Seq v1 v2) \<sqsubset>val (0#p) (Seq v1' v2')" |
|
715 |
using assms(1) |
|
716 |
apply(subst (asm) val_ord_def) |
|
717 |
apply(erule conjE) |
|
718 |
apply(subst val_ord_def) |
|
719 |
apply(rule conjI) |
|
720 |
apply(simp) |
|
721 |
apply(rule conjI) |
|
722 |
apply(simp add: pflat_len_simps) |
|
723 |
apply(rule ballI) |
|
724 |
apply(rule impI) |
|
725 |
apply(simp only: Pos.simps) |
|
726 |
apply(auto)[1] |
|
727 |
apply(simp add: pflat_len_simps) |
|
728 |
using assms(2) |
|
729 |
apply(simp) |
|
730 |
apply(auto simp add: pflat_len_simps)[2] |
|
731 |
done |
|
732 |
||
733 |
||
734 |
lemma val_ord_SEQI2: |
|
735 |
assumes "v2 \<sqsubset>val p v2'" "flat v2 = flat v2'" |
|
736 |
shows "(Seq v v2) \<sqsubset>val (1#p) (Seq v v2')" |
|
737 |
using assms(1) |
|
738 |
apply(subst (asm) val_ord_def) |
|
739 |
apply(erule conjE)+ |
|
740 |
apply(subst val_ord_def) |
|
741 |
apply(rule conjI) |
|
742 |
apply(simp) |
|
743 |
apply(rule conjI) |
|
744 |
apply(simp add: pflat_len_simps) |
|
745 |
apply(rule ballI) |
|
746 |
apply(rule impI) |
|
747 |
apply(simp only: Pos.simps) |
|
748 |
apply(auto) |
|
749 |
apply(auto simp add: pflat_len_def intlen_append) |
|
750 |
apply(auto simp add: assms(2)) |
|
751 |
done |
|
752 |
||
753 |
lemma val_ord_SEQE_0: |
|
754 |
assumes "(Seq v1 v2) \<sqsubset>val 0#p (Seq v1' v2')" |
|
755 |
shows "v1 \<sqsubset>val p v1'" |
|
756 |
using assms(1) |
|
757 |
apply(simp add: val_ord_def val_ord_ex_def) |
|
758 |
apply(auto)[1] |
|
759 |
apply(simp add: pflat_len_simps) |
|
760 |
apply(simp add: val_ord_def pflat_len_def) |
|
761 |
apply(auto)[1] |
|
762 |
apply(drule_tac x="0#q" in bspec) |
|
763 |
apply(simp) |
|
764 |
apply(simp) |
|
765 |
apply(drule_tac x="0#q" in bspec) |
|
766 |
apply(simp) |
|
767 |
apply(simp) |
|
768 |
apply(drule_tac x="0#q" in bspec) |
|
769 |
apply(simp) |
|
770 |
apply(simp) |
|
771 |
apply(simp add: val_ord_def pflat_len_def) |
|
772 |
apply(auto)[1] |
|
773 |
done |
|
774 |
||
775 |
lemma val_ord_SEQE_1: |
|
776 |
assumes "(Seq v1 v2) \<sqsubset>val (Suc 0)#p (Seq v1' v2')" |
|
777 |
shows "v2 \<sqsubset>val p v2'" |
|
778 |
using assms(1) |
|
779 |
apply(simp add: val_ord_def pflat_len_def) |
|
780 |
apply(auto)[1] |
|
781 |
apply(drule_tac x="1#q" in bspec) |
|
782 |
apply(simp) |
|
783 |
apply(simp) |
|
784 |
apply(drule_tac x="1#q" in bspec) |
|
785 |
apply(simp) |
|
786 |
apply(simp) |
|
787 |
apply(drule_tac x="1#q" in bspec) |
|
788 |
apply(simp) |
|
789 |
apply(auto)[1] |
|
790 |
apply(drule_tac x="1#q" in bspec) |
|
791 |
apply(simp) |
|
792 |
apply(auto) |
|
793 |
apply(simp add: intlen_append) |
|
794 |
apply force |
|
795 |
apply(simp add: intlen_append) |
|
796 |
apply force |
|
797 |
apply(simp add: intlen_append) |
|
798 |
apply force |
|
799 |
apply(simp add: intlen_append) |
|
800 |
apply force |
|
801 |
done |
|
802 |
||
803 |
lemma val_ord_SEQE_2: |
|
804 |
assumes "(Seq v1 v2) \<sqsubset>val (Suc 0)#p (Seq v1' v2')" |
|
805 |
and "\<turnstile> v1 : r" "\<turnstile> v1' : r" |
|
806 |
shows "v1 = v1'" |
|
807 |
proof - |
|
808 |
have "\<forall>q \<in> Pos v1 \<union> Pos v1'. 0 # q \<sqsubset>lex 1#p \<longrightarrow> pflat_len v1 q = pflat_len v1' q" |
|
809 |
using assms(1) |
|
810 |
apply(simp add: val_ord_def) |
|
811 |
apply(rule ballI) |
|
812 |
apply(clarify) |
|
813 |
apply(drule_tac x="0#q" in bspec) |
|
814 |
apply(auto)[1] |
|
815 |
apply(simp add: pflat_len_simps) |
|
816 |
done |
|
817 |
then have "Pos v1 = Pos v1'" |
|
818 |
apply(rule_tac Two_to_Three_orig) |
|
819 |
apply(rule ballI) |
|
820 |
apply(drule_tac x="pa" in bspec) |
|
821 |
apply(simp) |
|
822 |
apply(simp) |
|
823 |
done |
|
824 |
then show "v1 = v1'" |
|
825 |
apply(rule_tac Three_to_One) |
|
826 |
apply(rule assms) |
|
827 |
apply(rule assms) |
|
828 |
apply(simp) |
|
829 |
done |
|
830 |
qed |
|
831 |
||
832 |
lemma val_ord_SEQ: |
|
833 |
assumes "(Seq v1 v2) :\<sqsubset>val (Seq v1' v2')" |
|
834 |
and "flat (Seq v1 v2) = flat (Seq v1' v2')" |
|
835 |
and "\<turnstile> v1 : r" "\<turnstile> v1' : r" |
|
836 |
shows "(v1 :\<sqsubset>val v1') \<or> (v1 = v1' \<and> (v2 :\<sqsubset>val v2'))" |
|
837 |
using assms(1) |
|
838 |
apply(subst (asm) val_ord_ex_def) |
|
839 |
apply(erule exE) |
|
840 |
apply(simp only: val_ord_def) |
|
841 |
apply(simp) |
|
842 |
apply(erule conjE)+ |
|
843 |
apply(erule disjE) |
|
844 |
prefer 2 |
|
845 |
apply(erule disjE) |
|
846 |
apply(erule exE) |
|
847 |
apply(rule disjI1) |
|
848 |
apply(simp) |
|
849 |
apply(subst val_ord_ex_def) |
|
850 |
apply(rule_tac x="ps" in exI) |
|
851 |
apply(rule val_ord_SEQE_0) |
|
852 |
apply(simp add: val_ord_def) |
|
853 |
apply(erule exE) |
|
854 |
apply(rule disjI2) |
|
855 |
apply(rule conjI) |
|
856 |
thm val_ord_SEQE_1 |
|
857 |
apply(rule_tac val_ord_SEQE_2) |
|
858 |
apply(auto simp add: val_ord_def)[3] |
|
859 |
apply(rule assms(3)) |
|
860 |
apply(rule assms(4)) |
|
861 |
apply(subst val_ord_ex_def) |
|
862 |
apply(rule_tac x="ps" in exI) |
|
863 |
apply(rule_tac val_ord_SEQE_1) |
|
864 |
apply(auto simp add: val_ord_def)[1] |
|
865 |
apply(simp) |
|
866 |
using assms(2) |
|
867 |
apply(simp add: pflat_len_simps) |
|
868 |
done |
|
869 |
||
246 | 870 |
|
245 | 871 |
lemma val_ord_ex_trans: |
872 |
assumes "v1 :\<sqsubset>val v2" "v2 :\<sqsubset>val v3" |
|
873 |
shows "v1 :\<sqsubset>val v3" |
|
874 |
using assms |
|
875 |
unfolding val_ord_ex_def |
|
876 |
apply(clarify) |
|
877 |
apply(subgoal_tac "p = pa \<or> p \<sqsubset>lex pa \<or> pa \<sqsubset>lex p") |
|
878 |
prefer 2 |
|
879 |
apply(rule trichotomous) |
|
880 |
apply(erule disjE) |
|
881 |
apply(simp) |
|
882 |
apply(rule_tac x="pa" in exI) |
|
883 |
apply(subst val_ord_def) |
|
884 |
apply(rule conjI) |
|
885 |
apply(simp add: val_ord_def) |
|
886 |
apply(auto)[1] |
|
887 |
apply(simp add: val_ord_def) |
|
888 |
apply(simp add: val_ord_def) |
|
889 |
apply(auto)[1] |
|
890 |
using outside_lemma apply blast |
|
891 |
apply(simp add: val_ord_def) |
|
892 |
apply(auto)[1] |
|
893 |
using outside_lemma apply force |
|
894 |
apply auto[1] |
|
895 |
apply(simp add: val_ord_def) |
|
896 |
apply(auto)[1] |
|
897 |
apply (metis (no_types, hide_lams) lex_trans outside_lemma) |
|
898 |
apply(simp add: val_ord_def) |
|
899 |
apply(auto)[1] |
|
900 |
by (metis IntE Two_to_Three_aux UnCI lex_trans outside_lemma) |
|
901 |
||
902 |
||
903 |
definition fdpos :: "val \<Rightarrow> val \<Rightarrow> nat list \<Rightarrow> bool" |
|
904 |
where |
|
905 |
"fdpos v1 v2 p \<equiv> ({q. q \<sqsubset>lex p} \<inter> DPos v1 v2 = {})" |
|
906 |
||
907 |
||
908 |
lemma pos_append: |
|
909 |
assumes "p @ q \<in> Pos v" |
|
910 |
shows "q \<in> Pos (at v p)" |
|
911 |
using assms |
|
912 |
apply(induct arbitrary: p q rule: Pos.induct) |
|
913 |
apply(simp_all) |
|
914 |
apply(auto)[1] |
|
915 |
apply(simp add: append_eq_Cons_conv) |
|
916 |
apply(auto)[1] |
|
917 |
apply(auto)[1] |
|
918 |
apply(simp add: append_eq_Cons_conv) |
|
919 |
apply(auto)[1] |
|
920 |
apply(auto)[1] |
|
921 |
apply(simp add: append_eq_Cons_conv) |
|
922 |
apply(auto)[1] |
|
923 |
apply(simp add: append_eq_Cons_conv) |
|
924 |
apply(auto)[1] |
|
925 |
apply(auto)[1] |
|
926 |
apply(simp add: append_eq_Cons_conv) |
|
927 |
apply(auto)[1] |
|
928 |
apply(simp add: append_eq_Cons_conv) |
|
929 |
apply(auto)[1] |
|
930 |
by (metis append_Cons at.simps(6)) |
|
931 |
||
932 |
||
933 |
lemma Pos_pre: |
|
934 |
assumes "p \<in> Pos v" "q \<sqsubseteq>pre p" |
|
935 |
shows "q \<in> Pos v" |
|
936 |
using assms |
|
937 |
apply(induct v arbitrary: p q rule: Pos.induct) |
|
938 |
apply(simp_all add: prefix_list_def) |
|
939 |
apply (meson append_eq_Cons_conv append_is_Nil_conv) |
|
940 |
apply (meson append_eq_Cons_conv append_is_Nil_conv) |
|
941 |
apply (metis (no_types, lifting) Cons_eq_append_conv append_is_Nil_conv) |
|
942 |
apply(auto) |
|
943 |
apply (meson append_eq_Cons_conv) |
|
944 |
apply(simp add: append_eq_Cons_conv) |
|
945 |
apply(auto) |
|
946 |
done |
|
947 |
||
948 |
lemma lex_lists_order: |
|
949 |
assumes "q' \<sqsubset>lex q" "\<not>(q' \<sqsubseteq>pre q)" |
|
950 |
shows "\<not>(q \<sqsubset>lex q')" |
|
951 |
using assms |
|
952 |
apply(induct rule: lex_lists.induct) |
|
953 |
apply(simp add: prefix_list_def) |
|
954 |
apply(auto) |
|
955 |
using trichotomous_aux2 by auto |
|
956 |
||
957 |
lemma lex_appendL: |
|
958 |
assumes "q \<sqsubset>lex p" |
|
959 |
shows "q \<sqsubset>lex p @ q'" |
|
960 |
using assms |
|
961 |
apply(induct arbitrary: q' rule: lex_lists.induct) |
|
962 |
apply(auto) |
|
963 |
done |
|
964 |
||
965 |
||
966 |
inductive |
|
967 |
CPrf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<Turnstile> _ : _" [100, 100] 100) |
|
968 |
where |
|
969 |
"\<lbrakk>\<Turnstile> v1 : r1; \<Turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<Turnstile> Seq v1 v2 : SEQ r1 r2" |
|
970 |
| "\<Turnstile> v1 : r1 \<Longrightarrow> \<Turnstile> Left v1 : ALT r1 r2" |
|
971 |
| "\<Turnstile> v2 : r2 \<Longrightarrow> \<Turnstile> Right v2 : ALT r1 r2" |
|
972 |
| "\<Turnstile> Void : ONE" |
|
973 |
| "\<Turnstile> Char c : CHAR c" |
|
974 |
| "\<Turnstile> Stars [] : STAR r" |
|
975 |
| "\<lbrakk>\<Turnstile> v : r; flat v \<noteq> []; \<Turnstile> Stars vs : STAR r\<rbrakk> \<Longrightarrow> \<Turnstile> Stars (v # vs) : STAR r" |
|
976 |
||
977 |
lemma Prf_CPrf: |
|
978 |
assumes "\<Turnstile> v : r" |
|
979 |
shows "\<turnstile> v : r" |
|
980 |
using assms |
|
981 |
apply(induct) |
|
982 |
apply(auto intro: Prf.intros) |
|
983 |
done |
|
984 |
||
985 |
definition |
|
986 |
"CPT r s = {v. flat v = s \<and> \<Turnstile> v : r}" |
|
987 |
||
988 |
definition |
|
989 |
"CPTpre r s = {v. \<exists>s'. flat v @ s' = s \<and> \<Turnstile> v : r}" |
|
990 |
||
991 |
lemma CPT_CPTpre_subset: |
|
992 |
shows "CPT r s \<subseteq> CPTpre r s" |
|
993 |
apply(auto simp add: CPT_def CPTpre_def) |
|
994 |
done |
|
995 |
||
996 |
||
997 |
lemma CPTpre_subsets: |
|
998 |
"CPTpre ZERO s = {}" |
|
999 |
"CPTpre ONE s \<subseteq> {Void}" |
|
1000 |
"CPTpre (CHAR c) s \<subseteq> {Char c}" |
|
1001 |
"CPTpre (ALT r1 r2) s \<subseteq> Left ` CPTpre r1 s \<union> Right ` CPTpre r2 s" |
|
1002 |
"CPTpre (SEQ r1 r2) s \<subseteq> {Seq v1 v2 | v1 v2. v1 \<in> CPTpre r1 s \<and> v2 \<in> CPTpre r2 (drop (length (flat v1)) s)}" |
|
1003 |
"CPTpre (STAR r) s \<subseteq> {Stars []} \<union> |
|
1004 |
{Stars (v#vs) | v vs. v \<in> CPTpre r s \<and> flat v \<noteq> [] \<and> Stars vs \<in> CPTpre (STAR r) (drop (length (flat v)) s)}" |
|
1005 |
"CPTpre (STAR r) [] = {Stars []}" |
|
1006 |
apply(auto simp add: CPTpre_def) |
|
1007 |
apply(erule CPrf.cases) |
|
1008 |
apply(simp_all) |
|
1009 |
apply(erule CPrf.cases) |
|
1010 |
apply(simp_all) |
|
1011 |
apply(erule CPrf.cases) |
|
1012 |
apply(simp_all) |
|
1013 |
apply(erule CPrf.cases) |
|
1014 |
apply(simp_all) |
|
1015 |
apply(erule CPrf.cases) |
|
1016 |
apply(simp_all) |
|
1017 |
apply(erule CPrf.cases) |
|
1018 |
apply(simp_all) |
|
1019 |
apply(erule CPrf.cases) |
|
1020 |
apply(simp_all) |
|
1021 |
apply(rule CPrf.intros) |
|
1022 |
done |
|
1023 |
||
1024 |
||
1025 |
lemma CPTpre_simps: |
|
1026 |
shows "CPTpre ONE s = {Void}" |
|
1027 |
and "CPTpre (CHAR c) (d#s) = (if c = d then {Char c} else {})" |
|
1028 |
and "CPTpre (ALT r1 r2) s = Left ` CPTpre r1 s \<union> Right ` CPTpre r2 s" |
|
1029 |
and "CPTpre (SEQ r1 r2) s = |
|
1030 |
{Seq v1 v2 | v1 v2. v1 \<in> CPTpre r1 s \<and> v2 \<in> CPTpre r2 (drop (length (flat v1)) s)}" |
|
1031 |
apply - |
|
1032 |
apply(rule subset_antisym) |
|
1033 |
apply(rule CPTpre_subsets) |
|
1034 |
apply(auto simp add: CPTpre_def intro: "CPrf.intros")[1] |
|
1035 |
apply(case_tac "c = d") |
|
1036 |
apply(simp) |
|
1037 |
apply(rule subset_antisym) |
|
1038 |
apply(rule CPTpre_subsets) |
|
1039 |
apply(auto simp add: CPTpre_def intro: CPrf.intros)[1] |
|
1040 |
apply(simp) |
|
1041 |
apply(auto simp add: CPTpre_def intro: CPrf.intros)[1] |
|
1042 |
apply(erule CPrf.cases) |
|
1043 |
apply(simp_all) |
|
1044 |
apply(rule subset_antisym) |
|
1045 |
apply(rule CPTpre_subsets) |
|
1046 |
apply(auto simp add: CPTpre_def intro: CPrf.intros)[1] |
|
1047 |
apply(rule subset_antisym) |
|
1048 |
apply(rule CPTpre_subsets) |
|
1049 |
apply(auto simp add: CPTpre_def intro: CPrf.intros)[1] |
|
1050 |
done |
|
1051 |
||
1052 |
lemma CPT_simps: |
|
1053 |
shows "CPT ONE s = (if s = [] then {Void} else {})" |
|
1054 |
and "CPT (CHAR c) [d] = (if c = d then {Char c} else {})" |
|
1055 |
and "CPT (ALT r1 r2) s = Left ` CPT r1 s \<union> Right ` CPT r2 s" |
|
1056 |
and "CPT (SEQ r1 r2) s = |
|
1057 |
{Seq v1 v2 | v1 v2 s1 s2. s1 @ s2 = s \<and> v1 \<in> CPT r1 s1 \<and> v2 \<in> CPT r2 s2}" |
|
1058 |
apply - |
|
1059 |
apply(rule subset_antisym) |
|
1060 |
apply(auto simp add: CPT_def)[1] |
|
1061 |
apply(erule CPrf.cases) |
|
1062 |
apply(simp_all)[7] |
|
1063 |
apply(erule CPrf.cases) |
|
1064 |
apply(simp_all)[7] |
|
1065 |
apply(auto simp add: CPT_def intro: CPrf.intros)[1] |
|
1066 |
apply(auto simp add: CPT_def intro: CPrf.intros)[1] |
|
1067 |
apply(erule CPrf.cases) |
|
1068 |
apply(simp_all)[7] |
|
1069 |
apply(erule CPrf.cases) |
|
1070 |
apply(simp_all)[7] |
|
1071 |
apply(auto simp add: CPT_def image_def intro: CPrf.intros)[1] |
|
1072 |
apply(erule CPrf.cases) |
|
1073 |
apply(simp_all)[7] |
|
1074 |
apply(clarify) |
|
1075 |
apply blast |
|
1076 |
apply(auto simp add: CPT_def image_def intro: CPrf.intros)[1] |
|
1077 |
apply(erule CPrf.cases) |
|
1078 |
apply(simp_all)[7] |
|
1079 |
done |
|
1080 |
||
1081 |
lemma CPTpre_SEQ: |
|
1082 |
assumes "v \<in> CPTpre (SEQ r1 r2) s" |
|
1083 |
shows "\<exists>s'. flat v = s' \<and> (s' \<sqsubseteq>pre s) \<and> s' \<in> L (SEQ r1 r2)" |
|
1084 |
using assms |
|
1085 |
apply(simp add: CPTpre_simps) |
|
1086 |
apply(auto simp add: CPTpre_def) |
|
1087 |
apply (simp add: prefix_list_def) |
|
1088 |
by (metis L.simps(4) L_flat_Prf1 Prf.intros(1) Prf_CPrf flat.simps(5)) |
|
1089 |
||
1090 |
lemma Cond_prefix: |
|
1091 |
assumes "\<forall>s\<^sub>3. s1 @ s\<^sub>3 \<in> L r1 \<longrightarrow> s\<^sub>3 = [] \<or> (\<forall>s\<^sub>4. s1 @ s\<^sub>3 @ s\<^sub>4 \<sqsubseteq>pre s1 @ s2 \<longrightarrow> s\<^sub>4 \<notin> L r2)" |
|
1092 |
and "t1 \<in> L r1" "t2 \<in> L r2" "t1 @ t2 \<sqsubseteq>pre s1 @ s2" |
|
1093 |
shows "t1 \<sqsubseteq>pre s1" |
|
1094 |
using assms |
|
1095 |
apply(auto simp add: Sequ_def prefix_list_def append_eq_append_conv2) |
|
1096 |
done |
|
1097 |
||
1098 |
||
1099 |
||
1100 |
lemma test: |
|
1101 |
assumes "finite A" |
|
1102 |
shows "finite {vs. Stars vs \<in> A}" |
|
1103 |
using assms |
|
1104 |
apply(induct A) |
|
1105 |
apply(simp) |
|
1106 |
apply(auto) |
|
1107 |
apply(case_tac x) |
|
1108 |
apply(simp_all) |
|
1109 |
done |
|
1110 |
||
1111 |
lemma CPTpre_STAR_finite: |
|
1112 |
assumes "\<And>s. finite (CPTpre r s)" |
|
1113 |
shows "finite (CPTpre (STAR r) s)" |
|
1114 |
apply(induct s rule: length_induct) |
|
1115 |
apply(case_tac xs) |
|
1116 |
apply(simp) |
|
1117 |
apply(simp add: CPTpre_subsets) |
|
1118 |
apply(rule finite_subset) |
|
1119 |
apply(rule CPTpre_subsets) |
|
1120 |
apply(simp) |
|
1121 |
apply(rule_tac B="(\<lambda>(v, vs). Stars (v#vs)) ` {(v, vs). v \<in> CPTpre r (a#list) \<and> flat v \<noteq> [] \<and> Stars vs \<in> CPTpre (STAR r) (drop (length (flat v)) (a#list))}" in finite_subset) |
|
1122 |
apply(auto)[1] |
|
1123 |
apply(rule finite_imageI) |
|
1124 |
apply(simp add: Collect_case_prod_Sigma) |
|
1125 |
apply(rule finite_SigmaI) |
|
1126 |
apply(rule assms) |
|
1127 |
apply(case_tac "flat v = []") |
|
1128 |
apply(simp) |
|
1129 |
apply(drule_tac x="drop (length (flat v)) (a # list)" in spec) |
|
1130 |
apply(simp) |
|
1131 |
apply(auto)[1] |
|
1132 |
apply(rule test) |
|
1133 |
apply(simp) |
|
1134 |
done |
|
1135 |
||
1136 |
lemma CPTpre_finite: |
|
1137 |
shows "finite (CPTpre r s)" |
|
1138 |
apply(induct r arbitrary: s) |
|
1139 |
apply(simp add: CPTpre_subsets) |
|
1140 |
apply(rule finite_subset) |
|
1141 |
apply(rule CPTpre_subsets) |
|
1142 |
apply(simp) |
|
1143 |
apply(rule finite_subset) |
|
1144 |
apply(rule CPTpre_subsets) |
|
1145 |
apply(simp) |
|
1146 |
sorry |
|
1147 |
||
1148 |
||
1149 |
lemma CPT_finite: |
|
1150 |
shows "finite (CPT r s)" |
|
1151 |
apply(rule finite_subset) |
|
1152 |
apply(rule CPT_CPTpre_subset) |
|
1153 |
apply(rule CPTpre_finite) |
|
1154 |
done |
|
1155 |
||
1156 |
lemma Posix_CPT: |
|
1157 |
assumes "s \<in> r \<rightarrow> v" |
|
1158 |
shows "v \<in> CPT r s" |
|
1159 |
using assms |
|
1160 |
apply(induct rule: Posix.induct) |
|
1161 |
apply(simp add: CPT_def) |
|
1162 |
apply(rule CPrf.intros) |
|
1163 |
apply(simp add: CPT_def) |
|
1164 |
apply(rule CPrf.intros) |
|
1165 |
apply(simp add: CPT_def) |
|
1166 |
apply(rule CPrf.intros) |
|
1167 |
apply(simp) |
|
1168 |
apply(simp add: CPT_def) |
|
1169 |
apply(rule CPrf.intros) |
|
1170 |
apply(simp) |
|
1171 |
apply(simp add: CPT_def) |
|
1172 |
apply(rule CPrf.intros) |
|
1173 |
apply(simp) |
|
1174 |
apply(simp) |
|
1175 |
apply(simp add: CPT_def) |
|
1176 |
apply(rule CPrf.intros) |
|
1177 |
apply(simp) |
|
1178 |
apply(simp) |
|
1179 |
apply(simp) |
|
1180 |
apply(simp add: CPT_def) |
|
1181 |
apply(rule CPrf.intros) |
|
1182 |
done |
|
1183 |
||
1184 |
lemma Posix_val_ord: |
|
1185 |
assumes "s \<in> r \<rightarrow> v1" "v2 \<in> CPTpre r s" |
|
1186 |
shows "v1 :\<sqsubseteq>val v2" |
|
1187 |
using assms |
|
1188 |
apply(induct arbitrary: v2 rule: Posix.induct) |
|
1189 |
apply(simp add: CPTpre_def) |
|
1190 |
apply(clarify) |
|
1191 |
apply(erule CPrf.cases) |
|
1192 |
apply(simp_all) |
|
1193 |
apply(simp add: val_ord_ex1_def) |
|
1194 |
apply(simp add: CPTpre_def) |
|
1195 |
apply(clarify) |
|
1196 |
apply(erule CPrf.cases) |
|
1197 |
apply(simp_all) |
|
1198 |
apply(simp add: val_ord_ex1_def) |
|
1199 |
(* ALT1 *) |
|
1200 |
prefer 3 |
|
1201 |
(* SEQ case *) |
|
1202 |
apply(subst (asm) (3) CPTpre_def) |
|
1203 |
apply(clarify) |
|
1204 |
apply(erule CPrf.cases) |
|
1205 |
apply(simp_all) |
|
1206 |
apply(case_tac "s' = []") |
|
1207 |
apply(simp) |
|
1208 |
prefer 2 |
|
1209 |
apply(simp add: val_ord_ex1_def) |
|
1210 |
apply(clarify) |
|
1211 |
apply(simp) |
|
1212 |
apply(simp add: val_ord_ex_def) |
|
1213 |
apply(simp (no_asm) add: val_ord_def) |
|
1214 |
apply(rule_tac x="[]" in exI) |
|
1215 |
apply(simp add: pflat_len_simps) |
|
1216 |
apply(rule intlen_length) |
|
1217 |
apply (metis Posix1(2) append_assoc append_eq_conv_conj drop_eq_Nil not_le) |
|
1218 |
apply(subgoal_tac "length (flat v1a) \<le> length s1") |
|
1219 |
prefer 2 |
|
1220 |
apply (metis L_flat_Prf1 Prf_CPrf append_eq_append_conv_if append_take_drop_id drop_eq_Nil) |
|
1221 |
apply(subst (asm) append_eq_append_conv_if) |
|
1222 |
apply(simp) |
|
1223 |
apply(clarify) |
|
1224 |
apply(drule_tac x="v1a" in meta_spec) |
|
1225 |
apply(drule meta_mp) |
|
1226 |
apply(auto simp add: CPTpre_def)[1] |
|
1227 |
using append_eq_conv_conj apply blast |
|
1228 |
apply(subst (asm) (2)val_ord_ex1_def) |
|
1229 |
apply(erule disjE) |
|
1230 |
apply(subst (asm) val_ord_ex_def) |
|
1231 |
apply(erule exE) |
|
1232 |
apply(subst val_ord_ex1_def) |
|
1233 |
apply(rule disjI1) |
|
1234 |
apply(subst val_ord_ex_def) |
|
1235 |
apply(rule_tac x="0#p" in exI) |
|
1236 |
apply(rule val_ord_SEQI) |
|
1237 |
apply(simp) |
|
1238 |
apply(simp) |
|
1239 |
apply (metis Posix1(2) append_assoc append_take_drop_id) |
|
1240 |
apply(simp) |
|
1241 |
apply(drule_tac x="v2b" in meta_spec) |
|
1242 |
apply(drule meta_mp) |
|
1243 |
apply(auto simp add: CPTpre_def)[1] |
|
1244 |
apply (simp add: Posix1(2)) |
|
1245 |
apply(subst (asm) val_ord_ex1_def) |
|
1246 |
apply(erule disjE) |
|
1247 |
apply(subst (asm) val_ord_ex_def) |
|
1248 |
apply(erule exE) |
|
1249 |
apply(subst val_ord_ex1_def) |
|
1250 |
apply(rule disjI1) |
|
1251 |
apply(subst val_ord_ex_def) |
|
1252 |
apply(rule_tac x="1#p" in exI) |
|
1253 |
apply(rule val_ord_SEQI2) |
|
1254 |
apply(simp) |
|
1255 |
apply (simp add: Posix1(2)) |
|
1256 |
apply(subst val_ord_ex1_def) |
|
1257 |
apply(simp) |
|
1258 |
(* ALT *) |
|
1259 |
apply(subst (asm) (2) CPTpre_def) |
|
1260 |
apply(clarify) |
|
1261 |
apply(erule CPrf.cases) |
|
1262 |
apply(simp_all) |
|
1263 |
apply(clarify) |
|
1264 |
apply(case_tac "s' = []") |
|
1265 |
apply(simp) |
|
1266 |
apply(drule_tac x="v1" in meta_spec) |
|
1267 |
apply(drule meta_mp) |
|
1268 |
apply(auto simp add: CPTpre_def)[1] |
|
1269 |
apply(subst (asm) val_ord_ex1_def) |
|
1270 |
apply(erule disjE) |
|
1271 |
apply(subst (asm) val_ord_ex_def) |
|
1272 |
apply(erule exE) |
|
1273 |
apply(subst val_ord_ex1_def) |
|
1274 |
apply(rule disjI1) |
|
1275 |
apply(subst val_ord_ex_def) |
|
1276 |
apply(rule_tac x="0#p" in exI) |
|
1277 |
apply(rule val_ord_ALTI) |
|
1278 |
apply(simp) |
|
1279 |
using Posix1(2) apply blast |
|
1280 |
using val_ord_ex1_def apply blast |
|
1281 |
apply(subst val_ord_ex1_def) |
|
1282 |
apply(rule disjI1) |
|
1283 |
apply (simp add: Posix1(2) val_ord_shorterI) |
|
1284 |
apply(subst val_ord_ex1_def) |
|
1285 |
apply(rule disjI1) |
|
1286 |
apply(case_tac "s' = []") |
|
1287 |
apply(simp) |
|
1288 |
apply(subst val_ord_ex_def) |
|
1289 |
apply(rule_tac x="[0]" in exI) |
|
1290 |
apply(subst val_ord_def) |
|
1291 |
apply(rule conjI) |
|
1292 |
apply(simp add: Pos_empty) |
|
1293 |
apply(rule conjI) |
|
1294 |
apply(simp add: pflat_len_simps) |
|
1295 |
apply (smt inlen_bigger) |
|
1296 |
apply(simp) |
|
1297 |
apply(rule conjI) |
|
1298 |
apply(simp add: pflat_len_simps) |
|
1299 |
using Posix1(2) apply auto[1] |
|
1300 |
apply(rule ballI) |
|
1301 |
apply(rule impI) |
|
1302 |
apply(case_tac "q = []") |
|
1303 |
using Posix1(2) apply auto[1] |
|
1304 |
apply(auto)[1] |
|
1305 |
apply(rule val_ord_shorterI) |
|
1306 |
apply(simp) |
|
1307 |
apply (simp add: Posix1(2)) |
|
1308 |
(* ALT RIGHT *) |
|
1309 |
apply(subst (asm) (2) CPTpre_def) |
|
1310 |
apply(clarify) |
|
1311 |
apply(erule CPrf.cases) |
|
1312 |
apply(simp_all) |
|
1313 |
apply(clarify) |
|
1314 |
apply(case_tac "s' = []") |
|
1315 |
apply(simp) |
|
1316 |
apply (simp add: L_flat_Prf1 Prf_CPrf) |
|
1317 |
apply(subst val_ord_ex1_def) |
|
1318 |
apply(rule disjI1) |
|
1319 |
apply(rule val_ord_shorterI) |
|
1320 |
apply(simp) |
|
1321 |
apply (simp add: Posix1(2)) |
|
1322 |
apply(case_tac "s' = []") |
|
1323 |
apply(simp) |
|
1324 |
apply(drule_tac x="v2a" in meta_spec) |
|
1325 |
apply(drule meta_mp) |
|
1326 |
apply(auto simp add: CPTpre_def)[1] |
|
1327 |
apply(subst (asm) val_ord_ex1_def) |
|
1328 |
apply(erule disjE) |
|
1329 |
apply(subst (asm) val_ord_ex_def) |
|
1330 |
apply(erule exE) |
|
1331 |
apply(subst val_ord_ex1_def) |
|
1332 |
apply(rule disjI1) |
|
1333 |
apply(subst val_ord_ex_def) |
|
1334 |
apply(rule_tac x="1#p" in exI) |
|
1335 |
apply(rule val_ord_ALTI2) |
|
1336 |
apply(simp) |
|
1337 |
using Posix1(2) apply blast |
|
1338 |
apply (simp add: val_ord_ex1_def) |
|
1339 |
apply(subst val_ord_ex1_def) |
|
1340 |
apply(rule disjI1) |
|
1341 |
apply(rule val_ord_shorterI) |
|
1342 |
apply(simp) |
|
1343 |
apply (simp add: Posix1(2)) |
|
1344 |
(* STAR empty case *) |
|
1345 |
prefer 2 |
|
1346 |
apply(subst (asm) CPTpre_def) |
|
1347 |
apply(clarify) |
|
1348 |
apply(erule CPrf.cases) |
|
1349 |
apply(simp_all) |
|
1350 |
apply(clarify) |
|
1351 |
apply (simp add: val_ord_ex1_def) |
|
1352 |
(* STAR non-empty case *) |
|
1353 |
apply(subst (asm) (3) CPTpre_def) |
|
1354 |
apply(clarify) |
|
1355 |
apply(erule CPrf.cases) |
|
1356 |
apply(simp_all) |
|
1357 |
apply(clarify) |
|
1358 |
apply (simp add: val_ord_ex1_def) |
|
1359 |
apply(rule val_ord_shorterI) |
|
1360 |
apply(simp) |
|
1361 |
apply(case_tac "s' = []") |
|
1362 |
apply(simp) |
|
1363 |
prefer 2 |
|
1364 |
apply (simp add: val_ord_ex1_def) |
|
1365 |
apply(rule disjI1) |
|
1366 |
apply(rule val_ord_shorterI) |
|
1367 |
apply(simp) |
|
1368 |
apply (metis Posix1(2) append_assoc append_eq_conv_conj drop_all flat.simps(7) flat_Stars length_append not_less) |
|
1369 |
apply(drule_tac x="va" in meta_spec) |
|
1370 |
apply(drule meta_mp) |
|
1371 |
apply(auto simp add: CPTpre_def)[1] |
|
1372 |
apply (smt L.simps(6) L_flat_Prf1 Prf_CPrf append_eq_append_conv2 flat_Stars self_append_conv) |
|
1373 |
apply (subst (asm) (2) val_ord_ex1_def) |
|
1374 |
apply(erule disjE) |
|
1375 |
prefer 2 |
|
1376 |
apply(simp) |
|
1377 |
apply(drule_tac x="Stars vsa" in meta_spec) |
|
1378 |
apply(drule meta_mp) |
|
1379 |
apply(auto simp add: CPTpre_def)[1] |
|
1380 |
apply (simp add: Posix1(2)) |
|
1381 |
apply (subst (asm) val_ord_ex1_def) |
|
1382 |
apply(erule disjE) |
|
1383 |
apply (subst (asm) val_ord_ex_def) |
|
1384 |
apply(erule exE) |
|
1385 |
apply (subst val_ord_ex1_def) |
|
1386 |
apply(rule disjI1) |
|
1387 |
apply (subst val_ord_ex_def) |
|
1388 |
apply(case_tac p) |
|
1389 |
apply(simp) |
|
1390 |
apply (metis Posix1(2) flat_Stars not_less_iff_gr_or_eq pflat_len_simps(7) same_append_eq val_ord_def) |
|
1391 |
using Posix1(2) val_ord_STARI2 apply fastforce |
|
1392 |
apply(simp add: val_ord_ex1_def) |
|
1393 |
apply (subst (asm) val_ord_ex_def) |
|
1394 |
apply(erule exE) |
|
1395 |
apply (subst val_ord_ex1_def) |
|
1396 |
apply(rule disjI1) |
|
1397 |
apply (subst val_ord_ex_def) |
|
1398 |
by (metis Posix1(2) flat.simps(7) flat_Stars val_ord_STARI) |
|
1399 |
||
1400 |
lemma Posix_val_ord_stronger: |
|
1401 |
assumes "s \<in> r \<rightarrow> v1" "v2 \<in> CPT r s" |
|
1402 |
shows "v1 :\<sqsubseteq>val v2" |
|
1403 |
using assms |
|
1404 |
apply(rule_tac Posix_val_ord) |
|
1405 |
apply(assumption) |
|
1406 |
apply(simp add: CPTpre_def CPT_def) |
|
1407 |
done |
|
1408 |
||
246 | 1409 |
|
1410 |
lemma STAR_val_ord: |
|
1411 |
assumes "Stars (v1 # vs1) \<sqsubset>val (Suc p # ps) Stars (v2 # vs2)" "flat v1 = flat v2" |
|
1412 |
shows "(Stars vs1) \<sqsubset>val (p # ps) (Stars vs2)" |
|
1413 |
using assms(1,2) |
|
1414 |
apply - |
|
1415 |
apply(simp(no_asm) add: val_ord_def) |
|
1416 |
apply(rule conjI) |
|
1417 |
apply(simp add: val_ord_def) |
|
1418 |
apply(rule conjI) |
|
1419 |
apply(simp add: val_ord_def) |
|
1420 |
apply(auto simp add: pflat_len_simps pflat_len_Stars_simps2)[1] |
|
1421 |
apply(rule ballI) |
|
1422 |
apply(rule impI) |
|
1423 |
apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
|
1424 |
apply(clarify) |
|
1425 |
apply(case_tac q) |
|
1426 |
apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
|
1427 |
apply(clarify) |
|
1428 |
apply(erule disjE) |
|
1429 |
prefer 2 |
|
1430 |
apply(drule_tac x="Suc a # list" in bspec) |
|
1431 |
apply(simp) |
|
1432 |
apply(drule mp) |
|
1433 |
apply(simp) |
|
1434 |
apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
|
1435 |
apply(drule_tac x="Suc a # list" in bspec) |
|
1436 |
apply(simp) |
|
1437 |
apply(drule mp) |
|
1438 |
apply(simp) |
|
1439 |
apply(simp add: val_ord_def pflat_len_simps pflat_len_Stars_simps2 intlen_append) |
|
1440 |
done |
|
1441 |
||
1442 |
||
1443 |
lemma Posix_val_ord_reverse: |
|
1444 |
assumes "s \<in> r \<rightarrow> v1" |
|
1445 |
shows "\<not>(\<exists>v2 \<in> CPT r s. v2 :\<sqsubset>val v1)" |
|
1446 |
using assms |
|
247 | 1447 |
by (metis Posix_val_ord_stronger less_irrefl val_ord_def |
1448 |
val_ord_ex1_def val_ord_ex_def val_ord_ex_trans) |
|
1449 |
||
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1450 |
thm Posix.intros(6) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1451 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1452 |
inductive Prop :: "rexp \<Rightarrow> val list \<Rightarrow> bool" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1453 |
where |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1454 |
"Prop r []" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1455 |
| "\<lbrakk>Prop r vs; |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1456 |
\<not> (\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = concat (map flat vs) \<and> flat v @ s\<^sub>3 \<in> L r \<and> s\<^sub>4 \<in> L (STAR r))\<rbrakk> |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1457 |
\<Longrightarrow> Prop r (v # vs)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1458 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1459 |
lemma STAR_val_ord_ex: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1460 |
assumes "Stars (v # vs1) :\<sqsubset>val Stars (v # vs2)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1461 |
shows "Stars vs1 :\<sqsubset>val Stars vs2" |
247 | 1462 |
using assms |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1463 |
apply(subst (asm) val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1464 |
apply(erule exE) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1465 |
apply(case_tac p) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1466 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1467 |
apply(simp add: val_ord_def pflat_len_simps intlen_append) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1468 |
apply(subst val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1469 |
apply(rule_tac x="[]" in exI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1470 |
apply(simp add: val_ord_def pflat_len_simps Pos_empty) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1471 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1472 |
apply(case_tac a) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1473 |
apply(clarify) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1474 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1475 |
using STAR_val_ord val_ord_ex_def apply blast |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1476 |
apply(auto simp add: pflat_len_Stars_simps2 val_ord_def pflat_len_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1477 |
done |
247 | 1478 |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1479 |
lemma STAR_val_ord_exI: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1480 |
assumes "Stars vs1 :\<sqsubset>val Stars vs2" "flat (Stars vs1) = flat (Stars vs2)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1481 |
shows "Stars (vs @ vs1) :\<sqsubset>val Stars (vs @ vs2)" |
247 | 1482 |
using assms |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1483 |
apply(induct vs) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1484 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1485 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1486 |
apply(simp add: val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1487 |
apply(erule exE) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1488 |
apply(case_tac p) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1489 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1490 |
apply(rule_tac x="[]" in exI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1491 |
apply(simp add: val_ord_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1492 |
apply(auto simp add: pflat_len_simps intlen_append)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1493 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1494 |
apply(rule_tac x="Suc aa#list" in exI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1495 |
apply(rule val_ord_STARI2) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1496 |
apply(simp) |
246 | 1497 |
apply(simp) |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1498 |
done |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1499 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1500 |
lemma STAR_val_ord_ex_append: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1501 |
assumes "Stars (vs @ vs1) :\<sqsubset>val Stars (vs @ vs2)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1502 |
shows "Stars vs1 :\<sqsubset>val Stars vs2" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1503 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1504 |
apply(induct vs) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1505 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1506 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1507 |
apply(drule STAR_val_ord_ex) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1508 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1509 |
done |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1510 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1511 |
lemma STAR_val_ord_ex_append_eq: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1512 |
assumes "flat (Stars vs1) = flat (Stars vs2)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1513 |
shows "Stars (vs @ vs1) :\<sqsubset>val Stars (vs @ vs2) \<longleftrightarrow> Stars vs1 :\<sqsubset>val Stars vs2" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1514 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1515 |
apply(rule_tac iffI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1516 |
apply(erule STAR_val_ord_ex_append) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1517 |
apply(rule STAR_val_ord_exI) |
247 | 1518 |
apply(auto) |
1519 |
done |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1520 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1521 |
lemma Posix_STARI: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1522 |
assumes "\<forall>v \<in> set vs. flat v \<noteq> [] \<and> (flat v) \<in> r \<rightarrow> v" "Prop r vs" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1523 |
shows "flat (Stars vs) \<in> STAR r \<rightarrow> Stars vs" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1524 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1525 |
apply(induct vs arbitrary: r) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1526 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1527 |
apply(rule Posix.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1528 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1529 |
apply(rule Posix.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1530 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1531 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1532 |
apply(erule Prop.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1533 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1534 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1535 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1536 |
apply(erule Prop.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1537 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1538 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1539 |
done |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1540 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1541 |
lemma CPrf_stars: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1542 |
assumes "\<Turnstile> Stars vs : STAR r" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1543 |
shows "\<forall>v \<in> set vs. flat v \<noteq> [] \<and> \<Turnstile> v : r" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1544 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1545 |
apply(induct vs) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1546 |
apply(auto) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1547 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1548 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1549 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1550 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1551 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1552 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1553 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1554 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1555 |
done |
247 | 1556 |
|
1557 |
definition PT :: "rexp \<Rightarrow> string \<Rightarrow> val set" |
|
1558 |
where "PT r s \<equiv> {v. flat v = s \<and> \<turnstile> v : r}" |
|
1559 |
||
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1560 |
lemma exists: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1561 |
assumes "s \<in> (L r)\<star>" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1562 |
shows "\<exists>vs. concat (map flat vs) = s \<and> \<turnstile> Stars vs : STAR r" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1563 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1564 |
apply(drule_tac Star_string) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1565 |
apply(auto) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1566 |
by (metis L_flat_Prf2 Prf_Stars Star_val) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1567 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1568 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1569 |
lemma val_ord_Posix_Stars: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1570 |
assumes "(Stars vs) \<in> CPT (STAR r) (flat (Stars vs))" "\<forall>v \<in> set vs. flat v \<in> r \<rightarrow> v" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1571 |
and "\<not>(\<exists>vs2 \<in> PT (STAR r) (flat (Stars vs)). vs2 :\<sqsubset>val (Stars vs))" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1572 |
shows "(flat (Stars vs)) \<in> (STAR r) \<rightarrow> Stars vs" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1573 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1574 |
apply(induct vs) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1575 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1576 |
apply(rule Posix.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1577 |
apply(simp (no_asm)) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1578 |
apply(rule Posix.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1579 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1580 |
apply(auto simp add: CPT_def PT_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1581 |
defer |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1582 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1583 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1584 |
apply(auto simp add: CPT_def PT_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1585 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1586 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1587 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1588 |
apply(auto simp add: CPT_def PT_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1589 |
apply(erule Prf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1590 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1591 |
apply (metis CPrf_stars Cons_eq_map_conv Posix_CPT Posix_STAR2 Posix_val_ord_reverse list.exhaust list.set_intros(2) map_idI val.distinct(25)) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1592 |
apply(clarify) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1593 |
apply(drule_tac x="Stars (a#v#vsa)" in spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1594 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1595 |
apply(drule mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1596 |
apply (meson CPrf_stars Prf.intros(7) Prf_CPrf list.set_intros(1)) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1597 |
apply(subst (asm) (2) val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1598 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1599 |
apply (metis flat.simps(7) flat_Stars intlen.cases not_less_iff_gr_or_eq pflat_len_simps(7) val_ord_STARI2 val_ord_def val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1600 |
apply(auto simp add: CPT_def PT_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1601 |
using CPrf_stars apply auto[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1602 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1603 |
apply(auto simp add: CPT_def PT_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1604 |
apply(subgoal_tac "\<exists>vA. flat vA = flat a @ s\<^sub>3 \<and> \<turnstile> vA : r") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1605 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1606 |
apply (meson L_flat_Prf2) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1607 |
apply(subgoal_tac "\<exists>vB. flat (Stars vB) = s\<^sub>4 \<and> \<turnstile> (Stars vB) : (STAR r)") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1608 |
apply(clarify) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1609 |
apply(drule_tac x="Stars (vA # vB)" in spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1610 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1611 |
apply(drule mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1612 |
using Prf.intros(7) apply blast |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1613 |
apply(subst (asm) (2) val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1614 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1615 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1616 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1617 |
using exists apply blast |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1618 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1619 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1620 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1621 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1622 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1623 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1624 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1625 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1626 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1627 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1628 |
apply(clarify) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1629 |
apply(rotate_tac 3) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1630 |
apply(erule Prf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1631 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1632 |
apply (metis CPrf_stars intlen.cases less_irrefl list.set_intros(1) val_ord_def val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1633 |
apply(drule_tac x="Stars (v#va#vsb)" in spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1634 |
apply(drule mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1635 |
apply (simp add: Posix1a Prf.intros(7)) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1636 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1637 |
apply(subst (asm) (2) val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1638 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1639 |
apply (metis flat.simps(7) flat_Stars intlen.cases not_less_iff_gr_or_eq pflat_len_simps(7) val_ord_STARI2 val_ord_def val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1640 |
proof - |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1641 |
fix a :: val and vsa :: "val list" and s\<^sub>3 :: "char list" and vA :: val and vB :: "val list" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1642 |
assume a1: "s\<^sub>3 \<noteq> []" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1643 |
assume a2: "s\<^sub>3 @ concat (map flat vB) = concat (map flat vsa)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1644 |
assume a3: "flat vA = flat a @ s\<^sub>3" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1645 |
assume a4: "\<forall>p. \<not> Stars (vA # vB) \<sqsubset>val p Stars (a # vsa)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1646 |
have f5: "\<And>n cs. drop n (cs::char list) = [] \<or> n < length cs" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1647 |
by (meson drop_eq_Nil not_less) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1648 |
have f6: "\<not> length (flat vA) \<le> length (flat a)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1649 |
using a3 a1 by simp |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1650 |
have "flat (Stars (a # vsa)) = flat (Stars (vA # vB))" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1651 |
using a3 a2 by simp |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1652 |
then show False |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1653 |
using f6 f5 a4 by (metis (full_types) drop_eq_Nil val_ord_STARI val_ord_ex_def val_ord_shorterI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1654 |
qed |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1655 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1656 |
lemma Prf_Stars_append: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1657 |
assumes "\<turnstile> Stars vs1 : STAR r" "\<turnstile> Stars vs2 : STAR r" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1658 |
shows "\<turnstile> Stars (vs1 @ vs2) : STAR r" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1659 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1660 |
apply(induct vs1 arbitrary: vs2) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1661 |
apply(auto intro: Prf.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1662 |
apply(erule Prf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1663 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1664 |
apply(auto intro: Prf.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1665 |
done |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1666 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1667 |
lemma CPrf_Stars_appendE: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1668 |
assumes "\<Turnstile> Stars (vs1 @ vs2) : STAR r" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1669 |
shows "\<Turnstile> Stars vs1 : STAR r \<and> \<Turnstile> Stars vs2 : STAR r" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1670 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1671 |
apply(induct vs1 arbitrary: vs2) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1672 |
apply(auto intro: CPrf.intros)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1673 |
apply(erule CPrf.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1674 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1675 |
apply(auto intro: CPrf.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1676 |
done |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1677 |
|
247 | 1678 |
lemma val_ord_Posix: |
1679 |
assumes "v1 \<in> CPT r s" "\<not>(\<exists>v2 \<in> PT r s. v2 :\<sqsubset>val v1)" |
|
1680 |
shows "s \<in> r \<rightarrow> v1" |
|
1681 |
using assms |
|
1682 |
apply(induct r arbitrary: s v1) |
|
1683 |
apply(auto simp add: CPT_def PT_def)[1] |
|
1684 |
apply(erule CPrf.cases) |
|
1685 |
apply(simp_all) |
|
1686 |
(* ONE *) |
|
1687 |
apply(auto simp add: CPT_def)[1] |
|
1688 |
apply(erule CPrf.cases) |
|
1689 |
apply(simp_all) |
|
1690 |
apply(rule Posix.intros) |
|
1691 |
(* CHAR *) |
|
1692 |
apply(auto simp add: CPT_def)[1] |
|
1693 |
apply(erule CPrf.cases) |
|
1694 |
apply(simp_all) |
|
1695 |
apply(rule Posix.intros) |
|
246 | 1696 |
prefer 2 |
247 | 1697 |
(* ALT *) |
1698 |
apply(auto simp add: CPT_def PT_def)[1] |
|
1699 |
apply(erule CPrf.cases) |
|
1700 |
apply(simp_all) |
|
1701 |
apply(rule Posix.intros) |
|
1702 |
apply(drule_tac x="flat v1a" in meta_spec) |
|
1703 |
apply(drule_tac x="v1a" in meta_spec) |
|
1704 |
apply(drule meta_mp) |
|
1705 |
apply(simp) |
|
1706 |
apply(drule meta_mp) |
|
1707 |
apply(auto)[1] |
|
1708 |
apply(drule_tac x="Left v2" in spec) |
|
1709 |
apply(simp) |
|
1710 |
apply(drule mp) |
|
1711 |
apply(rule Prf.intros) |
|
246 | 1712 |
apply(simp) |
247 | 1713 |
apply (meson val_ord_ALTI val_ord_ex_def) |
1714 |
apply(assumption) |
|
1715 |
(* ALT Right *) |
|
1716 |
apply(auto simp add: CPT_def)[1] |
|
1717 |
apply(rule Posix.intros) |
|
1718 |
apply(rotate_tac 1) |
|
1719 |
apply(drule_tac x="flat v2" in meta_spec) |
|
1720 |
apply(drule_tac x="v2" in meta_spec) |
|
1721 |
apply(drule meta_mp) |
|
246 | 1722 |
apply(simp) |
247 | 1723 |
apply(drule meta_mp) |
1724 |
apply(auto)[1] |
|
1725 |
apply(drule_tac x="Right v2a" in spec) |
|
1726 |
apply(simp) |
|
1727 |
apply(drule mp) |
|
1728 |
apply(rule Prf.intros) |
|
246 | 1729 |
apply(simp) |
1730 |
apply(subst (asm) (2) val_ord_ex_def) |
|
247 | 1731 |
apply(erule exE) |
1732 |
apply(drule val_ord_ALTI2) |
|
1733 |
apply(assumption) |
|
1734 |
apply(auto simp add: val_ord_ex_def)[1] |
|
1735 |
apply(assumption) |
|
1736 |
apply(auto)[1] |
|
1737 |
apply(subgoal_tac "\<exists>v2'. flat v2' = flat v2 \<and> \<turnstile> v2' : r1a") |
|
246 | 1738 |
apply(clarify) |
247 | 1739 |
apply(drule_tac x="Left v2'" in spec) |
246 | 1740 |
apply(simp) |
247 | 1741 |
apply(drule mp) |
1742 |
apply(rule Prf.intros) |
|
1743 |
apply(assumption) |
|
1744 |
apply(simp add: val_ord_ex_def) |
|
1745 |
apply(subst (asm) (3) val_ord_def) |
|
246 | 1746 |
apply(simp) |
1747 |
apply(simp add: pflat_len_simps) |
|
247 | 1748 |
apply(drule_tac x="[0]" in spec) |
1749 |
apply(simp add: pflat_len_simps Pos_empty) |
|
1750 |
apply(drule mp) |
|
1751 |
apply (smt inlen_bigger) |
|
1752 |
apply(erule disjE) |
|
1753 |
apply blast |
|
1754 |
apply auto[1] |
|
1755 |
apply (meson L_flat_Prf2) |
|
1756 |
(* SEQ *) |
|
1757 |
apply(auto simp add: CPT_def)[1] |
|
1758 |
apply(erule CPrf.cases) |
|
1759 |
apply(simp_all) |
|
1760 |
apply(rule Posix.intros) |
|
1761 |
apply(drule_tac x="flat v1a" in meta_spec) |
|
1762 |
apply(drule_tac x="v1a" in meta_spec) |
|
1763 |
apply(drule meta_mp) |
|
1764 |
apply(simp) |
|
1765 |
apply(drule meta_mp) |
|
1766 |
apply(auto)[1] |
|
1767 |
apply(auto simp add: PT_def)[1] |
|
1768 |
apply(drule_tac x="Seq v2a v2" in spec) |
|
1769 |
apply(simp) |
|
1770 |
apply(drule mp) |
|
1771 |
apply (simp add: Prf.intros(1) Prf_CPrf) |
|
1772 |
using val_ord_SEQI val_ord_ex_def apply fastforce |
|
1773 |
apply(assumption) |
|
1774 |
apply(rotate_tac 1) |
|
1775 |
apply(drule_tac x="flat v2" in meta_spec) |
|
1776 |
apply(drule_tac x="v2" in meta_spec) |
|
1777 |
apply(simp) |
|
1778 |
apply(auto)[1] |
|
1779 |
apply(drule meta_mp) |
|
1780 |
apply(auto)[1] |
|
1781 |
apply(auto simp add: PT_def)[1] |
|
1782 |
apply(drule_tac x="Seq v1a v2a" in spec) |
|
1783 |
apply(simp) |
|
1784 |
apply(drule mp) |
|
1785 |
apply (simp add: Prf.intros(1) Prf_CPrf) |
|
1786 |
apply (meson val_ord_SEQI2 val_ord_ex_def) |
|
1787 |
apply(assumption) |
|
1788 |
(* SEQ side condition *) |
|
1789 |
apply(auto simp add: PT_def) |
|
1790 |
apply(subgoal_tac "\<exists>vA. flat vA = flat v1a @ s\<^sub>3 \<and> \<turnstile> vA : r1a") |
|
1791 |
prefer 2 |
|
1792 |
apply (meson L_flat_Prf2) |
|
1793 |
apply(subgoal_tac "\<exists>vB. flat vB = s\<^sub>4 \<and> \<turnstile> vB : r2a") |
|
1794 |
prefer 2 |
|
1795 |
apply (meson L_flat_Prf2) |
|
1796 |
apply(clarify) |
|
1797 |
apply(drule_tac x="Seq vA vB" in spec) |
|
1798 |
apply(simp) |
|
1799 |
apply(drule mp) |
|
1800 |
apply (simp add: Prf.intros(1)) |
|
1801 |
apply(subst (asm) (3) val_ord_ex_def) |
|
1802 |
apply (metis append_Nil2 append_assoc append_eq_conv_conj flat.simps(5) length_append not_add_less1 not_less_iff_gr_or_eq val_ord_SEQI val_ord_ex_def val_ord_shorterI) |
|
1803 |
(* STAR *) |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1804 |
apply(auto simp add: CPT_def)[1] |
245 | 1805 |
apply(erule CPrf.cases) |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1806 |
apply(simp_all)[6] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1807 |
using Posix_STAR2 apply blast |
245 | 1808 |
apply(clarify) |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1809 |
apply(rule val_ord_Posix_Stars) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1810 |
apply(auto simp add: CPT_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1811 |
apply (simp add: CPrf.intros(7)) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1812 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1813 |
apply(drule_tac x="flat v" in meta_spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1814 |
apply(drule_tac x="v" in meta_spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1815 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1816 |
apply(drule meta_mp) |
245 | 1817 |
apply(auto)[1] |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1818 |
apply(drule_tac x="Stars (v2#vs)" in spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1819 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1820 |
apply(drule mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1821 |
using Prf.intros(7) Prf_CPrf apply blast |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1822 |
apply(subst (asm) (2) val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1823 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1824 |
using val_ord_STARI val_ord_ex_def apply fastforce |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1825 |
apply(assumption) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1826 |
apply(drule_tac x="flat va" in meta_spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1827 |
apply(drule_tac x="va" in meta_spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1828 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1829 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1830 |
using CPrf_stars apply blast |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1831 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1832 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1833 |
apply(subgoal_tac "\<exists>pre post. vs = pre @ [va] @ post") |
245 | 1834 |
prefer 2 |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1835 |
apply (metis append_Cons append_Nil in_set_conv_decomp_first) |
245 | 1836 |
apply(clarify) |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1837 |
apply(drule_tac x="Stars (v#(pre @ [v2] @ post))" in spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1838 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1839 |
apply(drule mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1840 |
apply(rule Prf.intros) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1841 |
apply (simp add: Prf_CPrf) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1842 |
apply(rule Prf_Stars_append) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1843 |
apply(drule CPrf_Stars_appendE) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1844 |
apply(auto simp add: Prf_CPrf)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1845 |
apply (metis CPrf_Stars_appendE CPrf_stars Prf_CPrf Prf_Stars list.set_intros(2) set_ConsD) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1846 |
apply(subgoal_tac "\<not> Stars ([v] @ pre @ v2 # post) :\<sqsubset>val Stars ([v] @ pre @ va # post)") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1847 |
apply(subst (asm) STAR_val_ord_ex_append_eq) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1848 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1849 |
apply(subst (asm) STAR_val_ord_ex_append_eq) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1850 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1851 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1852 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1853 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1854 |
apply(simp) |
245 | 1855 |
apply(simp add: val_ord_ex_def) |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1856 |
apply(erule exE) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1857 |
apply(rotate_tac 6) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1858 |
apply(drule_tac x="0#p" in spec) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1859 |
apply (simp add: val_ord_STARI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1860 |
apply(auto simp add: PT_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1861 |
done |
245 | 1862 |
|
1863 |
inductive ValOrd :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<preceq>_ _" [100, 100, 100] 100) |
|
1864 |
where |
|
1865 |
C2: "v1 \<preceq>r1 v1' \<Longrightarrow> (Seq v1 v2) \<preceq>(SEQ r1 r2) (Seq v1' v2')" |
|
1866 |
| C1: "v2 \<preceq>r2 v2' \<Longrightarrow> (Seq v1 v2) \<preceq>(SEQ r1 r2) (Seq v1 v2')" |
|
1867 |
| A1: "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) \<preceq>(ALT r1 r2) (Left v1)" |
|
1868 |
| A2: "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) \<preceq>(ALT r1 r2) (Right v2)" |
|
1869 |
| A3: "v2 \<preceq>r2 v2' \<Longrightarrow> (Right v2) \<preceq>(ALT r1 r2) (Right v2')" |
|
1870 |
| A4: "v1 \<preceq>r1 v1' \<Longrightarrow> (Left v1) \<preceq>(ALT r1 r2) (Left v1')" |
|
1871 |
| K1: "flat (Stars (v # vs)) = [] \<Longrightarrow> (Stars []) \<preceq>(STAR r) (Stars (v # vs))" |
|
1872 |
| K2: "flat (Stars (v # vs)) \<noteq> [] \<Longrightarrow> (Stars (v # vs)) \<preceq>(STAR r) (Stars [])" |
|
1873 |
| K3: "v1 \<preceq>r v2 \<Longrightarrow> (Stars (v1 # vs1)) \<preceq>(STAR r) (Stars (v2 # vs2))" |
|
1874 |
| K4: "(Stars vs1) \<preceq>(STAR r) (Stars vs2) \<Longrightarrow> (Stars (v # vs1)) \<preceq>(STAR r) (Stars (v # vs2))" |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1875 |
(*| MY1: "Void \<preceq>ONE Void" |
245 | 1876 |
| MY2: "(Char c) \<preceq>(CHAR c) (Char c)" |
1877 |
| MY3: "(Stars []) \<preceq>(STAR r) (Stars [])" |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1878 |
*) |
245 | 1879 |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1880 |
(* |
245 | 1881 |
lemma ValOrd_refl: |
1882 |
assumes "\<turnstile> v : r" |
|
1883 |
shows "v \<preceq>r v" |
|
1884 |
using assms |
|
1885 |
apply(induct r rule: Prf.induct) |
|
1886 |
apply(rule ValOrd.intros) |
|
1887 |
apply(simp) |
|
1888 |
apply(rule ValOrd.intros) |
|
1889 |
apply(simp) |
|
1890 |
apply(rule ValOrd.intros) |
|
1891 |
apply(simp) |
|
1892 |
apply(rule ValOrd.intros) |
|
1893 |
apply(rule ValOrd.intros) |
|
1894 |
apply(rule ValOrd.intros) |
|
1895 |
apply(rule ValOrd.intros) |
|
1896 |
apply(simp) |
|
1897 |
done |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1898 |
*) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1899 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1900 |
lemma ValOrd_irrefl: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1901 |
assumes "\<turnstile> v : r" "v \<preceq>r v" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1902 |
shows "False" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1903 |
using assms |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1904 |
apply(induct v r rule: Prf.induct) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1905 |
apply(erule ValOrd.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1906 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1907 |
apply(erule ValOrd.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1908 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1909 |
apply(erule ValOrd.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1910 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1911 |
apply(erule ValOrd.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1912 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1913 |
apply(erule ValOrd.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1914 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1915 |
apply(erule ValOrd.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1916 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1917 |
apply(erule ValOrd.cases) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1918 |
apply(simp_all) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1919 |
done |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1920 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1921 |
lemma prefix_sprefix: |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1922 |
shows "xs \<sqsubseteq>pre ys \<longleftrightarrow> (xs = ys \<or> xs \<sqsubset>spre ys)" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1923 |
apply(auto simp add: sprefix_list_def prefix_list_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1924 |
done |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1925 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1926 |
|
245 | 1927 |
|
1928 |
lemma Posix_CPT2: |
|
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1929 |
assumes "v1 \<preceq>r v2" "flat v2 \<sqsubseteq>pre flat v1" |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1930 |
shows "v1 :\<sqsubset>val v2" |
245 | 1931 |
using assms |
248
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1932 |
apply(induct v1 r v2 arbitrary: rule: ValOrd.induct) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1933 |
prefer 3 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1934 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1935 |
apply(auto simp add: prefix_sprefix)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1936 |
apply(rule val_ord_spre) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1937 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1938 |
prefer 3 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1939 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1940 |
apply(auto simp add: prefix_sprefix)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1941 |
apply(auto simp add: val_ord_ex_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1942 |
apply(rule_tac x="[0]" in exI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1943 |
apply(auto simp add: val_ord_def Pos_empty pflat_len_simps)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1944 |
apply (smt inlen_bigger) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1945 |
apply(rule val_ord_spre) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1946 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1947 |
prefer 3 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1948 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1949 |
apply(auto simp add: prefix_sprefix)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1950 |
using val_ord_ALTI2 val_ord_ex_def apply fastforce |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1951 |
apply(rule val_ord_spre) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1952 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1953 |
prefer 3 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1954 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1955 |
apply(auto simp add: prefix_sprefix)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1956 |
using val_ord_ALTI val_ord_ex_def apply fastforce |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1957 |
apply(rule val_ord_spre) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1958 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1959 |
(* SEQ case *) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1960 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1961 |
apply(auto simp add: prefix_sprefix)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1962 |
apply(auto simp add: append_eq_append_conv2)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1963 |
apply(case_tac "us = []") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1964 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1965 |
apply(auto simp add: val_ord_ex1_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1966 |
apply (metis flat.simps(5) val_ord_SEQI val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1967 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1968 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1969 |
apply(case_tac "us = []") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1970 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1971 |
apply (metis flat.simps(5) val_ord_SEQI val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1972 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1973 |
apply(rule disjI2) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1974 |
apply (metis append_self_conv prefix_list_def sprefix_list_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1975 |
apply(auto simp add: val_ord_ex_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1976 |
apply (metis append_assoc flat.simps(5) val_ord_SEQI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1977 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1978 |
apply(sugoal_ tac "") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1979 |
thm val_ord_SEQI |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1980 |
apply(rule val_ord_SEQI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1981 |
thm val_ord_SEQI |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1982 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1983 |
apply(case_tac "us |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1984 |
apply(case_tac "v1 = v1'") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1985 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1986 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1987 |
apply(auto simp add: val_ord_ex1_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1988 |
apply(auto simp add: val_ord_ex_def)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1989 |
apply(rule_tac x="[0]" in exI) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1990 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1991 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1992 |
apply(rule val_ord_spre) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1993 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1994 |
prefer 3 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1995 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1996 |
using val_ord_ex1_def val_ord_spre apply auto[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1997 |
|
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1998 |
apply(erule disjE) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
1999 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2000 |
apply(subst val_ord_ex1_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2001 |
apply(rule disjI1) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2002 |
apply(rule val_ord_spre) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2003 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2004 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2005 |
apply(simp add: append_eq_append_conv2) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2006 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2007 |
apply(case_tac "us = []") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2008 |
apply(simp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2009 |
apply(drule meta_mp) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2010 |
apply(auto simp add: prefix_sprefix)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2011 |
apply(subst (asm) val_ord_ex1_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2012 |
apply(erule disjE) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2013 |
apply(subst val_ord_ex1_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2014 |
apply(rule disjI1) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2015 |
apply (metis flat.simps(5) val_ord_SEQI val_ord_ex_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2016 |
apply(clarify) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2017 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2018 |
apply(subgoal_tac "flat v1' \<sqsubset>spre flat v1") |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2019 |
prefer 2 |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2020 |
apply (simp add: prefix_list_def sprefix_list_def) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2021 |
apply(drule val_ord_spre) |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2022 |
apply(auto)[1] |
b90ff5abb437
added a proof that Positional ordering is equivalent to direct posix definition
Christian Urban <urbanc@in.tum.de>
parents:
247
diff
changeset
|
2023 |
apply(rule val_ord_sprefixI) |
245 | 2024 |
apply(erule ValOrd.cases) |
2025 |
apply(simp_all) |
|
2026 |
apply(erule ValOrd.cases) |
|
2027 |
apply(simp_all) |
|
2028 |
apply(erule ValOrd.cases) |
|
2029 |
apply(simp_all) |
|
2030 |
apply(erule ValOrd.cases) |
|
2031 |
apply(simp_all) |
|
2032 |
apply(clarify) |
|
2033 |
(* HERE *) |
|
2034 |
apply(simp) |
|
2035 |
apply(subst val_ord_ex_def) |
|
2036 |
apply(simp) |
|
2037 |
apply(drule_tac x="v2a" in meta_spec) |
|
2038 |
apply(rotate_tac 5) |
|
2039 |
apply(drule_tac x="v2'" in meta_spec) |
|
2040 |
apply(rule_tac x="0#p" in exI) |
|
2041 |
apply(rule val_ord_SEQI) |
|
2042 |
||
2043 |
apply(drule_tac r="r1a" in val_ord_SEQ) |
|
2044 |
apply(simp) |
|
2045 |
apply(auto)[1] |
|
2046 |
||
2047 |
||
2048 |
lemma Posix_CPT: |
|
2049 |
assumes "v1 :\<sqsubset>val v2" "v1 \<in> CPT r s" "v2 \<in> CPT r s" |
|
2050 |
shows "v1 \<preceq>r v2" |
|
2051 |
using assms |
|
2052 |
apply(induct r arbitrary: v1 v2 s rule: rexp.induct) |
|
2053 |
apply(simp add: CPT_def) |
|
2054 |
apply(clarify) |
|
2055 |
apply(erule CPrf.cases) |
|
2056 |
apply(simp_all) |
|
2057 |
apply(simp add: CPT_def) |
|
2058 |
apply(clarify) |
|
2059 |
apply(erule CPrf.cases) |
|
2060 |
apply(simp_all) |
|
2061 |
apply(erule CPrf.cases) |
|
2062 |
apply(simp_all) |
|
2063 |
apply(rule ValOrd.intros) |
|
2064 |
apply(simp add: CPT_def) |
|
2065 |
apply(clarify) |
|
2066 |
apply(erule CPrf.cases) |
|
2067 |
apply(simp_all) |
|
2068 |
apply(erule CPrf.cases) |
|
2069 |
apply(simp_all) |
|
2070 |
apply(rule ValOrd.intros) |
|
2071 |
(*SEQ case *) |
|
2072 |
apply(simp add: CPT_def) |
|
2073 |
apply(clarify) |
|
2074 |
apply(erule CPrf.cases) |
|
2075 |
apply(simp_all) |
|
2076 |
apply(clarify) |
|
2077 |
apply(erule CPrf.cases) |
|
2078 |
apply(simp_all) |
|
2079 |
apply(clarify) |
|
2080 |
thm val_ord_SEQ |
|
2081 |
apply(drule_tac r="r1a" in val_ord_SEQ) |
|
2082 |
apply(simp) |
|
2083 |
using Prf_CPrf apply blast |
|
2084 |
using Prf_CPrf apply blast |
|
2085 |
apply(erule disjE) |
|
2086 |
apply(rule C2) |
|
2087 |
prefer 2 |
|
2088 |
apply(simp) |
|
2089 |
apply(rule C1) |
|
2090 |
apply blast |
|
2091 |
||
2092 |
apply(simp add: append_eq_append_conv2) |
|
2093 |
apply(clarify) |
|
2094 |
apply(auto)[1] |
|
2095 |
apply(drule_tac x="v1a" in meta_spec) |
|
2096 |
apply(rotate_tac 8) |
|
2097 |
apply(drule_tac x="v1b" in meta_spec) |
|
2098 |
apply(rotate_tac 8) |
|
2099 |
apply(simp) |
|
2100 |
||
2101 |
(* HERE *) |
|
2102 |
apply(subst (asm) (3) val_ord_ex_def) |
|
2103 |
apply(clarify) |
|
2104 |
apply(subst (asm) val_ord_def) |
|
2105 |
apply(clarify) |
|
2106 |
apply(rule ValOrd.intros) |
|
2107 |
||
2108 |
||
2109 |
apply(simp add: val_ord_ex_def) |
|
2110 |
oops |
|
2111 |
||
2112 |
||
2113 |
lemma ValOrd_trans: |
|
2114 |
assumes "x \<preceq>r y" "y \<preceq>r z" |
|
2115 |
and "x \<in> CPT r s" "y \<in> CPT r s" "z \<in> CPT r s" |
|
2116 |
shows "x \<preceq>r z" |
|
2117 |
using assms |
|
2118 |
apply(induct x r y arbitrary: s z rule: ValOrd.induct) |
|
2119 |
apply(rotate_tac 2) |
|
2120 |
apply(erule ValOrd.cases) |
|
2121 |
apply(simp_all)[13] |
|
2122 |
apply(rule ValOrd.intros) |
|
2123 |
apply(drule_tac x="s" in meta_spec) |
|
2124 |
apply(drule_tac x="v1'a" in meta_spec) |
|
2125 |
apply(drule_tac meta_mp) |
|
2126 |
apply(simp) |
|
2127 |
apply(drule_tac meta_mp) |
|
2128 |
apply(simp add: CPT_def) |
|
2129 |
oops |
|
2130 |
||
2131 |
lemma ValOrd_preorder: |
|
2132 |
"preorder_on (CPT r s) {(v1, v2). v1 \<preceq>r v2 \<and> v1 \<in> (CPT r s) \<and> v2 \<in> (CPT r s)}" |
|
2133 |
apply(simp add: preorder_on_def) |
|
2134 |
apply(rule conjI) |
|
2135 |
apply(simp add: refl_on_def) |
|
2136 |
apply(auto) |
|
2137 |
apply(rule ValOrd_refl) |
|
2138 |
apply(simp add: CPT_def) |
|
2139 |
apply(rule Prf_CPrf) |
|
2140 |
apply(auto)[1] |
|
2141 |
apply(simp add: trans_def) |
|
2142 |
apply(auto) |
|
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2143 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2144 |
definition ValOrdEq :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<ge>_ _" [100, 100, 100] 100) |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2145 |
where |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2146 |
"v\<^sub>1 \<ge>r v\<^sub>2 \<equiv> v\<^sub>1 = v\<^sub>2 \<or> (v\<^sub>1 >r v\<^sub>2 \<and> flat v\<^sub>1 = flat v\<^sub>2)" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2147 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2148 |
(* |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2149 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2150 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2151 |
inductive ValOrd :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<succ>_ _" [100, 100, 100] 100) |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2152 |
where |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2153 |
"v2 \<succ>r2 v2' \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1 v2')" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2154 |
| "\<lbrakk>v1 \<succ>r1 v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2155 |
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Right v2)" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2156 |
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Left v1)" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2157 |
| "v2 \<succ>r2 v2' \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Right v2')" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2158 |
| "v1 \<succ>r1 v1' \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Left v1')" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2159 |
| "Void \<succ>EMPTY Void" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2160 |
| "(Char c) \<succ>(CHAR c) (Char c)" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2161 |
| "flat (Stars (v # vs)) = [] \<Longrightarrow> (Stars []) \<succ>(STAR r) (Stars (v # vs))" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2162 |
| "flat (Stars (v # vs)) \<noteq> [] \<Longrightarrow> (Stars (v # vs)) \<succ>(STAR r) (Stars [])" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2163 |
| "\<lbrakk>v1 \<succ>r v2; v1 \<noteq> v2\<rbrakk> \<Longrightarrow> (Stars (v1 # vs1)) \<succ>(STAR r) (Stars (v2 # vs2))" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2164 |
| "(Stars vs1) \<succ>(STAR r) (Stars vs2) \<Longrightarrow> (Stars (v # vs1)) \<succ>(STAR r) (Stars (v # vs2))" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2165 |
| "(Stars []) \<succ>(STAR r) (Stars [])" |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2166 |
*) |
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2167 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2168 |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2169 |
section {* Bit-Encodings *} |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2170 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2171 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2172 |
fun |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2173 |
code :: "val \<Rightarrow> rexp \<Rightarrow> bool list" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2174 |
where |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2175 |
"code Void ONE = []" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2176 |
| "code (Char c) (CHAR d) = []" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2177 |
| "code (Left v) (ALT r1 r2) = False # (code v r1)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2178 |
| "code (Right v) (ALT r1 r2) = True # (code v r2)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2179 |
| "code (Seq v1 v2) (SEQ r1 r2) = (code v1 r1) @ (code v2 r2)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2180 |
| "code (Stars []) (STAR r) = [True]" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2181 |
| "code (Stars (v # vs)) (STAR r) = False # (code v r) @ code (Stars vs) (STAR r)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2182 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2183 |
fun |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2184 |
Stars_add :: "val \<Rightarrow> val \<Rightarrow> val" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2185 |
where |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2186 |
"Stars_add v (Stars vs) = Stars (v # vs)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2187 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2188 |
function |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2189 |
decode' :: "bool list \<Rightarrow> rexp \<Rightarrow> (val * bool list)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2190 |
where |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2191 |
"decode' ds ZERO = (Void, [])" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2192 |
| "decode' ds ONE = (Void, ds)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2193 |
| "decode' ds (CHAR d) = (Char d, ds)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2194 |
| "decode' [] (ALT r1 r2) = (Void, [])" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2195 |
| "decode' (False # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r1 in (Left v, ds'))" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2196 |
| "decode' (True # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r2 in (Right v, ds'))" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2197 |
| "decode' ds (SEQ r1 r2) = (let (v1, ds') = decode' ds r1 in |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2198 |
let (v2, ds'') = decode' ds' r2 in (Seq v1 v2, ds''))" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2199 |
| "decode' [] (STAR r) = (Void, [])" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2200 |
| "decode' (True # ds) (STAR r) = (Stars [], ds)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2201 |
| "decode' (False # ds) (STAR r) = (let (v, ds') = decode' ds r in |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2202 |
let (vs, ds'') = decode' ds' (STAR r) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2203 |
in (Stars_add v vs, ds''))" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2204 |
by pat_completeness auto |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2205 |
|
204
cd9e40280784
added paper about size derivatives
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
185
diff
changeset
|
2206 |
termination |
cd9e40280784
added paper about size derivatives
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
185
diff
changeset
|
2207 |
apply(size_change) |
cd9e40280784
added paper about size derivatives
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
185
diff
changeset
|
2208 |
oops |
cd9e40280784
added paper about size derivatives
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
185
diff
changeset
|
2209 |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2210 |
term "inv_image (measure(%cs. size cs) <*lex*> measure(%s. size s)) (%(ds,r). (r,ds))" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2211 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2212 |
lemma decode'_smaller: |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2213 |
assumes "decode'_dom (ds, r)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2214 |
shows "length (snd (decode' ds r)) \<le> length ds" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2215 |
using assms |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2216 |
apply(induct ds r) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2217 |
apply(auto simp add: decode'.psimps split: prod.split) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2218 |
using dual_order.trans apply blast |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2219 |
by (meson dual_order.trans le_SucI) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2220 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2221 |
termination "decode'" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2222 |
apply(relation "inv_image (measure(%cs. size cs) <*lex*> measure(%s. size s)) (%(ds,r). (r,ds))") |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2223 |
apply(auto dest!: decode'_smaller) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2224 |
by (metis less_Suc_eq_le snd_conv) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2225 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2226 |
fun |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2227 |
decode :: "bool list \<Rightarrow> rexp \<Rightarrow> val option" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2228 |
where |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2229 |
"decode ds r = (let (v, ds') = decode' ds r |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2230 |
in (if ds' = [] then Some v else None))" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2231 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2232 |
lemma decode'_code: |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2233 |
assumes "\<turnstile> v : r" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2234 |
shows "decode' ((code v r) @ ds) r = (v, ds)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2235 |
using assms |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2236 |
by (induct v r arbitrary: ds) (auto) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2237 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2238 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2239 |
lemma decode_code: |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2240 |
assumes "\<turnstile> v : r" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2241 |
shows "decode (code v r) r = Some v" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2242 |
using assms decode'_code[of _ _ "[]"] |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2243 |
by auto |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
2244 |
|
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2245 |
datatype arexp = |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2246 |
AZERO |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2247 |
| AONE "bool list" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2248 |
| ACHAR "bool list" char |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2249 |
| ASEQ "bool list" arexp arexp |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2250 |
| AALT "bool list" arexp arexp |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2251 |
| ASTAR "bool list" arexp |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2252 |
|
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2253 |
fun fuse :: "bool list \<Rightarrow> arexp \<Rightarrow> arexp" where |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2254 |
"fuse bs AZERO = AZERO" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2255 |
| "fuse bs (AONE cs) = AONE (bs @ cs)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2256 |
| "fuse bs (ACHAR cs c) = ACHAR (bs @ cs) c" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2257 |
| "fuse bs (AALT cs r1 r2) = AALT (bs @ cs) r1 r2" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2258 |
| "fuse bs (ASEQ cs r1 r2) = ASEQ (bs @ cs) r1 r2" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2259 |
| "fuse bs (ASTAR cs r) = ASTAR (bs @ cs) r" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2260 |
|
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2261 |
fun internalise :: "rexp \<Rightarrow> arexp" where |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2262 |
"internalise ZERO = AZERO" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2263 |
| "internalise ONE = AONE []" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2264 |
| "internalise (CHAR c) = ACHAR [] c" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2265 |
| "internalise (ALT r1 r2) = AALT [] (fuse [False] (internalise r1)) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2266 |
(fuse [True] (internalise r2))" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2267 |
| "internalise (SEQ r1 r2) = ASEQ [] (internalise r1) (internalise r2)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2268 |
| "internalise (STAR r) = ASTAR [] (internalise r)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2269 |
|
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2270 |
fun retrieve :: "arexp \<Rightarrow> val \<Rightarrow> bool list" where |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2271 |
"retrieve (AONE bs) Void = bs" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2272 |
| "retrieve (ACHAR bs c) (Char d) = bs" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2273 |
| "retrieve (AALT bs r1 r2) (Left v) = bs @ retrieve r1 v" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2274 |
| "retrieve (AALT bs r1 r2) (Right v) = bs @ retrieve r2 v" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2275 |
| "retrieve (ASEQ bs r1 r2) (Seq v1 v2) = bs @ retrieve r1 v1 @ retrieve r2 v2" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2276 |
| "retrieve (ASTAR bs r) (Stars []) = bs @ [True]" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2277 |
| "retrieve (ASTAR bs r) (Stars (v#vs)) = |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2278 |
bs @ [False] @ retrieve r v @ retrieve (ASTAR [] r) (Stars vs)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2279 |
|
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2280 |
fun |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2281 |
anullable :: "arexp \<Rightarrow> bool" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2282 |
where |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2283 |
"anullable (AZERO) = False" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2284 |
| "anullable (AONE bs) = True" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2285 |
| "anullable (ACHAR bs c) = False" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2286 |
| "anullable (AALT bs r1 r2) = (anullable r1 \<or> anullable r2)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2287 |
| "anullable (ASEQ bs r1 r2) = (anullable r1 \<and> anullable r2)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2288 |
| "anullable (ASTAR bs r) = True" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2289 |
|
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2290 |
fun |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2291 |
amkeps :: "arexp \<Rightarrow> bool list" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2292 |
where |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2293 |
"amkeps(AONE bs) = bs" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2294 |
| "amkeps(ASEQ bs r1 r2) = bs @ (amkeps r1) @ (amkeps r2)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2295 |
| "amkeps(AALT bs r1 r2) = (if anullable(r1) then bs @ (amkeps r1) else bs @ (amkeps r2))" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2296 |
| "amkeps(ASTAR bs r) = bs @ [True]" |
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2297 |
|
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2298 |
|
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2299 |
fun |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2300 |
ader :: "char \<Rightarrow> arexp \<Rightarrow> arexp" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2301 |
where |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2302 |
"ader c (AZERO) = AZERO" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2303 |
| "ader c (AONE bs) = AZERO" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2304 |
| "ader c (ACHAR bs d) = (if c = d then AONE bs else AZERO)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2305 |
| "ader c (AALT bs r1 r2) = AALT bs (ader c r1) (ader c r2)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2306 |
| "ader c (ASEQ bs r1 r2) = |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2307 |
(if anullable r1 |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2308 |
then AALT bs (ASEQ [] (ader c r1) r2) (fuse (amkeps r1) (ader c r2)) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2309 |
else ASEQ bs (ader c r1) r2)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2310 |
| "ader c (ASTAR bs r) = ASEQ bs (fuse [False] (ader c r)) (ASTAR [] r)" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2311 |
|
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2312 |
lemma |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2313 |
assumes "\<turnstile> v : der c r" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2314 |
shows "Some (injval r c v) = decode (retrieve (ader c (internalise r)) v) r" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2315 |
using assms |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2316 |
apply(induct c r arbitrary: v rule: der.induct) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2317 |
apply(simp_all) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2318 |
apply(erule Prf_elims) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2319 |
apply(erule Prf_elims) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2320 |
apply(case_tac "c = d") |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2321 |
apply(simp) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2322 |
apply(erule Prf_elims) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2323 |
apply(simp) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2324 |
apply(simp) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2325 |
apply(erule Prf_elims) |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2326 |
apply(auto split: prod.splits)[1] |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2327 |
oops |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
2328 |
|
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2329 |
end |