author | Christian Urban <urbanc@in.tum.de> |
Thu, 23 May 2019 13:30:09 +0100 | |
changeset 324 | d9d4146325d9 |
parent 323 | 09ce1cdb70ab |
child 325 | 2a128087215f |
permissions | -rw-r--r-- |
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
|
311 | 2 |
theory BitCoded |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
3 |
imports "Lexer" |
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 |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
6 |
section {* Bit-Encodings *} |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
7 |
|
289 | 8 |
datatype bit = Z | S |
9 |
||
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
10 |
fun |
289 | 11 |
code :: "val \<Rightarrow> bit list" |
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
12 |
where |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
13 |
"code Void = []" |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
14 |
| "code (Char c) = []" |
289 | 15 |
| "code (Left v) = Z # (code v)" |
16 |
| "code (Right v) = S # (code v)" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
17 |
| "code (Seq v1 v2) = (code v1) @ (code v2)" |
289 | 18 |
| "code (Stars []) = [S]" |
19 |
| "code (Stars (v # vs)) = (Z # code v) @ code (Stars vs)" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
20 |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
21 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
22 |
fun |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
23 |
Stars_add :: "val \<Rightarrow> val \<Rightarrow> val" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
24 |
where |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
25 |
"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
|
26 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
27 |
function |
289 | 28 |
decode' :: "bit list \<Rightarrow> rexp \<Rightarrow> (val * bit list)" |
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
29 |
where |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
30 |
"decode' ds ZERO = (Void, [])" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
31 |
| "decode' ds ONE = (Void, ds)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
32 |
| "decode' ds (CHAR d) = (Char d, ds)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
33 |
| "decode' [] (ALT r1 r2) = (Void, [])" |
289 | 34 |
| "decode' (Z # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r1 in (Left v, ds'))" |
35 |
| "decode' (S # ds) (ALT r1 r2) = (let (v, ds') = decode' ds r2 in (Right v, ds'))" |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
36 |
| "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
|
37 |
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
|
38 |
| "decode' [] (STAR r) = (Void, [])" |
289 | 39 |
| "decode' (S # ds) (STAR r) = (Stars [], ds)" |
40 |
| "decode' (Z # ds) (STAR r) = (let (v, ds') = decode' ds r in |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
41 |
let (vs, ds'') = decode' ds' (STAR r) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
42 |
in (Stars_add v vs, ds''))" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
43 |
by pat_completeness auto |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
44 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
45 |
lemma decode'_smaller: |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
46 |
assumes "decode'_dom (ds, r)" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
47 |
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
|
48 |
using assms |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
49 |
apply(induct ds r) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
50 |
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
|
51 |
using dual_order.trans apply blast |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
52 |
by (meson dual_order.trans le_SucI) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
53 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
54 |
termination "decode'" |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
55 |
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
|
56 |
apply(auto dest!: decode'_smaller) |
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
57 |
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
|
58 |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
59 |
definition |
289 | 60 |
decode :: "bit list \<Rightarrow> rexp \<Rightarrow> val option" |
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
61 |
where |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
62 |
"decode ds r \<equiv> (let (v, ds') = decode' ds r |
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
63 |
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
|
64 |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
65 |
lemma decode'_code_Stars: |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
66 |
assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> (\<forall>x. decode' (code v @ x) r = (v, x)) \<and> flat v \<noteq> []" |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
67 |
shows "decode' (code (Stars vs) @ ds) (STAR r) = (Stars vs, ds)" |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
68 |
using assms |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
69 |
apply(induct vs) |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
70 |
apply(auto) |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
71 |
done |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
72 |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
73 |
lemma decode'_code: |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
74 |
assumes "\<Turnstile> v : r" |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
75 |
shows "decode' ((code v) @ ds) r = (v, ds)" |
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
76 |
using assms |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
77 |
apply(induct v r arbitrary: ds) |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
78 |
apply(auto) |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
79 |
using decode'_code_Stars by blast |
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
80 |
|
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
81 |
lemma decode_code: |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
82 |
assumes "\<Turnstile> v : r" |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
83 |
shows "decode (code v) r = Some v" |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
84 |
using assms unfolding decode_def |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
85 |
by (smt append_Nil2 decode'_code old.prod.case) |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
86 |
|
154
2de3cf684ba0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
87 |
|
311 | 88 |
section {* Annotated Regular Expressions *} |
89 |
||
314 | 90 |
datatype arexp = |
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
91 |
AZERO |
289 | 92 |
| AONE "bit list" |
93 |
| ACHAR "bit list" char |
|
94 |
| ASEQ "bit list" arexp arexp |
|
311 | 95 |
| AALTs "bit list" "arexp list" |
289 | 96 |
| ASTAR "bit list" arexp |
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
97 |
|
311 | 98 |
abbreviation |
99 |
"AALT bs r1 r2 \<equiv> AALTs bs [r1, r2]" |
|
100 |
||
317 | 101 |
fun asize :: "arexp \<Rightarrow> nat" where |
102 |
"asize AZERO = 1" |
|
103 |
| "asize (AONE cs) = 1" |
|
104 |
| "asize (ACHAR cs c) = 1" |
|
105 |
| "asize (AALTs cs rs) = Suc (sum_list (map asize rs))" |
|
106 |
| "asize (ASEQ cs r1 r2) = Suc (asize r1 + asize r2)" |
|
107 |
| "asize (ASTAR cs r) = Suc (asize r)" |
|
108 |
||
322 | 109 |
fun |
110 |
erase :: "arexp \<Rightarrow> rexp" |
|
111 |
where |
|
112 |
"erase AZERO = ZERO" |
|
113 |
| "erase (AONE _) = ONE" |
|
114 |
| "erase (ACHAR _ c) = CHAR c" |
|
115 |
| "erase (AALTs _ []) = ZERO" |
|
116 |
| "erase (AALTs _ [r]) = (erase r)" |
|
117 |
| "erase (AALTs bs (r#rs)) = ALT (erase r) (erase (AALTs bs rs))" |
|
118 |
| "erase (ASEQ _ r1 r2) = SEQ (erase r1) (erase r2)" |
|
119 |
| "erase (ASTAR _ r) = STAR (erase r)" |
|
120 |
||
121 |
fun nonalt :: "arexp \<Rightarrow> bool" |
|
122 |
where |
|
123 |
"nonalt (AALTs bs2 rs) = False" |
|
124 |
| "nonalt r = True" |
|
125 |
||
126 |
||
127 |
fun good :: "arexp \<Rightarrow> bool" where |
|
128 |
"good AZERO = False" |
|
129 |
| "good (AONE cs) = True" |
|
130 |
| "good (ACHAR cs c) = True" |
|
131 |
| "good (AALTs cs []) = False" |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
132 |
| "good (AALTs cs [r]) = False" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
133 |
| "good (AALTs cs (r1#r2#rs)) = (\<forall>r' \<in> set (r1#r2#rs). good r' \<and> nonalt r')" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
134 |
| "good (ASEQ _ AZERO _) = False" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
135 |
| "good (ASEQ _ (AONE _) _) = False" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
136 |
| "good (ASEQ _ _ AZERO) = False" |
322 | 137 |
| "good (ASEQ cs r1 r2) = (good r1 \<and> good r2)" |
138 |
| "good (ASTAR cs r) = True" |
|
139 |
||
140 |
||
317 | 141 |
|
311 | 142 |
|
289 | 143 |
fun fuse :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp" where |
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
144 |
"fuse bs AZERO = AZERO" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
145 |
| "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
|
146 |
| "fuse bs (ACHAR cs c) = ACHAR (bs @ cs) c" |
311 | 147 |
| "fuse bs (AALTs cs rs) = AALTs (bs @ cs) rs" |
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
148 |
| "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
|
149 |
| "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
|
150 |
|
314 | 151 |
lemma fuse_append: |
152 |
shows "fuse (bs1 @ bs2) r = fuse bs1 (fuse bs2 r)" |
|
153 |
apply(induct r) |
|
154 |
apply(auto) |
|
155 |
done |
|
156 |
||
157 |
||
289 | 158 |
fun intern :: "rexp \<Rightarrow> arexp" where |
159 |
"intern ZERO = AZERO" |
|
160 |
| "intern ONE = AONE []" |
|
161 |
| "intern (CHAR c) = ACHAR [] c" |
|
162 |
| "intern (ALT r1 r2) = AALT [] (fuse [Z] (intern r1)) |
|
295 | 163 |
(fuse [S] (intern r2))" |
289 | 164 |
| "intern (SEQ r1 r2) = ASEQ [] (intern r1) (intern r2)" |
165 |
| "intern (STAR r) = ASTAR [] (intern r)" |
|
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
166 |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
167 |
|
289 | 168 |
fun retrieve :: "arexp \<Rightarrow> val \<Rightarrow> bit list" where |
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
169 |
"retrieve (AONE bs) Void = bs" |
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
170 |
| "retrieve (ACHAR bs c) (Char d) = bs" |
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
171 |
| "retrieve (AALTs bs [r]) v = bs @ retrieve r v" |
311 | 172 |
| "retrieve (AALTs bs (r#rs)) (Left v) = bs @ retrieve r v" |
173 |
| "retrieve (AALTs bs (r#rs)) (Right v) = bs @ retrieve (AALTs [] rs) v" |
|
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
174 |
| "retrieve (ASEQ bs r1 r2) (Seq v1 v2) = bs @ retrieve r1 v1 @ retrieve r2 v2" |
289 | 175 |
| "retrieve (ASTAR bs r) (Stars []) = bs @ [S]" |
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
176 |
| "retrieve (ASTAR bs r) (Stars (v#vs)) = |
289 | 177 |
bs @ [Z] @ retrieve r v @ retrieve (ASTAR [] r) (Stars vs)" |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
178 |
|
322 | 179 |
|
289 | 180 |
|
181 |
fun |
|
182 |
bnullable :: "arexp \<Rightarrow> bool" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
183 |
where |
289 | 184 |
"bnullable (AZERO) = False" |
185 |
| "bnullable (AONE bs) = True" |
|
186 |
| "bnullable (ACHAR bs c) = False" |
|
311 | 187 |
| "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)" |
289 | 188 |
| "bnullable (ASEQ bs r1 r2) = (bnullable r1 \<and> bnullable r2)" |
189 |
| "bnullable (ASTAR bs r) = True" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
190 |
|
289 | 191 |
fun |
192 |
bmkeps :: "arexp \<Rightarrow> bit list" |
|
193 |
where |
|
194 |
"bmkeps(AONE bs) = bs" |
|
195 |
| "bmkeps(ASEQ bs r1 r2) = bs @ (bmkeps r1) @ (bmkeps r2)" |
|
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
196 |
| "bmkeps(AALTs bs [r]) = bs @ (bmkeps r)" |
311 | 197 |
| "bmkeps(AALTs bs (r#rs)) = (if bnullable(r) then bs @ (bmkeps r) else (bmkeps (AALTs bs rs)))" |
289 | 198 |
| "bmkeps(ASTAR bs r) = bs @ [S]" |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
199 |
|
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
200 |
|
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
201 |
fun |
289 | 202 |
bder :: "char \<Rightarrow> arexp \<Rightarrow> arexp" |
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
203 |
where |
289 | 204 |
"bder c (AZERO) = AZERO" |
205 |
| "bder c (AONE bs) = AZERO" |
|
206 |
| "bder c (ACHAR bs d) = (if c = d then AONE bs else AZERO)" |
|
311 | 207 |
| "bder c (AALTs bs rs) = AALTs bs (map (bder c) rs)" |
289 | 208 |
| "bder c (ASEQ bs r1 r2) = |
209 |
(if bnullable r1 |
|
210 |
then AALT bs (ASEQ [] (bder c r1) r2) (fuse (bmkeps r1) (bder c r2)) |
|
211 |
else ASEQ bs (bder c r1) r2)" |
|
212 |
| "bder c (ASTAR bs r) = ASEQ bs (fuse [Z] (bder c r)) (ASTAR [] r)" |
|
159
940530087f30
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
154
diff
changeset
|
213 |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
214 |
|
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
215 |
fun |
289 | 216 |
bders :: "arexp \<Rightarrow> string \<Rightarrow> arexp" |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
217 |
where |
289 | 218 |
"bders r [] = r" |
219 |
| "bders r (c#s) = bders (bder c r) s" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
220 |
|
289 | 221 |
lemma bders_append: |
222 |
"bders r (s1 @ s2) = bders (bders r s1) s2" |
|
287 | 223 |
apply(induct s1 arbitrary: r s2) |
224 |
apply(simp_all) |
|
225 |
done |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
226 |
|
289 | 227 |
lemma bnullable_correctness: |
228 |
shows "nullable (erase r) = bnullable r" |
|
311 | 229 |
apply(induct r rule: erase.induct) |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
230 |
apply(simp_all) |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
231 |
done |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
232 |
|
289 | 233 |
lemma erase_fuse: |
234 |
shows "erase (fuse bs r) = erase r" |
|
311 | 235 |
apply(induct r rule: erase.induct) |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
236 |
apply(simp_all) |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
237 |
done |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
238 |
|
311 | 239 |
lemma erase_intern [simp]: |
289 | 240 |
shows "erase (intern r) = r" |
287 | 241 |
apply(induct r) |
289 | 242 |
apply(simp_all add: erase_fuse) |
287 | 243 |
done |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
244 |
|
311 | 245 |
lemma erase_bder [simp]: |
289 | 246 |
shows "erase (bder a r) = der a (erase r)" |
311 | 247 |
apply(induct r rule: erase.induct) |
289 | 248 |
apply(simp_all add: erase_fuse bnullable_correctness) |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
249 |
done |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
250 |
|
311 | 251 |
lemma erase_bders [simp]: |
289 | 252 |
shows "erase (bders r s) = ders s (erase r)" |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
253 |
apply(induct s arbitrary: r ) |
289 | 254 |
apply(simp_all) |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
255 |
done |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
256 |
|
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
257 |
lemma retrieve_encode_STARS: |
289 | 258 |
assumes "\<forall>v\<in>set vs. \<Turnstile> v : r \<and> code v = retrieve (intern r) v" |
259 |
shows "code (Stars vs) = retrieve (ASTAR [] (intern r)) (Stars vs)" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
260 |
using assms |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
261 |
apply(induct vs) |
289 | 262 |
apply(simp_all) |
263 |
done |
|
264 |
||
265 |
lemma retrieve_fuse2: |
|
266 |
assumes "\<Turnstile> v : (erase r)" |
|
267 |
shows "retrieve (fuse bs r) v = bs @ retrieve r v" |
|
268 |
using assms |
|
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
269 |
apply(induct r arbitrary: v bs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
270 |
apply(auto elim: Prf_elims)[4] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
271 |
defer |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
272 |
using retrieve_encode_STARS |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
273 |
apply(auto elim!: Prf_elims)[1] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
274 |
apply(case_tac vs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
275 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
276 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
277 |
(* AALTs case *) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
278 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
279 |
apply(case_tac x2a) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
280 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
281 |
apply(auto elim!: Prf_elims)[1] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
282 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
283 |
apply(case_tac list) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
284 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
285 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
286 |
apply(auto elim!: Prf_elims)[1] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
287 |
done |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
288 |
|
289 | 289 |
lemma retrieve_fuse: |
290 |
assumes "\<Turnstile> v : r" |
|
291 |
shows "retrieve (fuse bs (intern r)) v = bs @ retrieve (intern r) v" |
|
292 |
using assms |
|
293 |
by (simp_all add: retrieve_fuse2) |
|
294 |
||
295 |
||
296 |
lemma retrieve_code: |
|
297 |
assumes "\<Turnstile> v : r" |
|
298 |
shows "code v = retrieve (intern r) v" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
299 |
using assms |
311 | 300 |
apply(induct v r ) |
289 | 301 |
apply(simp_all add: retrieve_fuse retrieve_encode_STARS) |
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
302 |
done |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
303 |
|
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
304 |
lemma r: |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
305 |
assumes "bnullable (AALTs bs (a # rs))" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
306 |
shows "bnullable a \<or> (\<not> bnullable a \<and> bnullable (AALTs bs rs))" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
307 |
using assms |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
308 |
apply(induct rs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
309 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
310 |
done |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
311 |
|
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
312 |
lemma r0: |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
313 |
assumes "bnullable a" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
314 |
shows "bmkeps (AALTs bs (a # rs)) = bs @ (bmkeps a)" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
315 |
using assms |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
316 |
by (metis bmkeps.simps(3) bmkeps.simps(4) list.exhaust) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
317 |
|
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
318 |
lemma r1: |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
319 |
assumes "\<not> bnullable a" "bnullable (AALTs bs rs)" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
320 |
shows "bmkeps (AALTs bs (a # rs)) = bmkeps (AALTs bs rs)" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
321 |
using assms |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
322 |
apply(induct rs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
323 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
324 |
done |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
325 |
|
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
326 |
lemma r2: |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
327 |
assumes "x \<in> set rs" "bnullable x" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
328 |
shows "bnullable (AALTs bs rs)" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
329 |
using assms |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
330 |
apply(induct rs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
331 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
332 |
done |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
333 |
|
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
334 |
lemma r3: |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
335 |
assumes "\<not> bnullable r" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
336 |
" \<exists> x \<in> set rs. bnullable x" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
337 |
shows "retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs))) = |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
338 |
retrieve (AALTs bs (r # rs)) (mkeps (erase (AALTs bs (r # rs))))" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
339 |
using assms |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
340 |
apply(induct rs arbitrary: r bs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
341 |
apply(auto)[1] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
342 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
343 |
using bnullable_correctness apply blast |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
344 |
apply(auto simp add: bnullable_correctness mkeps_nullable retrieve_fuse2) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
345 |
apply(subst retrieve_fuse2[symmetric]) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
346 |
apply (smt bnullable.simps(4) bnullable_correctness erase.simps(5) erase.simps(6) insert_iff list.exhaust list.set(2) mkeps.simps(3) mkeps_nullable) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
347 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
348 |
apply(case_tac "bnullable a") |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
349 |
apply (smt append_Nil2 bnullable.simps(4) bnullable_correctness erase.simps(5) erase.simps(6) fuse.simps(4) insert_iff list.exhaust list.set(2) mkeps.simps(3) mkeps_nullable retrieve_fuse2) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
350 |
apply(drule_tac x="a" in meta_spec) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
351 |
apply(drule_tac x="bs" in meta_spec) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
352 |
apply(drule meta_mp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
353 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
354 |
apply(drule meta_mp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
355 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
356 |
apply(subst retrieve_fuse2[symmetric]) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
357 |
apply(case_tac rs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
358 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
359 |
apply(auto)[1] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
360 |
apply (simp add: bnullable_correctness) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
361 |
apply (metis append_Nil2 bnullable_correctness erase_fuse fuse.simps(4) list.set_intros(1) mkeps.simps(3) mkeps_nullable nullable.simps(4) r2) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
362 |
apply (simp add: bnullable_correctness) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
363 |
apply (metis append_Nil2 bnullable_correctness erase.simps(6) erase_fuse fuse.simps(4) list.set_intros(2) mkeps.simps(3) mkeps_nullable r2) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
364 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
365 |
done |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
366 |
|
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
367 |
|
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
368 |
lemma t: |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
369 |
assumes "\<forall>r \<in> set rs. nullable (erase r) \<longrightarrow> bmkeps r = retrieve r (mkeps (erase r))" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
370 |
"nullable (erase (AALTs bs rs))" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
371 |
shows " bmkeps (AALTs bs rs) = retrieve (AALTs bs rs) (mkeps (erase (AALTs bs rs)))" |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
372 |
using assms |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
373 |
apply(induct rs arbitrary: bs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
374 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
375 |
apply(auto simp add: bnullable_correctness) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
376 |
apply(case_tac rs) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
377 |
apply(auto simp add: bnullable_correctness)[2] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
378 |
apply(subst r1) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
379 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
380 |
apply(rule r2) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
381 |
apply(assumption) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
382 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
383 |
apply(drule_tac x="bs" in meta_spec) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
384 |
apply(drule meta_mp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
385 |
apply(auto)[1] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
386 |
prefer 2 |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
387 |
apply(case_tac "bnullable a") |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
388 |
apply(subst r0) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
389 |
apply blast |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
390 |
apply(subgoal_tac "nullable (erase a)") |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
391 |
prefer 2 |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
392 |
using bnullable_correctness apply blast |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
393 |
apply (metis (no_types, lifting) erase.simps(5) erase.simps(6) list.exhaust mkeps.simps(3) retrieve.simps(3) retrieve.simps(4)) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
394 |
apply(subst r1) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
395 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
396 |
using r2 apply blast |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
397 |
apply(drule_tac x="bs" in meta_spec) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
398 |
apply(drule meta_mp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
399 |
apply(auto)[1] |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
400 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
401 |
using r3 apply blast |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
402 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
403 |
using r3 by blast |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
404 |
|
289 | 405 |
lemma bmkeps_retrieve: |
406 |
assumes "nullable (erase r)" |
|
407 |
shows "bmkeps r = retrieve r (mkeps (erase r))" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
408 |
using assms |
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
409 |
apply(induct r) |
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
410 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
411 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
412 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
413 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
414 |
defer |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
415 |
apply(simp) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
416 |
apply(rule t) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
417 |
apply(auto) |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
418 |
done |
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
419 |
|
289 | 420 |
lemma bder_retrieve: |
421 |
assumes "\<Turnstile> v : der c (erase r)" |
|
422 |
shows "retrieve (bder c r) v = retrieve r (injval (erase r) c v)" |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
423 |
using assms |
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
424 |
apply(induct r arbitrary: v rule: erase.induct) |
318 | 425 |
apply(simp) |
426 |
apply(erule Prf_elims) |
|
427 |
apply(simp) |
|
428 |
apply(erule Prf_elims) |
|
429 |
apply(simp) |
|
430 |
apply(case_tac "c = ca") |
|
431 |
apply(simp) |
|
432 |
apply(erule Prf_elims) |
|
433 |
apply(simp) |
|
434 |
apply(simp) |
|
435 |
apply(erule Prf_elims) |
|
436 |
apply(simp) |
|
437 |
apply(erule Prf_elims) |
|
438 |
apply(simp) |
|
439 |
apply(simp) |
|
440 |
apply(rename_tac "r\<^sub>1" "r\<^sub>2" rs v) |
|
441 |
apply(erule Prf_elims) |
|
442 |
apply(simp) |
|
443 |
apply(simp) |
|
444 |
apply(case_tac rs) |
|
445 |
apply(simp) |
|
446 |
apply(simp) |
|
447 |
apply (smt Prf_elims(3) injval.simps(2) injval.simps(3) retrieve.simps(4) retrieve.simps(5) same_append_eq) |
|
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
448 |
apply(simp) |
318 | 449 |
apply(case_tac "nullable (erase r1)") |
450 |
apply(simp) |
|
451 |
apply(erule Prf_elims) |
|
452 |
apply(subgoal_tac "bnullable r1") |
|
453 |
prefer 2 |
|
454 |
using bnullable_correctness apply blast |
|
455 |
apply(simp) |
|
456 |
apply(erule Prf_elims) |
|
457 |
apply(simp) |
|
458 |
apply(subgoal_tac "bnullable r1") |
|
459 |
prefer 2 |
|
460 |
using bnullable_correctness apply blast |
|
461 |
apply(simp) |
|
462 |
apply(simp add: retrieve_fuse2) |
|
463 |
apply(simp add: bmkeps_retrieve) |
|
464 |
apply(simp) |
|
465 |
apply(erule Prf_elims) |
|
466 |
apply(simp) |
|
467 |
using bnullable_correctness apply blast |
|
468 |
apply(rename_tac bs r v) |
|
469 |
apply(simp) |
|
470 |
apply(erule Prf_elims) |
|
471 |
apply(clarify) |
|
472 |
apply(erule Prf_elims) |
|
473 |
apply(clarify) |
|
474 |
apply(subst injval.simps) |
|
475 |
apply(simp del: retrieve.simps) |
|
476 |
apply(subst retrieve.simps) |
|
477 |
apply(subst retrieve.simps) |
|
478 |
apply(simp) |
|
479 |
apply(simp add: retrieve_fuse2) |
|
480 |
done |
|
313
3b8e3a156200
adapted the Bitcoded correctness proof to using AALTs
Christian Urban <urbanc@in.tum.de>
parents:
311
diff
changeset
|
481 |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
482 |
|
318 | 483 |
|
289 | 484 |
lemma MAIN_decode: |
485 |
assumes "\<Turnstile> v : ders s r" |
|
486 |
shows "Some (flex r id s v) = decode (retrieve (bders (intern r) s) v) r" |
|
487 |
using assms |
|
488 |
proof (induct s arbitrary: v rule: rev_induct) |
|
489 |
case Nil |
|
490 |
have "\<Turnstile> v : ders [] r" by fact |
|
491 |
then have "\<Turnstile> v : r" by simp |
|
492 |
then have "Some v = decode (retrieve (intern r) v) r" |
|
493 |
using decode_code retrieve_code by auto |
|
494 |
then show "Some (flex r id [] v) = decode (retrieve (bders (intern r) []) v) r" |
|
495 |
by simp |
|
496 |
next |
|
497 |
case (snoc c s v) |
|
498 |
have IH: "\<And>v. \<Turnstile> v : ders s r \<Longrightarrow> |
|
499 |
Some (flex r id s v) = decode (retrieve (bders (intern r) s) v) r" by fact |
|
500 |
have asm: "\<Turnstile> v : ders (s @ [c]) r" by fact |
|
501 |
then have asm2: "\<Turnstile> injval (ders s r) c v : ders s r" |
|
318 | 502 |
by (simp add: Prf_injval ders_append) |
289 | 503 |
have "Some (flex r id (s @ [c]) v) = Some (flex r id s (injval (ders s r) c v))" |
504 |
by (simp add: flex_append) |
|
505 |
also have "... = decode (retrieve (bders (intern r) s) (injval (ders s r) c v)) r" |
|
506 |
using asm2 IH by simp |
|
507 |
also have "... = decode (retrieve (bder c (bders (intern r) s)) v) r" |
|
318 | 508 |
using asm by (simp_all add: bder_retrieve ders_append) |
289 | 509 |
finally show "Some (flex r id (s @ [c]) v) = |
510 |
decode (retrieve (bders (intern r) (s @ [c])) v) r" by (simp add: bders_append) |
|
511 |
qed |
|
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
512 |
|
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
513 |
|
318 | 514 |
definition blex where |
515 |
"blex a s \<equiv> if bnullable (bders a s) then Some (bmkeps (bders a s)) else None" |
|
516 |
||
517 |
||
518 |
||
289 | 519 |
definition blexer where |
520 |
"blexer r s \<equiv> if bnullable (bders (intern r) s) then |
|
521 |
decode (bmkeps (bders (intern r) s)) r else None" |
|
522 |
||
523 |
lemma blexer_correctness: |
|
524 |
shows "blexer r s = lexer r s" |
|
525 |
proof - |
|
526 |
{ define bds where "bds \<equiv> bders (intern r) s" |
|
527 |
define ds where "ds \<equiv> ders s r" |
|
528 |
assume asm: "nullable ds" |
|
529 |
have era: "erase bds = ds" |
|
530 |
unfolding ds_def bds_def by simp |
|
531 |
have mke: "\<Turnstile> mkeps ds : ds" |
|
532 |
using asm by (simp add: mkeps_nullable) |
|
533 |
have "decode (bmkeps bds) r = decode (retrieve bds (mkeps ds)) r" |
|
534 |
using bmkeps_retrieve |
|
535 |
using asm era by (simp add: bmkeps_retrieve) |
|
536 |
also have "... = Some (flex r id s (mkeps ds))" |
|
537 |
using mke by (simp_all add: MAIN_decode ds_def bds_def) |
|
538 |
finally have "decode (bmkeps bds) r = Some (flex r id s (mkeps ds))" |
|
539 |
unfolding bds_def ds_def . |
|
540 |
} |
|
541 |
then show "blexer r s = lexer r s" |
|
542 |
unfolding blexer_def lexer_flex |
|
293 | 543 |
apply(subst bnullable_correctness[symmetric]) |
544 |
apply(simp) |
|
545 |
done |
|
289 | 546 |
qed |
286
804fbb227568
added proof for bitcoded algorithm
Christian Urban <urbanc@in.tum.de>
parents:
256
diff
changeset
|
547 |
|
295 | 548 |
|
314 | 549 |
fun distinctBy :: "'a list \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b set \<Rightarrow> 'a list" |
550 |
where |
|
551 |
"distinctBy [] f acc = []" |
|
552 |
| "distinctBy (x#xs) f acc = |
|
553 |
(if (f x) \<in> acc then distinctBy xs f acc |
|
554 |
else x # (distinctBy xs f ({f x} \<union> acc)))" |
|
555 |
||
556 |
fun flts :: "arexp list \<Rightarrow> arexp list" |
|
557 |
where |
|
558 |
"flts [] = []" |
|
559 |
| "flts (AZERO # rs) = flts rs" |
|
560 |
| "flts ((AALTs bs rs1) # rs) = (map (fuse bs) rs1) @ flts rs" |
|
561 |
| "flts (r1 # rs) = r1 # flts rs" |
|
562 |
||
563 |
fun bsimp_ASEQ :: "bit list \<Rightarrow> arexp \<Rightarrow> arexp \<Rightarrow> arexp" |
|
564 |
where |
|
565 |
"bsimp_ASEQ _ AZERO _ = AZERO" |
|
566 |
| "bsimp_ASEQ _ _ AZERO = AZERO" |
|
567 |
| "bsimp_ASEQ bs1 (AONE bs2) r2 = fuse (bs1 @ bs2) r2" |
|
568 |
| "bsimp_ASEQ bs1 r1 r2 = ASEQ bs1 r1 r2" |
|
569 |
||
570 |
||
571 |
fun bsimp_AALTs :: "bit list \<Rightarrow> arexp list \<Rightarrow> arexp" |
|
572 |
where |
|
573 |
"bsimp_AALTs _ [] = AZERO" |
|
574 |
| "bsimp_AALTs bs1 [r] = fuse bs1 r" |
|
575 |
| "bsimp_AALTs bs1 rs = AALTs bs1 rs" |
|
576 |
||
577 |
||
578 |
fun bsimp :: "arexp \<Rightarrow> arexp" |
|
579 |
where |
|
580 |
"bsimp (ASEQ bs1 r1 r2) = bsimp_ASEQ bs1 (bsimp r1) (bsimp r2)" |
|
581 |
| "bsimp (AALTs bs1 rs) = bsimp_AALTs bs1 (flts (map bsimp rs))" |
|
582 |
| "bsimp r = r" |
|
583 |
||
322 | 584 |
|
314 | 585 |
fun |
586 |
bders_simp :: "arexp \<Rightarrow> string \<Rightarrow> arexp" |
|
587 |
where |
|
588 |
"bders_simp r [] = r" |
|
589 |
| "bders_simp r (c # s) = bders_simp (bsimp (bder c r)) s" |
|
590 |
||
591 |
definition blexer_simp where |
|
592 |
"blexer_simp r s \<equiv> if bnullable (bders_simp (intern r) s) then |
|
593 |
decode (bmkeps (bders_simp (intern r) s)) r else None" |
|
594 |
||
595 |
||
317 | 596 |
lemma asize0: |
597 |
shows "0 < asize r" |
|
598 |
apply(induct r) |
|
599 |
apply(auto) |
|
600 |
done |
|
601 |
||
602 |
||
314 | 603 |
lemma bders_simp_append: |
604 |
shows "bders_simp r (s1 @ s2) = bders_simp (bders_simp r s1) s2" |
|
605 |
apply(induct s1 arbitrary: r s2) |
|
606 |
apply(simp) |
|
607 |
apply(simp) |
|
608 |
done |
|
609 |
||
317 | 610 |
lemma bsimp_ASEQ_size: |
611 |
shows "asize (bsimp_ASEQ bs r1 r2) \<le> Suc (asize r1 + asize r2)" |
|
612 |
apply(induct bs r1 r2 rule: bsimp_ASEQ.induct) |
|
613 |
apply(auto) |
|
614 |
done |
|
314 | 615 |
|
317 | 616 |
lemma fuse_size: |
617 |
shows "asize (fuse bs r) = asize r" |
|
618 |
apply(induct r) |
|
619 |
apply(auto) |
|
620 |
done |
|
621 |
||
622 |
lemma flts_size: |
|
623 |
shows "sum_list (map asize (flts rs)) \<le> sum_list (map asize rs)" |
|
624 |
apply(induct rs rule: flts.induct) |
|
625 |
apply(simp_all) |
|
626 |
by (metis (mono_tags, lifting) add_mono_thms_linordered_semiring(1) comp_apply fuse_size le_SucI order_refl sum_list_cong) |
|
627 |
||
628 |
||
629 |
lemma bsimp_AALTs_size: |
|
630 |
shows "asize (bsimp_AALTs bs rs) \<le> Suc (sum_list (map asize rs))" |
|
631 |
apply(induct rs rule: bsimp_AALTs.induct) |
|
632 |
apply(auto simp add: fuse_size) |
|
633 |
done |
|
322 | 634 |
|
635 |
||
317 | 636 |
lemma bsimp_size: |
637 |
shows "asize (bsimp r) \<le> asize r" |
|
638 |
apply(induct r) |
|
639 |
apply(simp_all) |
|
640 |
apply (meson Suc_le_mono add_mono_thms_linordered_semiring(1) bsimp_ASEQ_size le_trans) |
|
641 |
apply(rule le_trans) |
|
642 |
apply(rule bsimp_AALTs_size) |
|
643 |
apply(simp) |
|
644 |
apply(rule le_trans) |
|
645 |
apply(rule flts_size) |
|
646 |
by (simp add: sum_list_mono) |
|
647 |
||
322 | 648 |
lemma bsimp_asize0: |
649 |
shows "(\<Sum>x\<leftarrow>rs. asize (bsimp x)) \<le> sum_list (map asize rs)" |
|
650 |
apply(induct rs) |
|
651 |
apply(auto) |
|
652 |
by (simp add: add_mono bsimp_size) |
|
653 |
||
654 |
||
317 | 655 |
|
656 |
||
657 |
||
658 |
||
659 |
lemma bsimp_AALTs_size2: |
|
660 |
assumes "\<forall>r \<in> set rs. nonalt r" |
|
661 |
shows "asize (bsimp_AALTs bs rs) \<ge> sum_list (map asize rs)" |
|
662 |
using assms |
|
663 |
apply(induct rs rule: bsimp_AALTs.induct) |
|
664 |
apply(simp_all add: fuse_size) |
|
665 |
done |
|
666 |
||
667 |
lemma qq: |
|
668 |
shows "map (asize \<circ> fuse bs) rs = map asize rs" |
|
669 |
apply(induct rs) |
|
670 |
apply(auto simp add: fuse_size) |
|
671 |
done |
|
672 |
||
673 |
lemma flts_size2: |
|
674 |
assumes "\<exists>bs rs'. AALTs bs rs' \<in> set rs" |
|
675 |
shows "sum_list (map asize (flts rs)) < sum_list (map asize rs)" |
|
676 |
using assms |
|
677 |
apply(induct rs) |
|
678 |
apply(auto simp add: qq) |
|
679 |
apply (simp add: flts_size less_Suc_eq_le) |
|
680 |
apply(case_tac a) |
|
681 |
apply(auto simp add: qq) |
|
682 |
prefer 2 |
|
683 |
apply (simp add: flts_size le_imp_less_Suc) |
|
684 |
using less_Suc_eq by auto |
|
685 |
||
314 | 686 |
lemma L_bsimp_ASEQ: |
687 |
"L (SEQ (erase r1) (erase r2)) = L (erase (bsimp_ASEQ bs r1 r2))" |
|
688 |
apply(induct bs r1 r2 rule: bsimp_ASEQ.induct) |
|
689 |
apply(simp_all) |
|
690 |
by (metis erase_fuse fuse.simps(4)) |
|
691 |
||
692 |
lemma L_bsimp_AALTs: |
|
693 |
"L (erase (AALTs bs rs)) = L (erase (bsimp_AALTs bs rs))" |
|
694 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
695 |
apply(simp_all add: erase_fuse) |
|
696 |
done |
|
697 |
||
698 |
lemma L_erase_AALTs: |
|
699 |
shows "L (erase (AALTs bs rs)) = \<Union> (L ` erase ` (set rs))" |
|
700 |
apply(induct rs) |
|
701 |
apply(simp) |
|
702 |
apply(simp) |
|
703 |
apply(case_tac rs) |
|
704 |
apply(simp) |
|
705 |
apply(simp) |
|
706 |
done |
|
707 |
||
708 |
lemma L_erase_flts: |
|
709 |
shows "\<Union> (L ` erase ` (set (flts rs))) = \<Union> (L ` erase ` (set rs))" |
|
710 |
apply(induct rs rule: flts.induct) |
|
711 |
apply(simp_all) |
|
712 |
apply(auto) |
|
713 |
using L_erase_AALTs erase_fuse apply auto[1] |
|
714 |
by (simp add: L_erase_AALTs erase_fuse) |
|
715 |
||
716 |
||
717 |
lemma L_bsimp_erase: |
|
718 |
shows "L (erase r) = L (erase (bsimp r))" |
|
719 |
apply(induct r) |
|
720 |
apply(simp) |
|
721 |
apply(simp) |
|
722 |
apply(simp) |
|
723 |
apply(auto simp add: Sequ_def)[1] |
|
724 |
apply(subst L_bsimp_ASEQ[symmetric]) |
|
725 |
apply(auto simp add: Sequ_def)[1] |
|
726 |
apply(subst (asm) L_bsimp_ASEQ[symmetric]) |
|
727 |
apply(auto simp add: Sequ_def)[1] |
|
728 |
apply(simp) |
|
729 |
apply(subst L_bsimp_AALTs[symmetric]) |
|
730 |
defer |
|
731 |
apply(simp) |
|
732 |
apply(subst (2)L_erase_AALTs) |
|
733 |
apply(subst L_erase_flts) |
|
734 |
apply(auto) |
|
735 |
apply (simp add: L_erase_AALTs) |
|
736 |
using L_erase_AALTs by blast |
|
737 |
||
317 | 738 |
lemma bsimp_ASEQ0: |
739 |
shows "bsimp_ASEQ bs r1 AZERO = AZERO" |
|
740 |
apply(induct r1) |
|
741 |
apply(auto) |
|
742 |
done |
|
743 |
||
744 |
||
314 | 745 |
|
746 |
lemma bsimp_ASEQ1: |
|
747 |
assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs" |
|
748 |
shows "bsimp_ASEQ bs r1 r2 = ASEQ bs r1 r2" |
|
749 |
using assms |
|
750 |
apply(induct bs r1 r2 rule: bsimp_ASEQ.induct) |
|
751 |
apply(auto) |
|
752 |
done |
|
753 |
||
754 |
lemma bsimp_ASEQ2: |
|
755 |
shows "bsimp_ASEQ bs (AONE bs1) r2 = fuse (bs @ bs1) r2" |
|
756 |
apply(induct r2) |
|
757 |
apply(auto) |
|
758 |
done |
|
759 |
||
760 |
||
761 |
lemma L_bders_simp: |
|
762 |
shows "L (erase (bders_simp r s)) = L (erase (bders r s))" |
|
763 |
apply(induct s arbitrary: r rule: rev_induct) |
|
764 |
apply(simp) |
|
765 |
apply(simp) |
|
766 |
apply(simp add: ders_append) |
|
767 |
apply(simp add: bders_simp_append) |
|
768 |
apply(simp add: L_bsimp_erase[symmetric]) |
|
769 |
by (simp add: der_correctness) |
|
770 |
||
771 |
lemma b1: |
|
772 |
"bsimp_ASEQ bs1 (AONE bs) r = fuse (bs1 @ bs) r" |
|
773 |
apply(induct r) |
|
774 |
apply(auto) |
|
775 |
done |
|
776 |
||
777 |
lemma b2: |
|
778 |
assumes "bnullable r" |
|
779 |
shows "bmkeps (fuse bs r) = bs @ bmkeps r" |
|
780 |
by (simp add: assms bmkeps_retrieve bnullable_correctness erase_fuse mkeps_nullable retrieve_fuse2) |
|
781 |
||
782 |
lemma b3: |
|
783 |
shows "bnullable r = bnullable (bsimp r)" |
|
784 |
using L_bsimp_erase bnullable_correctness nullable_correctness by auto |
|
785 |
||
786 |
||
787 |
lemma b4: |
|
788 |
shows "bnullable (bders_simp r s) = bnullable (bders r s)" |
|
789 |
by (metis L_bders_simp bnullable_correctness lexer.simps(1) lexer_correct_None option.distinct(1)) |
|
790 |
||
791 |
lemma q1: |
|
792 |
assumes "\<forall>r \<in> set rs. bmkeps(bsimp r) = bmkeps r" |
|
793 |
shows "map (\<lambda>r. bmkeps(bsimp r)) rs = map bmkeps rs" |
|
794 |
using assms |
|
795 |
apply(induct rs) |
|
796 |
apply(simp) |
|
797 |
apply(simp) |
|
798 |
done |
|
799 |
||
800 |
lemma q3: |
|
801 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
802 |
shows "bmkeps (AALTs bs rs) = bmkeps (bsimp_AALTs bs rs)" |
|
803 |
using assms |
|
804 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
805 |
apply(simp) |
|
806 |
apply(simp) |
|
807 |
apply (simp add: b2) |
|
808 |
apply(simp) |
|
809 |
done |
|
810 |
||
811 |
lemma qq1: |
|
812 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
813 |
shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs)" |
|
814 |
using assms |
|
815 |
apply(induct rs arbitrary: rs1 bs) |
|
816 |
apply(simp) |
|
817 |
apply(simp) |
|
818 |
by (metis Nil_is_append_conv bmkeps.simps(4) neq_Nil_conv r0 split_list_last) |
|
819 |
||
820 |
lemma qq2: |
|
821 |
assumes "\<forall>r \<in> set rs. \<not> bnullable r" "\<exists>r \<in> set rs1. bnullable r" |
|
822 |
shows "bmkeps (AALTs bs (rs @ rs1)) = bmkeps (AALTs bs rs1)" |
|
823 |
using assms |
|
824 |
apply(induct rs arbitrary: rs1 bs) |
|
825 |
apply(simp) |
|
826 |
apply(simp) |
|
827 |
by (metis append_assoc in_set_conv_decomp r1 r2) |
|
828 |
||
829 |
lemma qq3: |
|
830 |
shows "bnullable (AALTs bs rs) = (\<exists>r \<in> set rs. bnullable r)" |
|
831 |
apply(induct rs arbitrary: bs) |
|
832 |
apply(simp) |
|
833 |
apply(simp) |
|
834 |
done |
|
835 |
||
317 | 836 |
lemma fuse_empty: |
837 |
shows "fuse [] r = r" |
|
838 |
apply(induct r) |
|
839 |
apply(auto) |
|
840 |
done |
|
841 |
||
842 |
lemma flts_fuse: |
|
843 |
shows "map (fuse bs) (flts rs) = flts (map (fuse bs) rs)" |
|
844 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
845 |
apply(auto simp add: fuse_append) |
|
846 |
done |
|
847 |
||
848 |
lemma bsimp_ASEQ_fuse: |
|
849 |
shows "fuse bs1 (bsimp_ASEQ bs2 r1 r2) = bsimp_ASEQ (bs1 @ bs2) r1 r2" |
|
850 |
apply(induct r1 r2 arbitrary: bs1 bs2 rule: bsimp_ASEQ.induct) |
|
851 |
apply(auto) |
|
852 |
done |
|
853 |
||
854 |
lemma bsimp_AALTs_fuse: |
|
855 |
assumes "\<forall>r \<in> set rs. fuse bs1 (fuse bs2 r) = fuse (bs1 @ bs2) r" |
|
856 |
shows "fuse bs1 (bsimp_AALTs bs2 rs) = bsimp_AALTs (bs1 @ bs2) rs" |
|
857 |
using assms |
|
858 |
apply(induct bs2 rs arbitrary: bs1 rule: bsimp_AALTs.induct) |
|
859 |
apply(auto) |
|
860 |
done |
|
861 |
||
862 |
||
863 |
||
864 |
lemma bsimp_fuse: |
|
865 |
shows "fuse bs (bsimp r) = bsimp (fuse bs r)" |
|
866 |
apply(induct r arbitrary: bs) |
|
867 |
apply(simp) |
|
868 |
apply(simp) |
|
869 |
apply(simp) |
|
870 |
prefer 3 |
|
871 |
apply(simp) |
|
872 |
apply(simp) |
|
873 |
apply (simp add: bsimp_ASEQ_fuse) |
|
874 |
apply(simp) |
|
875 |
by (simp add: bsimp_AALTs_fuse fuse_append) |
|
876 |
||
877 |
lemma bsimp_fuse_AALTs: |
|
878 |
shows "fuse bs (bsimp (AALTs [] rs)) = bsimp (AALTs bs rs)" |
|
879 |
apply(subst bsimp_fuse) |
|
880 |
apply(simp) |
|
881 |
done |
|
882 |
||
883 |
lemma bsimp_fuse_AALTs2: |
|
884 |
shows "fuse bs (bsimp_AALTs [] rs) = bsimp_AALTs bs rs" |
|
885 |
using bsimp_AALTs_fuse fuse_append by auto |
|
886 |
||
887 |
||
888 |
lemma bsimp_ASEQ_idem: |
|
889 |
assumes "bsimp (bsimp r1) = bsimp r1" "bsimp (bsimp r2) = bsimp r2" |
|
890 |
shows "bsimp (bsimp_ASEQ x1 (bsimp r1) (bsimp r2)) = bsimp_ASEQ x1 (bsimp r1) (bsimp r2)" |
|
891 |
using assms |
|
892 |
apply(case_tac "bsimp r1 = AZERO") |
|
893 |
apply(simp) |
|
894 |
apply(case_tac "bsimp r2 = AZERO") |
|
895 |
apply(simp) |
|
896 |
apply (metis bnullable.elims(2) bnullable.elims(3) bsimp.simps(3) bsimp_ASEQ.simps(2) bsimp_ASEQ.simps(3) bsimp_ASEQ.simps(4) bsimp_ASEQ.simps(5) bsimp_ASEQ.simps(6)) |
|
897 |
apply(case_tac "\<exists>bs. bsimp r1 = AONE bs") |
|
898 |
apply(auto)[1] |
|
899 |
apply(subst bsimp_ASEQ2) |
|
900 |
apply(subst bsimp_ASEQ2) |
|
901 |
apply (metis assms(2) bsimp_fuse) |
|
902 |
apply(subst bsimp_ASEQ1) |
|
903 |
apply(auto) |
|
904 |
done |
|
905 |
||
906 |
||
907 |
fun nonnested :: "arexp \<Rightarrow> bool" |
|
908 |
where |
|
909 |
"nonnested (AALTs bs2 []) = True" |
|
910 |
| "nonnested (AALTs bs2 ((AALTs bs1 rs1) # rs2)) = False" |
|
911 |
| "nonnested (AALTs bs2 (r # rs2)) = nonnested (AALTs bs2 rs2)" |
|
912 |
| "nonnested r = True" |
|
913 |
||
914 |
||
915 |
lemma k0: |
|
916 |
shows "flts (r # rs1) = flts [r] @ flts rs1" |
|
917 |
apply(induct r arbitrary: rs1) |
|
918 |
apply(auto) |
|
919 |
done |
|
920 |
||
921 |
lemma k00: |
|
922 |
shows "flts (rs1 @ rs2) = flts rs1 @ flts rs2" |
|
923 |
apply(induct rs1 arbitrary: rs2) |
|
924 |
apply(auto) |
|
925 |
by (metis append.assoc k0) |
|
926 |
||
927 |
lemma k0a: |
|
928 |
shows "flts [AALTs bs rs] = map (fuse bs) rs" |
|
929 |
apply(simp) |
|
930 |
done |
|
931 |
||
932 |
fun spill where |
|
933 |
"spill (AALTs bs rs) = map (fuse bs) rs" |
|
934 |
||
935 |
lemma k0a2: |
|
936 |
assumes "\<not> nonalt r" |
|
937 |
shows "flts [r] = spill r" |
|
938 |
using assms |
|
939 |
apply(case_tac r) |
|
940 |
apply(simp_all) |
|
941 |
done |
|
942 |
||
943 |
lemma k0b: |
|
944 |
assumes "nonalt r" "r \<noteq> AZERO" |
|
945 |
shows "flts [r] = [r]" |
|
946 |
using assms |
|
947 |
apply(case_tac r) |
|
948 |
apply(simp_all) |
|
949 |
done |
|
950 |
||
951 |
lemma nn1: |
|
952 |
assumes "nonnested (AALTs bs rs)" |
|
953 |
shows "\<nexists>bs1 rs1. flts rs = [AALTs bs1 rs1]" |
|
954 |
using assms |
|
955 |
apply(induct rs rule: flts.induct) |
|
956 |
apply(auto) |
|
957 |
done |
|
958 |
||
959 |
lemma nn1q: |
|
960 |
assumes "nonnested (AALTs bs rs)" |
|
961 |
shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set (flts rs)" |
|
962 |
using assms |
|
963 |
apply(induct rs rule: flts.induct) |
|
964 |
apply(auto) |
|
965 |
done |
|
966 |
||
967 |
lemma nn1qq: |
|
968 |
assumes "nonnested (AALTs bs rs)" |
|
969 |
shows "\<nexists>bs1 rs1. AALTs bs1 rs1 \<in> set rs" |
|
970 |
using assms |
|
971 |
apply(induct rs rule: flts.induct) |
|
972 |
apply(auto) |
|
973 |
done |
|
974 |
||
975 |
lemma nn10: |
|
976 |
assumes "nonnested (AALTs cs rs)" |
|
977 |
shows "nonnested (AALTs (bs @ cs) rs)" |
|
978 |
using assms |
|
979 |
apply(induct rs arbitrary: cs bs) |
|
980 |
apply(simp_all) |
|
981 |
apply(case_tac a) |
|
982 |
apply(simp_all) |
|
983 |
done |
|
984 |
||
985 |
lemma nn11a: |
|
986 |
assumes "nonalt r" |
|
987 |
shows "nonalt (fuse bs r)" |
|
988 |
using assms |
|
989 |
apply(induct r) |
|
990 |
apply(auto) |
|
991 |
done |
|
992 |
||
993 |
||
994 |
lemma nn1a: |
|
995 |
assumes "nonnested r" |
|
996 |
shows "nonnested (fuse bs r)" |
|
997 |
using assms |
|
998 |
apply(induct bs r arbitrary: rule: fuse.induct) |
|
999 |
apply(simp_all add: nn10) |
|
1000 |
done |
|
1001 |
||
1002 |
lemma n0: |
|
1003 |
shows "nonnested (AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. nonalt r)" |
|
1004 |
apply(induct rs arbitrary: bs) |
|
1005 |
apply(auto) |
|
1006 |
apply (metis list.set_intros(1) nn1qq nonalt.elims(3)) |
|
1007 |
apply (metis list.set_intros(2) nn1qq nonalt.elims(3)) |
|
1008 |
by (metis nonalt.elims(2) nonnested.simps(3) nonnested.simps(4) nonnested.simps(5) nonnested.simps(6) nonnested.simps(7)) |
|
1009 |
||
1010 |
||
1011 |
||
1012 |
||
1013 |
lemma nn1c: |
|
1014 |
assumes "\<forall>r \<in> set rs. nonnested r" |
|
1015 |
shows "\<forall>r \<in> set (flts rs). nonalt r" |
|
1016 |
using assms |
|
1017 |
apply(induct rs rule: flts.induct) |
|
1018 |
apply(auto) |
|
1019 |
apply(rule nn11a) |
|
1020 |
by (metis nn1qq nonalt.elims(3)) |
|
1021 |
||
1022 |
lemma nn1bb: |
|
1023 |
assumes "\<forall>r \<in> set rs. nonalt r" |
|
1024 |
shows "nonnested (bsimp_AALTs bs rs)" |
|
1025 |
using assms |
|
1026 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
1027 |
apply(auto) |
|
1028 |
apply (metis nn11a nonalt.simps(1) nonnested.elims(3)) |
|
1029 |
using n0 by auto |
|
1030 |
||
1031 |
lemma nn1b: |
|
1032 |
shows "nonnested (bsimp r)" |
|
1033 |
apply(induct r) |
|
1034 |
apply(simp_all) |
|
1035 |
apply(case_tac "bsimp r1 = AZERO") |
|
1036 |
apply(simp) |
|
1037 |
apply(case_tac "bsimp r2 = AZERO") |
|
1038 |
apply(simp) |
|
1039 |
apply(subst bsimp_ASEQ0) |
|
1040 |
apply(simp) |
|
1041 |
apply(case_tac "\<exists>bs. bsimp r1 = AONE bs") |
|
1042 |
apply(auto)[1] |
|
1043 |
apply(subst bsimp_ASEQ2) |
|
1044 |
apply (simp add: nn1a) |
|
1045 |
apply(subst bsimp_ASEQ1) |
|
1046 |
apply(auto) |
|
1047 |
apply(rule nn1bb) |
|
1048 |
apply(auto) |
|
1049 |
by (metis (mono_tags, hide_lams) imageE nn1c set_map) |
|
1050 |
||
318 | 1051 |
lemma nn1d: |
1052 |
assumes "bsimp r = AALTs bs rs" |
|
1053 |
shows "\<forall>r1 \<in> set rs. \<forall> bs. r1 \<noteq> AALTs bs rs2" |
|
1054 |
using nn1b assms |
|
1055 |
by (metis nn1qq) |
|
1056 |
||
1057 |
lemma nn_flts: |
|
1058 |
assumes "nonnested (AALTs bs rs)" |
|
1059 |
shows "\<forall>r \<in> set (flts rs). nonalt r" |
|
1060 |
using assms |
|
1061 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
1062 |
apply(auto) |
|
1063 |
done |
|
1064 |
||
317 | 1065 |
lemma rt: |
1066 |
shows "sum_list (map asize (flts (map bsimp rs))) \<le> sum_list (map asize rs)" |
|
1067 |
apply(induct rs) |
|
1068 |
apply(simp) |
|
1069 |
apply(simp) |
|
1070 |
apply(subst k0) |
|
1071 |
apply(simp) |
|
1072 |
by (smt add_le_cancel_right add_mono bsimp_size flts.simps(1) flts_size k0 le_iff_add list.simps(9) map_append sum_list.Cons sum_list.append trans_le_add1) |
|
1073 |
||
318 | 1074 |
lemma bsimp_AALTs_qq: |
1075 |
assumes "1 < length rs" |
|
1076 |
shows "bsimp_AALTs bs rs = AALTs bs rs" |
|
1077 |
using assms |
|
1078 |
apply(case_tac rs) |
|
1079 |
apply(simp) |
|
1080 |
apply(case_tac list) |
|
1081 |
apply(simp_all) |
|
1082 |
done |
|
1083 |
||
322 | 1084 |
lemma good_fuse: |
1085 |
shows "good (fuse bs r) = good r" |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1086 |
apply(induct r arbitrary: bs) |
322 | 1087 |
apply(auto) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1088 |
apply(case_tac r1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1089 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1090 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1091 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1092 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1093 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1094 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1095 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1096 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1097 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1098 |
apply(case_tac r1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1099 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1100 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1101 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1102 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1103 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1104 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1105 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1106 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1107 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1108 |
apply(case_tac x2a) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1109 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1110 |
apply(case_tac list) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1111 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1112 |
apply(case_tac x2a) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1113 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1114 |
apply(case_tac list) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1115 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1116 |
done |
322 | 1117 |
|
1118 |
lemma good0: |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1119 |
assumes "rs \<noteq> Nil" "\<forall>r \<in> set rs. nonalt r" |
322 | 1120 |
shows "good (bsimp_AALTs bs rs) \<longleftrightarrow> (\<forall>r \<in> set rs. good r)" |
1121 |
using assms |
|
1122 |
apply(induct bs rs rule: bsimp_AALTs.induct) |
|
1123 |
apply(auto simp add: good_fuse) |
|
1124 |
done |
|
1125 |
||
1126 |
lemma good0a: |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1127 |
assumes "flts (map bsimp rs) \<noteq> Nil" "\<forall>r \<in> set (flts (map bsimp rs)). nonalt r" |
322 | 1128 |
shows "good (bsimp (AALTs bs rs)) \<longleftrightarrow> (\<forall>r \<in> set (flts (map bsimp rs)). good r)" |
1129 |
using assms |
|
1130 |
apply(simp) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1131 |
apply(auto) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1132 |
apply(subst (asm) good0) |
323 | 1133 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1134 |
apply(auto) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1135 |
apply(subst good0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1136 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1137 |
apply(auto) |
322 | 1138 |
done |
1139 |
||
1140 |
lemma flts0: |
|
1141 |
assumes "r \<noteq> AZERO" "nonalt r" |
|
1142 |
shows "flts [r] \<noteq> []" |
|
1143 |
using assms |
|
1144 |
apply(induct r) |
|
1145 |
apply(simp_all) |
|
1146 |
done |
|
1147 |
||
1148 |
lemma flts1: |
|
1149 |
assumes "good r" |
|
1150 |
shows "flts [r] \<noteq> []" |
|
1151 |
using assms |
|
1152 |
apply(induct r) |
|
1153 |
apply(simp_all) |
|
1154 |
apply(case_tac x2a) |
|
1155 |
apply(simp) |
|
1156 |
apply(simp) |
|
1157 |
done |
|
1158 |
||
1159 |
lemma flts2: |
|
1160 |
assumes "good r" |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1161 |
shows "\<forall>r' \<in> set (flts [r]). good r' \<and> nonalt r'" |
322 | 1162 |
using assms |
1163 |
apply(induct r) |
|
1164 |
apply(simp) |
|
1165 |
apply(simp) |
|
1166 |
apply(simp) |
|
1167 |
prefer 2 |
|
1168 |
apply(simp) |
|
1169 |
apply(auto)[1] |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1170 |
apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) good_fuse) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1171 |
apply (metis bsimp_AALTs.elims good.simps(4) good.simps(5) good.simps(6) nn11a) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1172 |
apply fastforce |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1173 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1174 |
done |
322 | 1175 |
|
1176 |
||
1177 |
lemma flts3: |
|
1178 |
assumes "\<forall>r \<in> set rs. good r \<or> r = AZERO" |
|
1179 |
shows "\<forall>r \<in> set (flts rs). good r" |
|
1180 |
using assms |
|
1181 |
apply(induct rs arbitrary: rule: flts.induct) |
|
1182 |
apply(simp_all) |
|
1183 |
by (metis UnE flts2 k0a set_map) |
|
1184 |
||
1185 |
lemma flts3b: |
|
1186 |
assumes "\<exists>r\<in>set rs. good r" |
|
1187 |
shows "flts rs \<noteq> []" |
|
1188 |
using assms |
|
1189 |
apply(induct rs arbitrary: rule: flts.induct) |
|
1190 |
apply(simp) |
|
1191 |
apply(simp) |
|
1192 |
apply(simp) |
|
1193 |
apply(auto) |
|
1194 |
done |
|
1195 |
||
1196 |
lemma flts4: |
|
1197 |
assumes "bsimp_AALTs bs (flts rs) = AZERO" |
|
1198 |
shows "\<forall>r \<in> set rs. \<not> good r" |
|
1199 |
using assms |
|
1200 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
1201 |
apply(auto) |
|
1202 |
defer |
|
1203 |
apply (metis (no_types, lifting) Nil_is_append_conv append_self_conv2 bsimp_AALTs.elims butlast.simps(2) butlast_append flts3b nonalt.simps(1) nonalt.simps(2)) |
|
1204 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims flts2 good.simps(1) good.simps(2) good0 k0b list.distinct(1) list.inject nonalt.simps(3)) |
|
1205 |
apply (metis arexp.distinct(3) arexp.distinct(7) bsimp_AALTs.elims fuse.simps(3) list.distinct(1) list.inject) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1206 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims good.simps(1) good_fuse list.distinct(1) list.inject) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1207 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims list.distinct(1) list.inject) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1208 |
apply (metis arexp.distinct(7) bsimp_AALTs.elims flts2 good.simps(1) good.simps(33) good0 k0b list.distinct(1) list.inject nonalt.simps(6)) |
322 | 1209 |
by (metis (no_types, lifting) Nil_is_append_conv append_Nil2 arexp.distinct(7) bsimp_AALTs.elims butlast.simps(2) butlast_append flts1 flts2 good.simps(1) good0 k0a) |
1210 |
||
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1211 |
|
322 | 1212 |
lemma flts_nil: |
1213 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> |
|
1214 |
good (bsimp y) \<or> bsimp y = AZERO" |
|
1215 |
and "\<forall>r\<in>set rs. \<not> good (bsimp r)" |
|
1216 |
shows "flts (map bsimp rs) = []" |
|
1217 |
using assms |
|
1218 |
apply(induct rs) |
|
1219 |
apply(simp) |
|
1220 |
apply(simp) |
|
1221 |
apply(subst k0) |
|
1222 |
apply(simp) |
|
1223 |
by force |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1224 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1225 |
lemma flts_nil2: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1226 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1227 |
good (bsimp y) \<or> bsimp y = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1228 |
and "bsimp_AALTs bs (flts (map bsimp rs)) = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1229 |
shows "flts (map bsimp rs) = []" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1230 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1231 |
apply(induct rs arbitrary: bs) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1232 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1233 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1234 |
apply(subst k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1235 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1236 |
apply(subst (asm) k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1237 |
apply(auto) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1238 |
apply (metis flts.simps(1) flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1)) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1239 |
by (metis flts.simps(2) flts4 k0 less_add_Suc1 list.set_intros(1)) |
322 | 1240 |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1241 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1242 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1243 |
lemma good_SEQ: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1244 |
assumes "r1 \<noteq> AZERO" "r2 \<noteq> AZERO" "\<forall>bs. r1 \<noteq> AONE bs" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1245 |
shows "good (ASEQ bs r1 r2) = (good r1 \<and> good r2)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1246 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1247 |
apply(case_tac r1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1248 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1249 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1250 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1251 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1252 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1253 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1254 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1255 |
apply(case_tac r2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1256 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1257 |
done |
322 | 1258 |
|
1259 |
lemma good1: |
|
1260 |
shows "good (bsimp a) \<or> bsimp a = AZERO" |
|
1261 |
apply(induct a taking: asize rule: measure_induct) |
|
1262 |
apply(case_tac x) |
|
1263 |
apply(simp) |
|
1264 |
apply(simp) |
|
1265 |
apply(simp) |
|
1266 |
prefer 3 |
|
1267 |
apply(simp) |
|
1268 |
prefer 2 |
|
1269 |
apply(simp only:) |
|
1270 |
apply(case_tac "x52") |
|
1271 |
apply(simp) |
|
1272 |
apply(simp only: good0a) |
|
1273 |
apply(frule_tac x="a" in spec) |
|
1274 |
apply(drule mp) |
|
1275 |
apply(simp) |
|
1276 |
apply(erule disjE) |
|
1277 |
prefer 2 |
|
1278 |
apply(simp) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1279 |
apply(drule_tac x="AALTs x51 list" in spec) |
322 | 1280 |
apply(drule mp) |
1281 |
apply(simp add: asize0) |
|
1282 |
apply(auto)[1] |
|
1283 |
apply(frule_tac x="AALTs x51 list" in spec) |
|
1284 |
apply(drule mp) |
|
1285 |
apply(simp add: asize0) |
|
1286 |
apply(erule disjE) |
|
1287 |
apply(rule disjI1) |
|
1288 |
apply(simp add: good0) |
|
1289 |
apply(subst good0) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1290 |
apply (metis Nil_is_append_conv flts1 k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1291 |
apply (metis ex_map_conv list.simps(9) nn1b nn1c) |
322 | 1292 |
apply(simp) |
1293 |
apply(subst k0) |
|
1294 |
apply(simp) |
|
1295 |
apply(auto)[1] |
|
1296 |
using flts2 apply blast |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1297 |
apply(subst (asm) good0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1298 |
prefer 3 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1299 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1300 |
apply auto[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1301 |
apply (metis ex_map_conv nn1b nn1c) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1302 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1303 |
apply(frule_tac x="a" in spec) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1304 |
apply(drule mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1305 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1306 |
apply(erule disjE) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1307 |
apply(rule disjI1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1308 |
apply(subst good0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1309 |
apply(subst k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1310 |
using flts1 apply blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1311 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1312 |
apply (metis (no_types, hide_lams) ex_map_conv list.simps(9) nn1b nn1c) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1313 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1314 |
apply(subst (asm) k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1315 |
apply(auto)[1] |
322 | 1316 |
using flts2 apply blast |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1317 |
apply(frule_tac x="AALTs x51 list" in spec) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1318 |
apply(drule mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1319 |
apply(simp add: asize0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1320 |
apply(erule disjE) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1321 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1322 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1323 |
apply (metis add.left_commute flts_nil2 less_add_Suc1 less_imp_Suc_add list.distinct(1) list.set_cases nat.inject) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1324 |
apply(subst (2) k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1325 |
apply(simp) |
322 | 1326 |
(* SEQ case *) |
1327 |
apply(simp) |
|
1328 |
apply(case_tac "bsimp x42 = AZERO") |
|
1329 |
apply(simp) |
|
1330 |
apply(case_tac "bsimp x43 = AZERO") |
|
1331 |
apply(simp) |
|
1332 |
apply(subst (2) bsimp_ASEQ0) |
|
1333 |
apply(simp) |
|
1334 |
apply(case_tac "\<exists>bs. bsimp x42 = AONE bs") |
|
1335 |
apply(auto)[1] |
|
1336 |
apply(subst bsimp_ASEQ2) |
|
1337 |
using good_fuse apply force |
|
1338 |
apply(subst bsimp_ASEQ1) |
|
1339 |
apply(auto) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1340 |
apply(subst good_SEQ) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1341 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1342 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1343 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1344 |
using less_add_Suc1 less_add_Suc2 by blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1345 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1346 |
lemma good1a: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1347 |
assumes "L(erase a) \<noteq> {}" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1348 |
shows "good (bsimp a)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1349 |
using good1 assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1350 |
using L_bsimp_erase by force |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1351 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1352 |
|
322 | 1353 |
|
1354 |
lemma flts_append: |
|
1355 |
"flts (xs1 @ xs2) = flts xs1 @ flts xs2" |
|
1356 |
apply(induct xs1 arbitrary: xs2 rule: rev_induct) |
|
1357 |
apply(auto) |
|
1358 |
apply(case_tac xs) |
|
1359 |
apply(auto) |
|
1360 |
apply(case_tac x) |
|
1361 |
apply(auto) |
|
1362 |
apply(case_tac x) |
|
1363 |
apply(auto) |
|
1364 |
done |
|
1365 |
||
1366 |
lemma g1: |
|
1367 |
assumes "good (bsimp_AALTs bs rs)" |
|
1368 |
shows "bsimp_AALTs bs rs = AALTs bs rs \<or> (\<exists>r. rs = [r] \<and> bsimp_AALTs bs [r] = fuse bs r)" |
|
1369 |
using assms |
|
1370 |
apply(induct rs arbitrary: bs) |
|
1371 |
apply(simp) |
|
1372 |
apply(case_tac rs) |
|
1373 |
apply(simp only:) |
|
1374 |
apply(simp) |
|
1375 |
apply(case_tac list) |
|
1376 |
apply(simp) |
|
1377 |
by simp |
|
1378 |
||
318 | 1379 |
lemma flts_0: |
1380 |
assumes "nonnested (AALTs bs rs)" |
|
1381 |
shows "\<forall>r \<in> set (flts rs). r \<noteq> AZERO" |
|
1382 |
using assms |
|
1383 |
apply(induct rs arbitrary: bs rule: flts.induct) |
|
1384 |
apply(simp) |
|
1385 |
apply(simp) |
|
1386 |
defer |
|
1387 |
apply(simp) |
|
1388 |
apply(simp) |
|
1389 |
apply(simp) |
|
1390 |
apply(simp) |
|
1391 |
apply(rule ballI) |
|
1392 |
apply(simp) |
|
1393 |
done |
|
322 | 1394 |
|
1395 |
lemma flts_0a: |
|
1396 |
assumes "nonnested (AALTs bs rs)" |
|
1397 |
shows "AZERO \<notin> set (flts rs)" |
|
1398 |
using assms |
|
1399 |
using flts_0 by blast |
|
318 | 1400 |
|
322 | 1401 |
lemma qqq1: |
318 | 1402 |
shows "AZERO \<notin> set (flts (map bsimp rs))" |
322 | 1403 |
by (metis ex_map_conv flts3 good.simps(1) good1) |
318 | 1404 |
|
1405 |
||
323 | 1406 |
fun nonazero :: "arexp \<Rightarrow> bool" |
1407 |
where |
|
1408 |
"nonazero AZERO = False" |
|
1409 |
| "nonazero r = True" |
|
1410 |
||
1411 |
lemma flts_concat: |
|
1412 |
shows "flts rs = concat (map (\<lambda>r. flts [r]) rs)" |
|
1413 |
apply(induct rs) |
|
1414 |
apply(auto) |
|
1415 |
apply(subst k0) |
|
1416 |
apply(simp) |
|
1417 |
done |
|
1418 |
||
1419 |
lemma flts_single1: |
|
1420 |
assumes "nonalt r" "nonazero r" |
|
1421 |
shows "flts [r] = [r]" |
|
1422 |
using assms |
|
1423 |
apply(induct r) |
|
1424 |
apply(auto) |
|
1425 |
done |
|
1426 |
||
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1427 |
lemma flts_qq: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1428 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1429 |
"\<forall>r'\<in>set rs. good r' \<and> nonalt r'" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1430 |
shows "flts (map bsimp rs) = rs" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1431 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1432 |
apply(induct rs) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1433 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1434 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1435 |
apply(subst k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1436 |
apply(subgoal_tac "flts [bsimp a] = [a]") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1437 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1438 |
apply(drule_tac x="a" in spec) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1439 |
apply(drule mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1440 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1441 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1442 |
using good.simps(1) k0b apply blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1443 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1444 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1445 |
|
323 | 1446 |
lemma test: |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1447 |
assumes "good r" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1448 |
shows "bsimp r = r" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1449 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1450 |
apply(induct r taking: "asize" rule: measure_induct) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1451 |
apply(erule good.elims) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1452 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1453 |
apply(subst k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1454 |
apply(subst (2) k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1455 |
apply(subst flts_qq) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1456 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1457 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1458 |
apply (metis append_Cons append_Nil bsimp_AALTs.simps(3) good.simps(1) k0b) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1459 |
apply force+ |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1460 |
apply (metis (no_types, lifting) add_Suc add_Suc_right asize.simps(5) bsimp.simps(1) bsimp_ASEQ.simps(19) less_add_Suc1 less_add_Suc2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1461 |
apply (metis add_Suc add_Suc_right arexp.distinct(5) arexp.distinct(7) asize.simps(4) asize.simps(5) bsimp.simps(1) bsimp.simps(2) bsimp_ASEQ1 good.simps(21) good.simps(8) less_add_Suc1 less_add_Suc2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1462 |
apply force+ |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1463 |
apply (metis (no_types, lifting) add_Suc add_Suc_right arexp.distinct(5) arexp.distinct(7) asize.simps(4) asize.simps(5) bsimp.simps(1) bsimp.simps(2) bsimp_ASEQ1 good.simps(25) good.simps(8) less_add_Suc1 less_add_Suc2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1464 |
apply (metis add_Suc add_Suc_right arexp.distinct(7) asize.simps(4) bsimp.simps(2) bsimp_ASEQ1 good.simps(26) good.simps(8) less_add_Suc1 less_add_Suc2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1465 |
apply force+ |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1466 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1467 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1468 |
lemma test2: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1469 |
assumes "good r" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1470 |
shows "bsimp r = r" |
323 | 1471 |
using assms |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1472 |
apply(induct r taking: "asize" rule: measure_induct) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1473 |
apply(case_tac x) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1474 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1475 |
defer |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1476 |
(* AALT case *) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1477 |
apply(subgoal_tac "1 < length x52") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1478 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1479 |
apply(case_tac x52) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1480 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1481 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1482 |
apply(case_tac list) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1483 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1484 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1485 |
apply(subst bsimp_AALTs_qq) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1486 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1487 |
apply(subst flts_qq) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1488 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1489 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1490 |
apply(case_tac x52) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1491 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1492 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1493 |
apply(case_tac list) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1494 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1495 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1496 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1497 |
apply (metis (no_types, lifting) bsimp_AALTs.elims good.simps(6) length_Cons length_pos_if_in_set list.size(3) nat_neq_iff) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1498 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1499 |
apply(case_tac x52) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1500 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1501 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1502 |
apply(case_tac list) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1503 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1504 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1505 |
apply(subst k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1506 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1507 |
apply(subst (2) k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1508 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1509 |
apply (simp add: Suc_lessI flts1 one_is_add) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1510 |
(* SEQ case *) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1511 |
apply(case_tac "bsimp x42 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1512 |
apply simp |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1513 |
apply (metis asize.elims good.simps(10) good.simps(11) good.simps(12) good.simps(2) good.simps(7) good.simps(9) good_SEQ less_add_Suc1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1514 |
apply(case_tac "\<exists>bs'. bsimp x42 = AONE bs'") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1515 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1516 |
defer |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1517 |
apply(case_tac "bsimp x43 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1518 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1519 |
apply (metis bsimp.elims bsimp.simps(3) good.simps(10) good.simps(11) good.simps(12) good.simps(8) good.simps(9) good_SEQ less_add_Suc2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1520 |
apply(auto) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1521 |
apply (subst bsimp_ASEQ1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1522 |
apply(auto)[3] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1523 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1524 |
apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1525 |
apply (metis bsimp.simps(3) good.simps(2) good_SEQ less_add_Suc1 less_add_Suc2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1526 |
apply (subst bsimp_ASEQ2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1527 |
apply(drule_tac x="x42" in spec) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1528 |
apply(drule mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1529 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1530 |
apply(drule mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1531 |
apply (metis bsimp.elims bsimp.simps(3) good.simps(10) good.simps(11) good.simps(2) good_SEQ) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1532 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1533 |
done |
323 | 1534 |
|
1535 |
||
317 | 1536 |
lemma bsimp_idem: |
1537 |
shows "bsimp (bsimp r) = bsimp r" |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1538 |
using test good1 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1539 |
by force |
317 | 1540 |
|
1541 |
||
314 | 1542 |
lemma q3a: |
1543 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
1544 |
shows "bmkeps (AALTs bs (map (fuse bs1) rs)) = bmkeps (AALTs (bs@bs1) rs)" |
|
1545 |
using assms |
|
1546 |
apply(induct rs arbitrary: bs bs1) |
|
1547 |
apply(simp) |
|
1548 |
apply(simp) |
|
1549 |
apply(auto) |
|
1550 |
apply (metis append_assoc b2 bnullable_correctness erase_fuse r0) |
|
1551 |
apply(case_tac "bnullable a") |
|
1552 |
apply (metis append.assoc b2 bnullable_correctness erase_fuse r0) |
|
1553 |
apply(case_tac rs) |
|
1554 |
apply(simp) |
|
1555 |
apply(simp) |
|
1556 |
apply(auto)[1] |
|
1557 |
apply (metis bnullable_correctness erase_fuse)+ |
|
1558 |
done |
|
1559 |
||
1560 |
lemma qq4: |
|
1561 |
assumes "\<exists>x\<in>set list. bnullable x" |
|
1562 |
shows "\<exists>x\<in>set (flts list). bnullable x" |
|
1563 |
using assms |
|
1564 |
apply(induct list rule: flts.induct) |
|
1565 |
apply(auto) |
|
1566 |
by (metis UnCI bnullable_correctness erase_fuse imageI) |
|
1567 |
||
1568 |
||
1569 |
lemma qs3: |
|
1570 |
assumes "\<exists>r \<in> set rs. bnullable r" |
|
1571 |
shows "bmkeps (AALTs bs rs) = bmkeps (AALTs bs (flts rs))" |
|
1572 |
using assms |
|
1573 |
apply(induct rs arbitrary: bs taking: size rule: measure_induct) |
|
1574 |
apply(case_tac x) |
|
1575 |
apply(simp) |
|
1576 |
apply(simp) |
|
1577 |
apply(case_tac a) |
|
1578 |
apply(simp) |
|
1579 |
apply (simp add: r1) |
|
1580 |
apply(simp) |
|
1581 |
apply (simp add: r0) |
|
1582 |
apply(simp) |
|
1583 |
apply(case_tac "flts list") |
|
1584 |
apply(simp) |
|
1585 |
apply (metis L_erase_AALTs L_erase_flts L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(4) mkeps_nullable r2) |
|
1586 |
apply(simp) |
|
1587 |
apply (simp add: r1) |
|
1588 |
prefer 3 |
|
1589 |
apply(simp) |
|
1590 |
apply (simp add: r0) |
|
1591 |
prefer 2 |
|
1592 |
apply(simp) |
|
1593 |
apply(case_tac "\<exists>x\<in>set x52. bnullable x") |
|
1594 |
apply(case_tac "list") |
|
1595 |
apply(simp) |
|
1596 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
1597 |
apply(erule disjE) |
|
1598 |
apply(subst qq1) |
|
1599 |
apply(auto)[1] |
|
1600 |
apply (metis bnullable_correctness erase_fuse) |
|
1601 |
apply(simp) |
|
1602 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
1603 |
apply(simp) |
|
1604 |
apply(auto)[1] |
|
1605 |
apply(subst qq1) |
|
1606 |
apply (metis bnullable_correctness erase_fuse image_eqI set_map) |
|
1607 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
1608 |
apply(subst qq1) |
|
1609 |
apply (metis bnullable_correctness erase_fuse image_eqI set_map) |
|
1610 |
apply (metis b2 fuse.simps(4) q3a r2) |
|
1611 |
apply(simp) |
|
1612 |
apply(subst qq2) |
|
1613 |
apply (metis bnullable_correctness erase_fuse imageE set_map) |
|
1614 |
prefer 2 |
|
1615 |
apply(case_tac "list") |
|
1616 |
apply(simp) |
|
1617 |
apply(simp) |
|
1618 |
apply (simp add: qq4) |
|
1619 |
apply(simp) |
|
1620 |
apply(auto) |
|
1621 |
apply(case_tac list) |
|
1622 |
apply(simp) |
|
1623 |
apply(simp) |
|
1624 |
apply (simp add: r0) |
|
1625 |
apply(case_tac "bnullable (ASEQ x41 x42 x43)") |
|
1626 |
apply(case_tac list) |
|
1627 |
apply(simp) |
|
1628 |
apply(simp) |
|
1629 |
apply (simp add: r0) |
|
1630 |
apply(simp) |
|
1631 |
using qq4 r1 r2 by auto |
|
1632 |
||
317 | 1633 |
|
314 | 1634 |
|
1635 |
lemma k1: |
|
1636 |
assumes "\<And>x2aa. \<lbrakk>x2aa \<in> set x2a; bnullable x2aa\<rbrakk> \<Longrightarrow> bmkeps x2aa = bmkeps (bsimp x2aa)" |
|
1637 |
"\<exists>x\<in>set x2a. bnullable x" |
|
1638 |
shows "bmkeps (AALTs x1 (flts x2a)) = bmkeps (AALTs x1 (flts (map bsimp x2a)))" |
|
1639 |
using assms |
|
1640 |
apply(induct x2a) |
|
1641 |
apply fastforce |
|
1642 |
apply(simp) |
|
1643 |
apply(subst k0) |
|
1644 |
apply(subst (2) k0) |
|
1645 |
apply(auto)[1] |
|
1646 |
apply (metis b3 k0 list.set_intros(1) qs3 r0) |
|
1647 |
by (smt b3 imageI insert_iff k0 list.set(2) qq3 qs3 r0 r1 set_map) |
|
1648 |
||
1649 |
||
1650 |
||
1651 |
lemma bmkeps_simp: |
|
1652 |
assumes "bnullable r" |
|
1653 |
shows "bmkeps r = bmkeps (bsimp r)" |
|
1654 |
using assms |
|
1655 |
apply(induct r) |
|
1656 |
apply(simp) |
|
1657 |
apply(simp) |
|
1658 |
apply(simp) |
|
1659 |
apply(simp) |
|
1660 |
prefer 3 |
|
1661 |
apply(simp) |
|
1662 |
apply(case_tac "bsimp r1 = AZERO") |
|
1663 |
apply(simp) |
|
1664 |
apply(auto)[1] |
|
1665 |
apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable) |
|
1666 |
apply(case_tac "bsimp r2 = AZERO") |
|
1667 |
apply(simp) |
|
1668 |
apply(auto)[1] |
|
1669 |
apply (metis L_bsimp_erase L_flat_Prf1 L_flat_Prf2 Prf_elims(1) bnullable_correctness erase.simps(1) mkeps_nullable) |
|
1670 |
apply(case_tac "\<exists>bs. bsimp r1 = AONE bs") |
|
1671 |
apply(auto)[1] |
|
1672 |
apply(subst b1) |
|
1673 |
apply(subst b2) |
|
1674 |
apply(simp add: b3[symmetric]) |
|
1675 |
apply(simp) |
|
1676 |
apply(subgoal_tac "bsimp_ASEQ x1 (bsimp r1) (bsimp r2) = ASEQ x1 (bsimp r1) (bsimp r2)") |
|
1677 |
prefer 2 |
|
1678 |
apply (smt b3 bnullable.elims(2) bsimp_ASEQ.simps(17) bsimp_ASEQ.simps(19) bsimp_ASEQ.simps(20) bsimp_ASEQ.simps(21) bsimp_ASEQ.simps(22) bsimp_ASEQ.simps(24) bsimp_ASEQ.simps(25) bsimp_ASEQ.simps(26) bsimp_ASEQ.simps(27) bsimp_ASEQ.simps(29) bsimp_ASEQ.simps(30) bsimp_ASEQ.simps(31)) |
|
1679 |
apply(simp) |
|
1680 |
apply(simp) |
|
1681 |
apply(subst q3[symmetric]) |
|
1682 |
apply simp |
|
1683 |
using b3 qq4 apply auto[1] |
|
1684 |
apply(subst qs3) |
|
1685 |
apply simp |
|
1686 |
using k1 by blast |
|
1687 |
||
1688 |
thm bmkeps_retrieve bmkeps_simp bder_retrieve |
|
1689 |
||
1690 |
lemma bmkeps_bder_AALTs: |
|
1691 |
assumes "\<exists>r \<in> set rs. bnullable (bder c r)" |
|
1692 |
shows "bmkeps (bder c (bsimp_AALTs bs rs)) = bmkeps (bsimp_AALTs bs (map (bder c) rs))" |
|
1693 |
using assms |
|
1694 |
apply(induct rs) |
|
1695 |
apply(simp) |
|
1696 |
apply(simp) |
|
1697 |
apply(auto) |
|
1698 |
apply(case_tac rs) |
|
1699 |
apply(simp) |
|
1700 |
apply (metis (full_types) Prf_injval bder_retrieve bmkeps_retrieve bnullable_correctness erase_bder erase_fuse mkeps_nullable retrieve_fuse2) |
|
1701 |
apply(simp) |
|
1702 |
apply(case_tac rs) |
|
1703 |
apply(simp_all) |
|
1704 |
done |
|
1705 |
||
1706 |
lemma bbs0: |
|
1707 |
shows "blexer_simp r [] = blexer r []" |
|
1708 |
apply(simp add: blexer_def blexer_simp_def) |
|
1709 |
done |
|
1710 |
||
1711 |
lemma bbs1: |
|
1712 |
shows "blexer_simp r [c] = blexer r [c]" |
|
1713 |
apply(simp add: blexer_def blexer_simp_def) |
|
1714 |
apply(auto) |
|
1715 |
defer |
|
1716 |
using b3 apply auto[1] |
|
1717 |
using b3 apply auto[1] |
|
1718 |
apply(subst bmkeps_simp[symmetric]) |
|
1719 |
apply(simp) |
|
1720 |
apply(simp) |
|
1721 |
done |
|
1722 |
||
1723 |
lemma oo: |
|
1724 |
shows "(case (blexer (der c r) s) of None \<Rightarrow> None | Some v \<Rightarrow> Some (injval r c v)) = blexer r (c # s)" |
|
1725 |
apply(simp add: blexer_correctness) |
|
1726 |
done |
|
1727 |
||
318 | 1728 |
|
1729 |
lemma bder_fuse: |
|
1730 |
shows "bder c (fuse bs a) = fuse bs (bder c a)" |
|
1731 |
apply(induct a arbitrary: bs c) |
|
1732 |
apply(simp_all) |
|
1733 |
done |
|
1734 |
||
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1735 |
lemma XXX2_helper: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1736 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize rs)) \<longrightarrow> good y \<longrightarrow> bsimp y = y" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1737 |
"\<forall>r'\<in>set rs. good r' \<and> nonalt r'" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1738 |
shows "flts (map (bsimp \<circ> bder c) (flts (map bsimp rs))) = flts (map (bsimp \<circ> bder c) rs)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1739 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1740 |
apply(induct rs arbitrary: c) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1741 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1742 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1743 |
apply(subst k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1744 |
apply(simp add: flts_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1745 |
apply(subst (2) k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1746 |
apply(simp add: flts_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1747 |
apply(subgoal_tac "flts [a] = [a]") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1748 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1749 |
using good.simps(1) k0b apply blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1750 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1751 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1752 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1753 |
lemma bmkeps_good: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1754 |
assumes "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1755 |
shows "bmkeps (bsimp a) = bmkeps a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1756 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1757 |
using test2 by auto |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1758 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1759 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1760 |
lemma xxx_bder: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1761 |
assumes "good r" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1762 |
shows "L (erase r) \<noteq> {}" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1763 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1764 |
apply(induct r rule: good.induct) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1765 |
apply(auto simp add: Sequ_def) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1766 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1767 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1768 |
lemma xxx_bder2: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1769 |
assumes "L (erase (bsimp r)) = {}" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1770 |
shows "bsimp r = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1771 |
using assms xxx_bder test2 good1 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1772 |
by blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1773 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1774 |
lemma XXX2aa: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1775 |
assumes "good a" |
318 | 1776 |
shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)" |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1777 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1778 |
by (simp add: test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1779 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1780 |
lemma XXX2aa_ders: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1781 |
assumes "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1782 |
shows "bsimp (bders (bsimp a) s) = bsimp (bders a s)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1783 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1784 |
by (simp add: test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1785 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1786 |
lemma XXX4a: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1787 |
shows "good (bders_simp (bsimp r) s) \<or> bders_simp (bsimp r) s = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1788 |
apply(induct s arbitrary: r rule: rev_induct) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1789 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1790 |
apply (simp add: good1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1791 |
apply(simp add: bders_simp_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1792 |
apply (simp add: good1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1793 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1794 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1795 |
lemma XXX4a_good: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1796 |
assumes "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1797 |
shows "good (bders_simp a s) \<or> bders_simp a s = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1798 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1799 |
apply(induct s arbitrary: a rule: rev_induct) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1800 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1801 |
apply(simp add: bders_simp_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1802 |
apply (simp add: good1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1803 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1804 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1805 |
lemma XXX4a_good_cons: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1806 |
assumes "s \<noteq> []" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1807 |
shows "good (bders_simp a s) \<or> bders_simp a s = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1808 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1809 |
apply(case_tac s) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1810 |
apply(auto) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1811 |
using XXX4a by blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1812 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1813 |
lemma XXX4b: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1814 |
assumes "good a" "L (erase (bders_simp a s)) \<noteq> {}" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1815 |
shows "good (bders_simp a s)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1816 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1817 |
apply(induct s arbitrary: a) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1818 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1819 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1820 |
apply(subgoal_tac "L (erase (bder a aa)) = {} \<or> L (erase (bder a aa)) \<noteq> {}") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1821 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1822 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1823 |
apply(erule disjE) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1824 |
apply(subgoal_tac "bsimp (bder a aa) = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1825 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1826 |
using L_bsimp_erase xxx_bder2 apply auto[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1827 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1828 |
apply (metis L.simps(1) XXX4a erase.simps(1)) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1829 |
apply(drule_tac x="bsimp (bder a aa)" in meta_spec) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1830 |
apply(drule meta_mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1831 |
apply simp |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1832 |
apply(rule good1a) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1833 |
apply(auto) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1834 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1835 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1836 |
lemma bders_AZERO: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1837 |
shows "bders AZERO s = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1838 |
and "bders_simp AZERO s = AZERO" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1839 |
apply (induct s) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1840 |
apply(auto) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1841 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1842 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1843 |
lemma ZZ0: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1844 |
assumes "bsimp a = AALTs bs rs" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1845 |
shows "bsimp (bder c a) = AALTs bs (map (bder c) rs)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1846 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1847 |
apply(induct a arbitrary: rs bs c) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1848 |
apply(simp_all) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1849 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1850 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1851 |
apply (metis arexp.distinct(25) arexp.distinct(7) b3 bnullable.simps(2) bsimp_ASEQ.simps(1) bsimp_ASEQ0 bsimp_ASEQ1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1852 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1853 |
oops |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1854 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1855 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1856 |
lemma ZZZ: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1857 |
assumes "\<forall>y. asize y < Suc (sum_list (map asize x52)) \<longrightarrow> bsimp (bder c (bsimp y)) = bsimp (bder c y)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1858 |
shows "bsimp (bder c (bsimp_AALTs x51 (flts (map bsimp x52)))) = bsimp_AALTs x51 (flts (map (bsimp \<circ> bder c) x52))" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1859 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1860 |
apply(induct x52) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1861 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1862 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1863 |
apply(case_tac "bsimp a = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1864 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1865 |
apply(subgoal_tac "bsimp (bder c a) = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1866 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1867 |
using less_add_Suc1 apply fastforce |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1868 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1869 |
apply(case_tac "\<exists>bs rs. bsimp a = AALTs bs rs") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1870 |
apply(clarify) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1871 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1872 |
apply(subst k0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1873 |
apply(case_tac "rs = []") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1874 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1875 |
apply(subgoal_tac "bsimp (bder c a) = AALTs bs []") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1876 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1877 |
apply (metis arexp.distinct(7) good.simps(4) good1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1878 |
oops |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1879 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1880 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1881 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1882 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1883 |
lemma bders_snoc: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1884 |
"bder c (bders a s) = bders a (s @ [c])" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1885 |
apply(simp add: bders_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1886 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1887 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1888 |
lemma |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1889 |
assumes "bnullable (bders a s)" "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1890 |
shows "bmkeps (bders_simp a s) = bmkeps (bders a s)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1891 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1892 |
apply(induct s arbitrary: a) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1893 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1894 |
apply(simp add: bders_append bders_simp_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1895 |
apply(drule_tac x="bsimp (bsimp (bder a aa))" in meta_spec) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1896 |
apply(drule meta_mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1897 |
apply (metis b4 bders.simps(2) bders_simp.simps(2) bsimp_idem) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1898 |
apply(subgoal_tac "good (bsimp (bder a aa)) \<or> bsimp (bder a aa) = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1899 |
apply(auto simp add: bders_AZERO) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1900 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1901 |
apply (metis b4 bders.simps(2) bders_AZERO(2) bders_simp.simps(2) bnullable.simps(1)) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1902 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1903 |
using good1 apply auto[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1904 |
apply(drule meta_mp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1905 |
apply (simp add: bsimp_idem) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1906 |
apply (subst (asm) (1) bsimp_idem) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1907 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1908 |
apply(subst (asm) (2) bmkeps_simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1909 |
apply (metis b4 bders.simps(2) bders_simp.simps(2) bsimp_idem) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1910 |
apply (subst (asm) (1) bsimp_idem) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1911 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1912 |
defer |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1913 |
oops |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1914 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1915 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1916 |
lemma |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1917 |
shows "bmkeps (bders (bders_simp a s2) s1) = bmkeps (bders_simp a (s2 @ s1))" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1918 |
apply(induct s2 arbitrary: a s1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1919 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1920 |
defer |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1921 |
apply(simp add: bders_append bders_simp_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1922 |
oops |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1923 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1924 |
lemma QQ1: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1925 |
shows "bsimp (bders (bsimp a) []) = bders_simp (bsimp a) []" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1926 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1927 |
apply(simp add: bsimp_idem) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1928 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1929 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1930 |
lemma QQ2: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1931 |
shows "bsimp (bders (bsimp a) [c]) = bders_simp (bsimp a) [c]" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1932 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1933 |
done |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1934 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1935 |
lemma QQ3: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1936 |
assumes "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1937 |
shows "bmkeps (bsimp (bders (bsimp a) [c1, c2])) = bmkeps (bders_simp (bsimp a) [c1, c2])" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1938 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1939 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1940 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1941 |
oops |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1942 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1943 |
lemma QQ4: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1944 |
shows "bmkeps (bsimp (bders (bsimp a) [c1, c2, c3])) = bmkeps (bders_simp (bsimp a) [c1, c2, c3])" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1945 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1946 |
oops |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1947 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1948 |
lemma QQ3: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1949 |
assumes "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1950 |
shows "bsimp (bders (bders_simp a s2) s1)= bders_simp a (s1 @ s2)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1951 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1952 |
apply(induct s2 arbitrary: a s1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1953 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1954 |
oops |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1955 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1956 |
lemma XXX2a_long: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1957 |
assumes "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1958 |
shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1959 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1960 |
apply(induct a arbitrary: c taking: asize rule: measure_induct) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1961 |
apply(case_tac x) |
318 | 1962 |
apply(simp) |
1963 |
apply(simp) |
|
1964 |
apply(simp) |
|
1965 |
prefer 3 |
|
1966 |
apply(simp) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1967 |
apply(simp) |
318 | 1968 |
apply(auto)[1] |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1969 |
apply(case_tac "x42 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1970 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1971 |
apply(case_tac "x43 = AZERO") |
318 | 1972 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1973 |
using test2 apply force |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1974 |
apply(case_tac "\<exists>bs. x42 = AONE bs") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1975 |
apply(clarify) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1976 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1977 |
apply(subst bsimp_ASEQ1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1978 |
apply(simp) |
318 | 1979 |
using b3 apply force |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1980 |
using bsimp_ASEQ0 test2 apply force |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1981 |
thm good_SEQ test2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1982 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1983 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1984 |
apply(case_tac "x42 = AZERO") |
318 | 1985 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1986 |
apply(case_tac "x43 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1987 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1988 |
apply (simp add: bsimp_ASEQ0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1989 |
apply(case_tac "\<exists>bs. x42 = AONE bs") |
318 | 1990 |
apply(clarify) |
1991 |
apply(simp) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1992 |
apply(subst bsimp_ASEQ1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1993 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1994 |
using bsimp_ASEQ0 test2 apply force |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1995 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1996 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1997 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1998 |
(* AALTs case *) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
1999 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2000 |
using test2 by fastforce |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2001 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2002 |
lemma XXX2a_long_without_good: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2003 |
shows "bsimp (bder c (bsimp a)) = bsimp (bder c a)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2004 |
apply(induct a arbitrary: c taking: asize rule: measure_induct) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2005 |
apply(case_tac x) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2006 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2007 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2008 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2009 |
prefer 3 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2010 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2011 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2012 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2013 |
apply(case_tac "x42 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2014 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2015 |
apply(case_tac "bsimp x43 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2016 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2017 |
apply (simp add: bsimp_ASEQ0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2018 |
apply(subgoal_tac "bsimp (fuse (bmkeps x42) (bder c x43)) = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2019 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2020 |
apply (metis bder.simps(1) bsimp.simps(3) bsimp_fuse fuse.simps(1) less_add_Suc2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2021 |
apply(case_tac "\<exists>bs. bsimp x42 = AONE bs") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2022 |
apply(clarify) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2023 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2024 |
apply(subst bsimp_ASEQ2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2025 |
apply(subgoal_tac "bsimp (bder c x42) = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2026 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2027 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2028 |
using less_add_Suc1 apply fastforce |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2029 |
apply(subgoal_tac "bmkeps x42 = bs") |
318 | 2030 |
prefer 2 |
2031 |
apply (simp add: bmkeps_simp) |
|
2032 |
apply(simp) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2033 |
apply(case_tac "nonalt (bsimp (bder c x43))") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2034 |
apply (metis bder_fuse bsimp_AALTs.simps(1) bsimp_AALTs.simps(2) bsimp_fuse flts.simps(1) flts.simps(2) fuse.simps(1) fuse_append k0b less_add_Suc2 nn11a) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2035 |
apply(subgoal_tac "nonnested (bsimp (bder c x43))") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2036 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2037 |
using nn1b apply blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2038 |
apply(case_tac x43) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2039 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2040 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2041 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2042 |
prefer 3 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2043 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2044 |
apply (metis arexp.distinct(25) arexp.distinct(7) arexp.distinct(9) bsimp_ASEQ.simps(1) bsimp_ASEQ.simps(11) bsimp_ASEQ1 nn11a nonalt.elims(3) nonalt.simps(6)) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2045 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2046 |
apply(auto)[1] |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2047 |
apply(case_tac "(bsimp (bder c x42a)) = AZERO") |
318 | 2048 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2049 |
|
318 | 2050 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2051 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2052 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2053 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2054 |
apply(subgoal_tac "(\<exists>bs1 rs1. 1 < length rs1 \<and> bsimp (bder c x43) = AALTs bs1 rs1 ) \<or> |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2055 |
(\<exists>bs1 r. bsimp (bder c x43) = fuse bs1 r)") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2056 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2057 |
apply (metis fuse_empty) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2058 |
apply(erule disjE) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2059 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2060 |
apply(clarify) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2061 |
apply(simp only:) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2062 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2063 |
apply(simp add: fuse_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2064 |
apply(subst bder_fuse) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2065 |
apply(subst bsimp_fuse[symmetric]) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2066 |
apply(subst bder_fuse) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2067 |
apply(subst bsimp_fuse[symmetric]) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2068 |
apply(subgoal_tac "bsimp (bder c (bsimp x43)) = bsimp (bder c x43)") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2069 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2070 |
using less_add_Suc2 apply blast |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2071 |
apply(simp only: ) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2072 |
apply(subst bsimp_fuse[symmetric]) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2073 |
apply(simp only: ) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2074 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2075 |
apply(simp only: fuse.simps) |
318 | 2076 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2077 |
apply(case_tac rs1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2078 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2079 |
apply (me tis arexp.distinct(7) fuse.simps(1) good.simps(4) good1 good_fuse) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2080 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2081 |
apply(case_tac list) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2082 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2083 |
apply (metis arexp.distinct(7) fuse.simps(1) good.simps(5) good1 good_fuse) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2084 |
apply(simp only: bsimp_AALTs.simps map_cons.simps) |
318 | 2085 |
apply(auto)[1] |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2086 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2087 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2088 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2089 |
apply(subst bsimp_fuse[symmetric]) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2090 |
apply(subgoal_tac "bmkeps x42 = bs") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2091 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2092 |
apply (simp add: bmkeps_simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2093 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2094 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2095 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2096 |
|
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2097 |
using b3 apply force |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2098 |
using bsimp_ASEQ0 test2 apply force |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2099 |
thm good_SEQ test2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2100 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2101 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2102 |
apply(case_tac "x42 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2103 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2104 |
apply(case_tac "x43 = AZERO") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2105 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2106 |
apply (simp add: bsimp_ASEQ0) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2107 |
apply(case_tac "\<exists>bs. x42 = AONE bs") |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2108 |
apply(clarify) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2109 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2110 |
apply(subst bsimp_ASEQ1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2111 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2112 |
using bsimp_ASEQ0 test2 apply force |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2113 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2114 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2115 |
apply (simp add: good_SEQ test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2116 |
(* AALTs case *) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2117 |
apply(simp) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2118 |
using test2 by fastforce |
318 | 2119 |
|
2120 |
||
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2121 |
lemma XXX4ab: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2122 |
shows "good (bders_simp (bsimp r) s) \<or> bders_simp (bsimp r) s = AZERO" |
318 | 2123 |
apply(induct s arbitrary: r rule: rev_induct) |
2124 |
apply(simp) |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2125 |
apply (simp add: good1) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2126 |
apply(simp add: bders_simp_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2127 |
apply (simp add: good1) |
318 | 2128 |
done |
2129 |
||
2130 |
lemma XXX4: |
|
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2131 |
assumes "good a" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2132 |
shows "bders_simp a s = bsimp (bders a s)" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2133 |
using assms |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2134 |
apply(induct s arbitrary: a rule: rev_induct) |
318 | 2135 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2136 |
apply (simp add: test2) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2137 |
apply(simp add: bders_append bders_simp_append) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2138 |
oops |
318 | 2139 |
|
2140 |
||
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2141 |
lemma MAINMAIN: |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2142 |
"blexer r s = blexer_simp r s" |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2143 |
apply(induct s arbitrary: r) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2144 |
apply(simp add: blexer_def blexer_simp_def) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2145 |
apply(simp add: blexer_def blexer_simp_def del: bders.simps bders_simp.simps) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2146 |
apply(auto simp del: bders.simps bders_simp.simps) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2147 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2148 |
apply (metis b4 bders.simps(2) bders_simp.simps(2)) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2149 |
prefer 2 |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2150 |
apply (metis b4 bders.simps(2)) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2151 |
apply(subst bmkeps_simp) |
318 | 2152 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2153 |
apply(case_tac s) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2154 |
apply(simp only: bders.simps) |
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2155 |
apply(subst bders_simp.simps) |
318 | 2156 |
apply(simp) |
324
d9d4146325d9
added another context-free-expression paper
Christian Urban <urbanc@in.tum.de>
parents:
323
diff
changeset
|
2157 |
|
295 | 2158 |
|
148
702ed601349b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2159 |
end |