587
|
1 |
|
|
2 |
theory FBound
|
|
3 |
imports "BlexerSimp" "ClosedFormsBounds"
|
|
4 |
begin
|
|
5 |
|
|
6 |
fun distinctBy :: "'a list \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b set \<Rightarrow> 'a list"
|
|
7 |
where
|
|
8 |
"distinctBy [] f acc = []"
|
|
9 |
| "distinctBy (x#xs) f acc =
|
|
10 |
(if (f x) \<in> acc then distinctBy xs f acc
|
|
11 |
else x # (distinctBy xs f ({f x} \<union> acc)))"
|
|
12 |
|
|
13 |
fun rerase :: "arexp \<Rightarrow> rrexp"
|
|
14 |
where
|
|
15 |
"rerase AZERO = RZERO"
|
|
16 |
| "rerase (AONE _) = RONE"
|
|
17 |
| "rerase (ACHAR _ c) = RCHAR c"
|
|
18 |
| "rerase (AALTs bs rs) = RALTS (map rerase rs)"
|
|
19 |
| "rerase (ASEQ _ r1 r2) = RSEQ (rerase r1) (rerase r2)"
|
|
20 |
| "rerase (ASTAR _ r) = RSTAR (rerase r)"
|
|
21 |
| "rerase (ANTIMES _ r n) = RNTIMES (rerase r) n"
|
|
22 |
|
|
23 |
lemma eq1_rerase:
|
|
24 |
shows "x ~1 y \<longleftrightarrow> (rerase x) = (rerase y)"
|
|
25 |
apply(induct x y rule: eq1.induct)
|
|
26 |
apply(auto)
|
|
27 |
done
|
|
28 |
|
|
29 |
|
|
30 |
lemma distinctBy_distinctWith:
|
|
31 |
shows "distinctBy xs f (f ` acc) = distinctWith xs (\<lambda>x y. f x = f y) acc"
|
|
32 |
apply(induct xs arbitrary: acc)
|
|
33 |
apply(auto)
|
|
34 |
by (metis image_insert)
|
|
35 |
|
|
36 |
lemma distinctBy_distinctWith2:
|
|
37 |
shows "distinctBy xs rerase {} = distinctWith xs eq1 {}"
|
|
38 |
apply(subst distinctBy_distinctWith[of _ _ "{}", simplified])
|
|
39 |
using eq1_rerase by presburger
|
|
40 |
|
|
41 |
lemma asize_rsize:
|
|
42 |
shows "rsize (rerase r) = asize r"
|
|
43 |
apply(induct r rule: rerase.induct)
|
|
44 |
apply(auto)
|
|
45 |
apply (metis (mono_tags, lifting) comp_apply map_eq_conv)
|
|
46 |
done
|
|
47 |
|
|
48 |
lemma rerase_fuse:
|
|
49 |
shows "rerase (fuse bs r) = rerase r"
|
|
50 |
apply(induct r)
|
|
51 |
apply simp+
|
|
52 |
done
|
|
53 |
|
|
54 |
lemma rerase_bsimp_ASEQ:
|
|
55 |
shows "rerase (bsimp_ASEQ x1 a1 a2) = rsimp_SEQ (rerase a1) (rerase a2)"
|
|
56 |
apply(induct x1 a1 a2 rule: bsimp_ASEQ.induct)
|
|
57 |
apply(auto)
|
|
58 |
done
|
|
59 |
|
|
60 |
lemma rerase_bsimp_AALTs:
|
|
61 |
shows "rerase (bsimp_AALTs bs rs) = rsimp_ALTs (map rerase rs)"
|
|
62 |
apply(induct bs rs rule: bsimp_AALTs.induct)
|
|
63 |
apply(auto simp add: rerase_fuse)
|
|
64 |
done
|
|
65 |
|
|
66 |
fun anonalt :: "arexp \<Rightarrow> bool"
|
|
67 |
where
|
|
68 |
"anonalt (AALTs bs2 rs) = False"
|
|
69 |
| "anonalt r = True"
|
|
70 |
|
|
71 |
|
|
72 |
fun agood :: "arexp \<Rightarrow> bool" where
|
|
73 |
"agood AZERO = False"
|
|
74 |
| "agood (AONE cs) = True"
|
|
75 |
| "agood (ACHAR cs c) = True"
|
|
76 |
| "agood (AALTs cs []) = False"
|
|
77 |
| "agood (AALTs cs [r]) = False"
|
|
78 |
| "agood (AALTs cs (r1#r2#rs)) = (distinct (map rerase (r1 # r2 # rs)) \<and>(\<forall>r' \<in> set (r1#r2#rs). agood r' \<and> anonalt r'))"
|
|
79 |
| "agood (ASEQ _ AZERO _) = False"
|
|
80 |
| "agood (ASEQ _ (AONE _) _) = False"
|
|
81 |
| "agood (ASEQ _ _ AZERO) = False"
|
|
82 |
| "agood (ASEQ cs r1 r2) = (agood r1 \<and> agood r2)"
|
|
83 |
| "agood (ASTAR cs r) = True"
|
|
84 |
|
|
85 |
|
|
86 |
fun anonnested :: "arexp \<Rightarrow> bool"
|
|
87 |
where
|
|
88 |
"anonnested (AALTs bs2 []) = True"
|
|
89 |
| "anonnested (AALTs bs2 ((AALTs bs1 rs1) # rs2)) = False"
|
|
90 |
| "anonnested (AALTs bs2 (r # rs2)) = anonnested (AALTs bs2 rs2)"
|
|
91 |
| "anonnested r = True"
|
|
92 |
|
|
93 |
|
|
94 |
lemma asize0:
|
|
95 |
shows "0 < asize r"
|
|
96 |
apply(induct r)
|
|
97 |
apply(auto)
|
|
98 |
done
|
|
99 |
|
|
100 |
lemma rnullable:
|
|
101 |
shows "rnullable (rerase r) = bnullable r"
|
|
102 |
apply(induct r rule: rerase.induct)
|
|
103 |
apply(auto)
|
|
104 |
done
|
|
105 |
|
|
106 |
lemma rder_bder_rerase:
|
|
107 |
shows "rder c (rerase r ) = rerase (bder c r)"
|
|
108 |
apply (induct r)
|
|
109 |
apply (auto)
|
|
110 |
using rerase_fuse apply presburger
|
|
111 |
using rnullable apply blast
|
|
112 |
using rnullable by blast
|
|
113 |
|
|
114 |
lemma rerase_map_bsimp:
|
|
115 |
assumes "\<And> r. r \<in> set rs \<Longrightarrow> rerase (bsimp r) = (rsimp \<circ> rerase) r"
|
|
116 |
shows "map rerase (map bsimp rs) = map (rsimp \<circ> rerase) rs"
|
|
117 |
using assms
|
|
118 |
apply(induct rs)
|
|
119 |
by simp_all
|
|
120 |
|
|
121 |
|
|
122 |
lemma rerase_flts:
|
|
123 |
shows "map rerase (flts rs) = rflts (map rerase rs)"
|
|
124 |
apply(induct rs rule: flts.induct)
|
|
125 |
apply(auto simp add: rerase_fuse)
|
|
126 |
done
|
|
127 |
|
|
128 |
lemma rerase_dB:
|
|
129 |
shows "map rerase (distinctBy rs rerase acc) = rdistinct (map rerase rs) acc"
|
|
130 |
apply(induct rs arbitrary: acc)
|
|
131 |
apply simp+
|
|
132 |
done
|
|
133 |
|
|
134 |
lemma rerase_earlier_later_same:
|
|
135 |
assumes " \<And>r. r \<in> set rs \<Longrightarrow> rerase (bsimp r) = rsimp (rerase r)"
|
|
136 |
shows " (map rerase (distinctBy (flts (map bsimp rs)) rerase {})) =
|
|
137 |
(rdistinct (rflts (map (rsimp \<circ> rerase) rs)) {})"
|
|
138 |
apply(subst rerase_dB)
|
|
139 |
apply(subst rerase_flts)
|
|
140 |
apply(subst rerase_map_bsimp)
|
|
141 |
apply auto
|
|
142 |
using assms
|
|
143 |
apply simp
|
|
144 |
done
|
|
145 |
|
|
146 |
lemma bsimp_rerase:
|
|
147 |
shows "rerase (bsimp a) = rsimp (rerase a)"
|
|
148 |
apply(induct a rule: bsimp.induct)
|
|
149 |
apply(auto)
|
|
150 |
using rerase_bsimp_ASEQ apply presburger
|
|
151 |
using distinctBy_distinctWith2 rerase_bsimp_AALTs rerase_earlier_later_same by fastforce
|
|
152 |
|
|
153 |
lemma rders_simp_size:
|
|
154 |
shows "rders_simp (rerase r) s = rerase (bders_simp r s)"
|
|
155 |
apply(induct s rule: rev_induct)
|
|
156 |
apply simp
|
|
157 |
by (simp add: bders_simp_append rder_bder_rerase rders_simp_append bsimp_rerase)
|
|
158 |
|
|
159 |
|
|
160 |
corollary aders_simp_finiteness:
|
|
161 |
assumes "\<exists>N. \<forall>s. rsize (rders_simp (rerase r) s) \<le> N"
|
|
162 |
shows " \<exists>N. \<forall>s. asize (bders_simp r s) \<le> N"
|
|
163 |
proof -
|
|
164 |
from assms obtain N where "\<forall>s. rsize (rders_simp (rerase r) s) \<le> N"
|
|
165 |
by blast
|
|
166 |
then have "\<forall>s. rsize (rerase (bders_simp r s)) \<le> N"
|
|
167 |
by (simp add: rders_simp_size)
|
|
168 |
then have "\<forall>s. asize (bders_simp r s) \<le> N"
|
|
169 |
by (simp add: asize_rsize)
|
|
170 |
then show "\<exists>N. \<forall>s. asize (bders_simp r s) \<le> N" by blast
|
|
171 |
qed
|
|
172 |
|
|
173 |
theorem annotated_size_bound:
|
|
174 |
shows "\<exists>N. \<forall>s. asize (bders_simp r s) \<le> N"
|
|
175 |
apply(insert aders_simp_finiteness)
|
|
176 |
by (simp add: rders_simp_bounded)
|
|
177 |
|
|
178 |
definition bitcode_agnostic :: "(arexp \<Rightarrow> arexp ) \<Rightarrow> bool"
|
|
179 |
where " bitcode_agnostic f = (\<forall>a1 a2. rerase a1 = rerase a2 \<longrightarrow> rerase (f a1) = rerase (f a2)) "
|
|
180 |
|
|
181 |
lemma bitcode_agnostic_bsimp:
|
|
182 |
shows "bitcode_agnostic bsimp"
|
|
183 |
by (simp add: bitcode_agnostic_def bsimp_rerase)
|
|
184 |
|
|
185 |
thm bsimp_rerase
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
lemma unsure_unchanging:
|
|
190 |
assumes "bsimp a = bsimp b"
|
|
191 |
and "a ~1 b"
|
|
192 |
shows "a = b"
|
|
193 |
using assms
|
|
194 |
apply(induct rule: eq1.induct)
|
|
195 |
apply simp+
|
|
196 |
oops
|
|
197 |
|
|
198 |
lemma eq1rerase:
|
|
199 |
shows "rerase r1 = rerase r2 \<longleftrightarrow> r1 ~1 r2"
|
|
200 |
using eq1_rerase by presburger
|
|
201 |
|
|
202 |
thm contrapos_pp
|
|
203 |
|
|
204 |
lemma r_part_neq_whole:
|
|
205 |
shows "RSEQ r1 r2 \<noteq> r2"
|
|
206 |
apply simp
|
|
207 |
done
|
|
208 |
|
|
209 |
lemma r_part_neq_whole2:
|
|
210 |
shows "RSEQ r1 r2 \<noteq> rsimp r2"
|
|
211 |
by (metis good.simps(7) good.simps(8) good1 good_SEQ r_part_neq_whole rrexp.distinct(5) rsimp.simps(3) test)
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
lemma arexpfiniteaux1:
|
|
216 |
shows "rerase (bsimp_ASEQ x41 (bsimp x42) (bsimp x43)) = RSEQ (rerase x42) (rerase x43) \<Longrightarrow> \<forall>bs. bsimp x42 \<noteq> AONE bs"
|
|
217 |
apply(erule contrapos_pp)
|
|
218 |
apply simp
|
|
219 |
apply(erule exE)
|
|
220 |
apply simp
|
|
221 |
by (metis bsimp_rerase r_part_neq_whole2 rerase_fuse)
|
|
222 |
|
|
223 |
lemma arexpfiniteaux2:
|
|
224 |
shows "rerase (bsimp_ASEQ x41 (bsimp x42) (bsimp x43)) = RSEQ (rerase x42) (rerase x43) \<Longrightarrow> bsimp x42 \<noteq> AZERO "
|
|
225 |
apply(erule contrapos_pp)
|
|
226 |
apply simp
|
|
227 |
done
|
|
228 |
|
|
229 |
lemma arexpfiniteaux3:
|
|
230 |
shows "rerase (bsimp_ASEQ x41 (bsimp x42) (bsimp x43)) = RSEQ (rerase x42) (rerase x43) \<Longrightarrow> bsimp x43 \<noteq> AZERO "
|
|
231 |
apply(erule contrapos_pp)
|
|
232 |
apply simp
|
|
233 |
done
|
|
234 |
|
588
|
235 |
lemma aux_aux_aux:
|
|
236 |
shows "map rerase (flts (map bsimp rs)) = map rerase rs \<Longrightarrow> map rerase (map bsimp rs) = map rerase rs"
|
|
237 |
oops
|
|
238 |
|
|
239 |
inductive leq1 ("_ \<le>1 _" [80, 80] 80) where
|
|
240 |
"r1 \<le>1 r1"
|
|
241 |
| "AZERO \<le>1 ASEQ bs AZERO r"
|
|
242 |
| "AZERO \<le>1 ASEQ bs r AZERO"
|
|
243 |
| "fuse (bs @ bs1) r2 \<le>1 ASEQ bs (AONE bs1) r2"
|
590
|
244 |
| "AALTs bs (rs1 @ rs) \<le>1 AALTs bs (rs1 @( AZERO # rs))"
|
|
245 |
| "AALTs bs (rsa @ (map (fuse bs1) rs1) @ rsb) \<le>1 AALTs bs (rsa @ (AALTs bs1 rs1) # rsb)"
|
588
|
246 |
| "rerase a1 = rerase a2 \<Longrightarrow> AALTs bs (rsa @ [a1] @ rsb @ rsc) \<le>1 AALTs bs (rsa @ [a1] @ rsb @ [a2] @ rsc) "
|
|
247 |
| "r1 \<le>1 r2 \<Longrightarrow> r1 \<le>1 ASEQ bs (AONE bs1) r2"
|
589
|
248 |
| "r2 \<le>1 r1 \<Longrightarrow> AALTs bs (rs1 @ r2 # rs) \<le>1 AALTs bs (rs1 @ r1 # rs)"
|
|
249 |
| "r2 \<le>1 r1 \<Longrightarrow> ASEQ bs r r2 \<le>1 ASEQ bs r r1"
|
|
250 |
| "r2 \<le>1 r1 \<Longrightarrow> ASEQ bs r2 r \<le>1 ASEQ bs r1 r"
|
|
251 |
| "r \<le>1 r' \<Longrightarrow> ASTAR bs r \<le>1 ASTAR bs r'"
|
|
252 |
| "AZERO \<le>1 AALTs bs []"
|
|
253 |
| "fuse bs r \<le>1 AALTs bs [r]"
|
|
254 |
| "\<lbrakk>r1' \<le>1 r1; r2' \<le>1 r2\<rbrakk> \<Longrightarrow> bsimp_ASEQ bs1 r1' r2' \<le>1 ASEQ bs1 r1 r2"
|
590
|
255 |
| "\<lbrakk>AALTs bs rs1 \<le>1 AALTs bs rs2; r1 \<le>1 r2 \<rbrakk> \<Longrightarrow> AALTs bs (r1 # rs1) \<le>1 AALTs bs (r2 # rs2)"
|
|
256 |
| "\<lbrakk>r1 \<le>1 r2; r2 \<le>1 r3 \<rbrakk> \<Longrightarrow> r1 \<le>1 r3"
|
|
257 |
|
|
258 |
|
|
259 |
lemma leq1_6_variant1:
|
|
260 |
shows "AALTs bs ( (map (fuse bs1) rs1) @ rsb) \<le>1 AALTs bs ((AALTs bs1 rs1) # rsb)"
|
|
261 |
by (metis leq1.intros(6) self_append_conv2)
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
lemma flts_leq1:
|
|
266 |
shows "AALTs bs (flts rs) \<le>1 AALTs bs rs"
|
|
267 |
apply(induct rule: flts.induct)
|
|
268 |
apply (simp add: leq1.intros(1))
|
|
269 |
apply simp
|
|
270 |
apply (metis append_Nil leq1.intros(17) leq1.intros(5))
|
|
271 |
apply simp
|
|
272 |
apply(subgoal_tac "AALTs bs (map (fuse bsa) rs1 @ flts rs) \<le>1 AALTs bs (AALTs bsa rs1 # flts rs)")
|
|
273 |
apply (meson leq1.intros(1) leq1.intros(16) leq1.intros(17))
|
|
274 |
using leq1_6_variant1 apply presburger
|
|
275 |
apply (simp add: leq1.intros(1) leq1.intros(16))
|
|
276 |
using leq1.intros(1) leq1.intros(16) apply auto[1]
|
|
277 |
using leq1.intros(1) leq1.intros(16) apply force
|
|
278 |
apply (simp add: leq1.intros(1) leq1.intros(16))
|
|
279 |
using leq1.intros(1) leq1.intros(16) by force
|
|
280 |
|
|
281 |
lemma dB_leq12:
|
591
|
282 |
shows "AALTs bs (rs1 @ (distinctWith rs1 eq1 (set rs2))) \<le>1 AALTs bs (rs1 @ rs2)"
|
|
283 |
apply(induct rs1 arbitrary: rs2)
|
|
284 |
apply simp
|
590
|
285 |
sorry
|
|
286 |
|
|
287 |
|
|
288 |
lemma dB_leq1:
|
|
289 |
shows "AALTs bs (distinctWith rs eq1 {}) \<le>1 AALTs bs rs"
|
591
|
290 |
sorry
|
|
291 |
|
590
|
292 |
|
|
293 |
|
589
|
294 |
|
|
295 |
lemma stupid_leq1_1:
|
|
296 |
shows " rerase r2 \<noteq> RSEQ r (RSEQ RONE (rerase r2))"
|
|
297 |
apply(induct r2)
|
|
298 |
apply simp+
|
|
299 |
done
|
|
300 |
|
|
301 |
lemma leq1_size:
|
|
302 |
shows "r1 \<le>1 r2 \<Longrightarrow> asize r1 \<le> asize r2"
|
|
303 |
apply (induct rule: leq1.induct)
|
|
304 |
apply simp+
|
|
305 |
apply (metis asize_rsize le_SucI le_add2 plus_1_eq_Suc rerase_fuse)
|
|
306 |
apply simp
|
|
307 |
apply simp
|
|
308 |
|
|
309 |
apply (metis (mono_tags, lifting) asize_rsize comp_apply dual_order.eq_iff le_SucI map_eq_conv rerase_fuse)
|
|
310 |
apply simp+
|
|
311 |
apply (metis Suc_n_not_le_n asize_rsize linorder_le_cases rerase_fuse)
|
|
312 |
apply(case_tac "r1' = AZERO")
|
|
313 |
apply simp
|
|
314 |
apply(case_tac "\<exists>bs1. r1' = AONE bs1")
|
|
315 |
apply(erule exE)
|
|
316 |
apply simp
|
|
317 |
apply (metis asize_rsize le_SucI rerase_fuse trans_le_add2)
|
590
|
318 |
apply (smt (verit, best) Suc_eq_plus1 ab_semigroup_add_class.add_ac(1) add.commute add.right_neutral add_cancel_right_right add_mono_thms_linordered_semiring(1) asize.simps(5) asize_rsize nat_add_left_cancel_le order.trans order_trans plus_1_eq_Suc rSEQ_mono rerase_bsimp_ASEQ rsize.simps(5))
|
|
319 |
sorry
|
589
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
lemma size_deciding_equality:
|
|
324 |
shows "asize r1 \<noteq> asize r2 \<Longrightarrow> r1 \<noteq> r2 "
|
|
325 |
apply auto
|
|
326 |
done
|
|
327 |
|
|
328 |
lemma size_deciding_equality2:
|
|
329 |
shows "rerase r1 = rerase r2 \<Longrightarrow> asize r1 = asize r2"
|
|
330 |
by (metis asize_rsize)
|
|
331 |
|
|
332 |
lemma size_deciding_equality3:
|
|
333 |
shows "asize r1 \<noteq> asize r2 \<Longrightarrow> rerase r1 \<noteq> rerase r2"
|
|
334 |
by (metis asize_rsize)
|
|
335 |
|
|
336 |
lemma size_deciding_equality4:
|
|
337 |
shows "rerase a1 = r2 \<Longrightarrow> asize a1 = rsize r2"
|
|
338 |
by (metis asize_rsize)
|
|
339 |
|
|
340 |
lemma size_deciding_equality5:
|
|
341 |
shows "asize a1 \<noteq> rsize r2 \<Longrightarrow>rerase a1 \<noteq> r2"
|
|
342 |
by (metis asize_rsize)
|
|
343 |
|
|
344 |
lemma leq1_trans1:
|
|
345 |
shows " r1 \<le>1 r2 \<Longrightarrow> rerase r1 \<noteq> RSEQ r (rerase r2)"
|
|
346 |
apply(induct rule: leq1.induct)
|
|
347 |
apply simp+
|
|
348 |
using rerase_fuse stupid_leq1_1 apply presburger
|
|
349 |
apply simp+
|
|
350 |
apply(subgoal_tac "asize r1 \<noteq> rsize (RSEQ r (RSEQ RONE (rerase r2)))")
|
|
351 |
using size_deciding_equality5 apply blast
|
|
352 |
using asize_rsize leq1_size apply fastforce
|
|
353 |
apply simp+
|
|
354 |
apply(subgoal_tac "rsize (rerase (fuse bs ra)) \<noteq> rsize (RSEQ r (RALTS [rerase ra]))")
|
|
355 |
|
|
356 |
apply force
|
|
357 |
apply simp
|
|
358 |
apply(simp add: asize_rsize)
|
590
|
359 |
apply (simp add: rerase_fuse size_deciding_equality4)
|
|
360 |
apply (metis Suc_n_not_le_n asize_rsize leq1.intros(15) leq1_size rsize.simps(5) trans_le_add2)
|
|
361 |
sorry
|
589
|
362 |
|
|
363 |
|
588
|
364 |
|
|
365 |
lemma leq1_less_or_equal: shows
|
|
366 |
"r1 \<le>1 r2 \<Longrightarrow> r1 = r2 \<or> rerase r1 \<noteq> rerase r2"
|
|
367 |
apply(induct rule: leq1.induct)
|
589
|
368 |
apply simp
|
|
369 |
apply simp
|
|
370 |
apply simp
|
|
371 |
apply (simp add: rerase_fuse)
|
|
372 |
apply simp
|
|
373 |
apply simp
|
|
374 |
using r_finite1 rerase_fuse apply force
|
|
375 |
apply simp
|
|
376 |
apply simp
|
|
377 |
apply(case_tac "r1 = r2")
|
|
378 |
apply simp
|
|
379 |
apply simp
|
|
380 |
|
|
381 |
using leq1_trans1 apply presburger
|
|
382 |
apply simp
|
|
383 |
apply simp
|
|
384 |
apply simp
|
|
385 |
apply simp
|
|
386 |
apply simp
|
590
|
387 |
apply simp
|
588
|
388 |
|
590
|
389 |
using r_finite1 rerase_fuse apply auto[1]
|
|
390 |
apply (smt (verit, best) BlexerSimp.bsimp_ASEQ0 BlexerSimp.bsimp_ASEQ2 bsimp_ASEQ.simps(1) bsimp_ASEQ1 leq1_trans1 rerase.simps(5) rerase_bsimp_ASEQ rerase_fuse rrexp.inject(2) rsimp_SEQ.simps(22))
|
|
391 |
sorry
|
588
|
392 |
|
589
|
393 |
|
588
|
394 |
|
589
|
395 |
|
588
|
396 |
|
|
397 |
lemma arexpfiniteaux4:
|
|
398 |
shows"
|
|
399 |
\<lbrakk>\<And>x. \<lbrakk>x \<in> set rs; rerase (bsimp x) = rerase x\<rbrakk> \<Longrightarrow> bsimp x = x;
|
|
400 |
rerase (bsimp_AALTs bs1 (distinctWith (flts (map bsimp rs)) eq1 {})) = RALTS (map rerase rs)\<rbrakk>
|
|
401 |
\<Longrightarrow> bsimp_AALTs bs1 (distinctWith (flts (map bsimp rs)) eq1 {}) = AALTs bs1 rs"
|
|
402 |
apply(induct rs)
|
|
403 |
apply simp
|
|
404 |
|
|
405 |
|
|
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
sorry
|
|
411 |
|
|
412 |
|
|
413 |
|
587
|
414 |
|
|
415 |
lemma arexp_finite1:
|
|
416 |
shows "rerase (bsimp b) = rerase b \<Longrightarrow> bsimp b = b"
|
588
|
417 |
apply(induct rule: bsimp.induct)
|
|
418 |
apply simp
|
|
419 |
apply (smt (verit) arexpfiniteaux1 arexpfiniteaux2 arexpfiniteaux3 bsimp_ASEQ1 rerase.simps(5) rrexp.inject(2))
|
|
420 |
apply simp
|
|
421 |
|
|
422 |
using arexpfiniteaux4 apply blast
|
|
423 |
apply simp+
|
|
424 |
done
|
|
425 |
(*
|
587
|
426 |
apply(induct b)
|
|
427 |
apply simp+
|
|
428 |
apply(case_tac "bsimp b2 = AZERO")
|
|
429 |
apply simp
|
|
430 |
apply (case_tac "bsimp b1 = AZERO")
|
|
431 |
apply simp
|
|
432 |
apply(case_tac "\<exists>bs. bsimp b1 = AONE bs")
|
|
433 |
using arexpfiniteaux1 apply blast
|
|
434 |
apply simp
|
|
435 |
apply(subgoal_tac "bsimp_ASEQ x1 (bsimp b1) (bsimp b2) = ASEQ x1 (bsimp b1) (bsimp b2)")
|
|
436 |
apply simp
|
|
437 |
using bsimp_ASEQ1 apply presburger
|
|
438 |
apply simp
|
|
439 |
|
|
440 |
sorry
|
588
|
441 |
*)
|
|
442 |
|
587
|
443 |
|
|
444 |
lemma bitcodes_unchanging2:
|
|
445 |
assumes "bsimp a = b"
|
|
446 |
and "a ~1 b"
|
|
447 |
shows "a = b"
|
|
448 |
using assms
|
|
449 |
apply(induct rule: eq1.induct)
|
|
450 |
apply simp
|
|
451 |
apply simp
|
|
452 |
apply simp
|
|
453 |
|
|
454 |
apply auto
|
|
455 |
|
|
456 |
sorry
|
|
457 |
|
|
458 |
|
|
459 |
|
589
|
460 |
lemma bsimp_reduces:
|
|
461 |
shows "bsimp r \<le>1 r"
|
|
462 |
apply(induct rule: bsimp.induct)
|
|
463 |
apply simp
|
590
|
464 |
apply (simp add: leq1.intros(15))
|
|
465 |
apply simp
|
|
466 |
apply(case_tac rs)
|
|
467 |
apply simp
|
589
|
468 |
|
590
|
469 |
apply (simp add: leq1.intros(13))
|
|
470 |
apply(case_tac list)
|
|
471 |
apply simp
|
|
472 |
|
|
473 |
|
589
|
474 |
sorry
|
|
475 |
|
|
476 |
|
|
477 |
|
587
|
478 |
lemma bitcodes_unchanging:
|
|
479 |
shows "\<lbrakk>bsimp a = b; rerase a = rerase b \<rbrakk> \<Longrightarrow> a = b"
|
|
480 |
apply(induction a arbitrary: b)
|
|
481 |
apply simp+
|
|
482 |
apply(case_tac "\<exists>bs. bsimp a1 = AONE bs")
|
|
483 |
apply(erule exE)
|
|
484 |
apply simp
|
|
485 |
prefer 2
|
|
486 |
apply(case_tac "bsimp a1 = AZERO")
|
|
487 |
apply simp
|
|
488 |
apply simp
|
|
489 |
apply (metis BlexerSimp.bsimp_ASEQ0 bsimp_ASEQ1 rerase.simps(1) rerase.simps(5) rrexp.distinct(5) rrexp.inject(2))
|
|
490 |
|
|
491 |
sorry
|
|
492 |
|
|
493 |
|
|
494 |
lemma bagnostic_shows_bsimp_idem:
|
|
495 |
assumes "bitcode_agnostic bsimp"
|
|
496 |
and "rerase (bsimp a) = rsimp (rerase a)"
|
|
497 |
and "rsimp r = rsimp (rsimp r)"
|
|
498 |
shows "bsimp a = bsimp (bsimp a)"
|
|
499 |
|
|
500 |
oops
|
|
501 |
|
|
502 |
theorem bsimp_idem:
|
|
503 |
shows "bsimp (bsimp a) = bsimp a"
|
|
504 |
using bitcodes_unchanging bsimp_rerase rsimp_idem by auto
|
|
505 |
|
589
|
506 |
|
587
|
507 |
unused_thms
|
|
508 |
|
|
509 |
end
|