-
Notifications
You must be signed in to change notification settings - Fork 108
/
CCorresE.thy
427 lines (394 loc) · 17.5 KB
/
CCorresE.thy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
(*
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*)
(*
* A simple CCorres framework extension supporting exceptions on the monadic side.
*)
theory CCorresE
imports SimplBucket NonDetMonadEx
begin
(*
* A special form of "ccorres" where either side may throw an
* exception if the other also throws an exception.
*)
definition
ccorresE :: "('t \<Rightarrow> 's) \<Rightarrow> bool \<Rightarrow> ('p \<Rightarrow> ('t, 'p, 'ee) com option)
\<Rightarrow> ('s \<Rightarrow> bool) \<Rightarrow> ('t set)
\<Rightarrow> ('s, unit + unit) nondet_monad \<Rightarrow> ('t, 'p, 'ee) com \<Rightarrow> bool"
where
"ccorresE st check_term \<Gamma> G G' \<equiv>
\<lambda>m c. \<forall>s. G (st s) \<and> (s \<in> G') \<and> \<not> snd (m (st s)) \<longrightarrow>
((\<forall>t. \<Gamma> \<turnstile> \<langle>c, Normal s\<rangle> \<Rightarrow> t \<longrightarrow>
(case t of
Normal s' \<Rightarrow> (Inr (), st s') \<in> fst (m (st s))
| Abrupt s' \<Rightarrow> (Inl (), st s') \<in> fst (m (st s))
| _ \<Rightarrow> False))
\<and> (check_term \<longrightarrow> \<Gamma> \<turnstile> c \<down> Normal s))"
lemma ccorresE_cong:
"\<lbrakk> \<And>s. P s = P' s;
\<And>s. (s \<in> Q) = (s \<in> Q');
\<And>s. P' s \<Longrightarrow> f s = f' s;
\<And>s x. s \<in> Q' \<Longrightarrow> \<Gamma>\<turnstile> \<langle>g, Normal s\<rangle> \<Rightarrow> x = \<Gamma>\<turnstile> \<langle>g', Normal s\<rangle> \<Rightarrow> x \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> P Q f g = ccorresE st ct \<Gamma> P' Q' f' g"
apply atomize
apply (clarsimp simp: ccorresE_def split: xstate.splits)
apply (rule iffI)
apply clarsimp
apply clarsimp
done
lemma ccorresE_guard_imp:
"\<lbrakk> ccorresE st ct \<Gamma> Q Q' A B; \<And>s. P s \<Longrightarrow> Q s; \<And>t. t \<in> P' \<Longrightarrow> t \<in> Q' \<rbrakk> \<Longrightarrow> ccorresE st ct \<Gamma> P P' A B"
apply atomize
apply (clarsimp simp: ccorresE_def split: xstate.splits)
done
lemma ccorresE_guard_imp_stronger:
"\<lbrakk> ccorresE st ct \<Gamma> Q Q' A B;
\<And>s. \<lbrakk> P (st s); s \<in> P' \<rbrakk> \<Longrightarrow> Q (st s);
\<And>s. \<lbrakk> P (st s); s \<in> P' \<rbrakk> \<Longrightarrow> s \<in> Q' \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> P P' A B"
apply atomize
apply (clarsimp simp: ccorresE_def split_def split: xstate.splits)
done
lemma ccorresE_assume_pre:
"\<lbrakk> \<And>s. \<lbrakk> G (st s); s \<in> G' \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> (G and (\<lambda>s'. s' = st s)) (G' \<inter> {t'. t' = s}) A B \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> G G' A B"
apply atomize
apply (clarsimp simp: ccorresE_def)
done
lemma ccorresE_Seq:
"\<lbrakk> ccorresE st ct \<Gamma> \<top> UNIV L L';
ccorresE st ct \<Gamma> \<top> UNIV R R' \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> \<top> UNIV (doE _ \<leftarrow> L; R odE) (L' ;; R')"
apply (clarsimp simp: ccorresE_def)
apply (rule conjI)
apply clarsimp
apply (erule exec_Normal_elim_cases)
apply (clarsimp simp: bindE_def split: xstate.splits)
apply (frule not_snd_bindI1)
apply (rotate_tac 1, erule allE, erule impE, force)
apply (monad_eq simp: split_def Bex_def Ball_def split: sum.splits)
apply (case_tac s', simp_all)[1]
subgoal by fastforce
apply (erule exec_elim_cases)
subgoal by fastforce
apply (erule exec_elim_cases)
apply clarsimp
apply auto[1]
apply clarsimp
apply (rule terminates.Seq)
apply monad_eq
apply (monad_eq simp: Bex_def split_def split: xstate.splits)
apply (metis Abrupt xstate.exhaust)
done
lemma ccorresE_Cond:
"\<lbrakk> ccorresE st ct \<Gamma> \<top> C A L';
ccorresE st ct \<Gamma> \<top> (UNIV - C) A R' \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> \<top> UNIV A (Cond C L' R')"
apply (clarsimp simp: ccorresE_def pred_neg_def)
apply (rule conjI)
apply clarsimp
apply (erule exec_Normal_elim_cases)
apply (erule_tac x=s in allE, erule impE, fastforce, fastforce)
apply (erule_tac x=s in allE, erule impE, fastforce, fastforce)
apply clarsimp
apply (case_tac "s \<in> C")
apply (rule terminates.CondTrue, assumption)
apply (erule allE, erule impE, fastforce)
apply clarsimp
apply (rule terminates.CondFalse, assumption)
apply (erule allE, erule impE, fastforce)
apply clarsimp
done
lemma ccorresE_Cond_match:
"\<lbrakk> ccorresE st ct \<Gamma> C C' L L';
ccorresE st ct \<Gamma> (not C) (UNIV - C') R R';
\<And>s. C (st s) = (s \<in> C') \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> \<top> UNIV (condition C L R) (Cond C' L' R')"
apply atomize
apply (clarsimp simp: ccorresE_def pred_neg_def condition_def)
apply (erule_tac x=s in allE)+
apply (auto elim!: exec_Normal_elim_cases intro: terminates.CondTrue terminates.CondFalse)
done
lemma ccorresE_Guard:
"\<lbrakk> ccorresE st ct \<Gamma> \<top> G X Y \<rbrakk> \<Longrightarrow> ccorresE st ct \<Gamma> \<top> G X (Guard F G Y)"
apply (clarsimp simp: ccorresE_def)
apply (rule conjI)
apply clarsimp
apply (erule exec_Normal_elim_cases, auto)[1]
apply clarsimp
apply (rule terminates.Guard, assumption)
apply force
done
lemma ccorresE_Catch:
"\<lbrakk>ccorresE st ct \<Gamma> \<top> UNIV A A'; ccorresE st ct \<Gamma> \<top> UNIV B B'\<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> \<top> UNIV (A <handle> (\<lambda>_. B)) (TRY A' CATCH B' END)"
apply (clarsimp simp: ccorresE_def)
apply (rule conjI)
apply clarsimp
apply (erule_tac x=s in allE)
apply (erule exec_Normal_elim_cases)
apply (monad_eq simp: Bex_def Ball_def split: xstate.splits)
apply metis
apply (monad_eq simp: Bex_def Ball_def split: xstate.splits)
apply fastforce
apply (monad_eq simp: Bex_def Ball_def split: xstate.splits)
apply (erule allE, erule (1) impE)
apply clarsimp
apply (erule terminates.Catch)
apply clarsimp
done
lemma ccorresE_Call:
"\<lbrakk> \<Gamma> X' = Some Z'; ccorresE st ct \<Gamma> \<top> UNIV Z Z' \<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> \<top> UNIV Z (Call X')"
apply (clarsimp simp: ccorresE_def)
apply (rule conjI)
apply clarsimp
apply (erule exec_Normal_elim_cases)
apply (clarsimp)
apply clarsimp
apply clarify
apply (erule terminates.Call)
apply (erule allE, erule (1) impE)
apply clarsimp
done
lemma ccorresE_exec_Normal:
"\<lbrakk> ccorresE st ct \<Gamma> G G' B B'; \<Gamma>\<turnstile> \<langle>B', Normal s\<rangle> \<Rightarrow> Normal t; s \<in> G'; G (st s); \<not> snd (B (st s)) \<rbrakk> \<Longrightarrow> (Inr (), st t) \<in> fst (B (st s))"
apply (clarsimp simp: ccorresE_def)
apply force
done
lemma ccorresE_exec_Abrupt:
"\<lbrakk> ccorresE st ct \<Gamma> G G' B B'; \<Gamma>\<turnstile> \<langle>B', Normal s\<rangle> \<Rightarrow> Abrupt t; s \<in> G'; G (st s); \<not> snd (B (st s)) \<rbrakk> \<Longrightarrow> (Inl (), st t) \<in> fst (B (st s))"
apply (clarsimp simp: ccorresE_def)
apply force
done
lemma ccorresE_exec_Fault:
"\<lbrakk> ccorresE st ct \<Gamma> G G' B B'; \<Gamma>\<turnstile> \<langle>B', Normal s\<rangle> \<Rightarrow> Fault f; s \<in> G'; G (st s); \<not> snd (B (st s)) \<rbrakk> \<Longrightarrow> P"
apply (clarsimp simp: ccorresE_def)
apply force
done
lemma ccorresE_exec_Stuck:
"\<lbrakk> ccorresE st ct \<Gamma> G G' B B'; \<Gamma>\<turnstile> \<langle>B', Normal s\<rangle> \<Rightarrow> Stuck; s \<in> G'; G (st s); \<not> snd (B (st s)) \<rbrakk> \<Longrightarrow> P"
apply (clarsimp simp: ccorresE_def)
apply force
done
lemma ccorresE_exec_cases [consumes 5]:
"\<lbrakk> ccorresE st ct \<Gamma> G G' B B'; \<Gamma>\<turnstile> \<langle>B', Normal s\<rangle> \<Rightarrow> s'; s \<in> G'; G (st s); \<not> snd (B (st s));
\<And>t'. \<lbrakk> s' = Normal t'; (Inr (), st t') \<in> fst (B (st s)) \<rbrakk> \<Longrightarrow> R;
\<And>t'. \<lbrakk> s' = Abrupt t'; (Inl (), st t') \<in> fst (B (st s)) \<rbrakk> \<Longrightarrow> R
\<rbrakk> \<Longrightarrow> R"
apply atomize
apply (case_tac s')
apply (drule ccorresE_exec_Normal, auto)[1]
apply (drule ccorresE_exec_Abrupt, auto)[1]
apply (drule ccorresE_exec_Fault, auto)[1]
apply (drule ccorresE_exec_Stuck, auto)[1]
done
lemma ccorresE_terminates:
"\<lbrakk> ccorresE st ct \<Gamma> \<top> UNIV B B'; \<not> snd (B (st s)); ct \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> B' \<down> Normal s"
by (clarsimp simp: ccorresE_def)
lemma exec_While_final_inv':
assumes exec: "\<Gamma>\<turnstile> \<langle>b, x\<rangle> \<Rightarrow> s'"
shows
"\<lbrakk> b = While C B; x = Normal s;
\<And>s. \<lbrakk> s \<notin> C \<rbrakk> \<Longrightarrow> I s (Normal s);
\<And>t t'. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Normal t'; I t' s' \<rbrakk> \<Longrightarrow> I t s';
\<And>t t'. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Abrupt t' \<rbrakk> \<Longrightarrow> I t (Abrupt t');
\<And>t. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Stuck \<rbrakk> \<Longrightarrow> I t Stuck;
\<And>t f. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Fault f \<rbrakk> \<Longrightarrow> I t (Fault f) \<rbrakk>
\<Longrightarrow> I s s'"
using exec
apply (induct arbitrary: s rule: exec.induct, simp_all)
apply clarsimp
apply atomize
apply clarsimp
apply (erule allE, erule (1) impE)
apply (erule exec_elim_cases, auto)
done
lemma exec_While_final_inv:
"\<lbrakk> \<Gamma>\<turnstile> \<langle>While C B, Normal s\<rangle> \<Rightarrow> s';
\<And>s. \<lbrakk> s \<notin> C \<rbrakk> \<Longrightarrow> I s (Normal s);
\<And>t t'. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Normal t'; I t' s' \<rbrakk> \<Longrightarrow> I t s';
\<And>t t'. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Abrupt t' \<rbrakk> \<Longrightarrow> I t (Abrupt t');
\<And>t. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Stuck \<rbrakk> \<Longrightarrow> I t Stuck;
\<And>t f. \<lbrakk> t \<in> C; \<Gamma>\<turnstile> \<langle>B, Normal t\<rangle> \<Rightarrow> Fault f \<rbrakk> \<Longrightarrow> I t (Fault f) \<rbrakk>
\<Longrightarrow> I s s'"
apply (erule exec_While_final_inv', (rule refl)+, simp_all)
done
lemma not_snd_loop_terminatesE:
"\<not> snd (whileLoopE C B r s) \<Longrightarrow> whileLoop_terminatesE C B r s"
by (clarsimp simp: whileLoopE_def
whileLoop_terminatesE_def whileLoop_def)
lemma ccorresE_termination':
assumes no_fail: "\<not> snd (whileLoopE CC BB r s)"
and s_match: "s = st s' \<and> CC = (\<lambda>_. C) \<and> BB = (\<lambda>_. B)"
and corres: "ccorresE st ct \<Gamma> \<top> UNIV B B'"
and cond_match: "\<And>s. C (st s) = (s \<in> C')"
and ct: "ct"
shows "\<Gamma>\<turnstile> While C' B' \<down> Normal s'"
apply (insert not_snd_loop_terminatesE[OF no_fail] s_match)
apply (insert no_fail)
apply (induct arbitrary: s' rule: whileLoop_terminatesE_induct [where C=CC and B=BB])
apply clarsimp
apply (rule terminates.WhileFalse)
apply (clarsimp simp: cond_match)
apply (clarsimp simp: s_match split_def split: sum.splits)
apply (insert corres)[1]
apply (clarsimp simp: ccorresE_def s_match)
apply (frule (1) snd_whileLoopE_first_step)
apply (erule allE, erule (1) impE)
apply (clarsimp simp: ct)
apply (rule terminates.intros)
apply (clarsimp simp: cond_match)
apply clarsimp
apply clarsimp
apply (erule allE, erule (1) impE)
apply (clarsimp split: sum.splits xstate.splits)
apply (drule (1) bspec)
apply clarsimp
apply (erule allE, erule impE, rule refl)
apply clarsimp
apply (drule (1) snd_whileLoopE_unfold)
apply simp
apply simp
done
lemma ccorresE_termination:
assumes no_fail: "\<not> snd (whileLoopE (\<lambda>_. C) (\<lambda>_. B) r s)"
and s_match: "s = st s'"
and corres: "ccorresE st ct \<Gamma> \<top> UNIV B B'"
and cond_match: "\<And>s. C (st s) = (s \<in> C')"
and ct: "ct"
shows "\<Gamma>\<turnstile> While C' B' \<down> Normal s'"
apply (auto intro: ccorresE_termination' [OF no_fail _ corres _ ct] simp: s_match cond_match)
done
lemma ccorresE_While:
assumes body_refines: "ccorresE st ct \<Gamma> \<top> UNIV B B'"
and cond_match: "\<And>s. C (st s) = (s \<in> C')"
shows "ccorresE st ct \<Gamma> G G' (whileLoopE (\<lambda>_. C) (\<lambda>_. B) ()) (While C' B')"
proof (clarsimp simp: ccorresE_def, rule conjI, clarsimp)
fix s t
assume guard_abs: "G (st s)"
assume guard_conc: "s \<in> G'"
assume no_fail: "\<not> snd (whileLoopE (\<lambda>_. C) (\<lambda>_. B) () (st s))"
assume conc_steps: "\<Gamma>\<turnstile> \<langle>While C' B', Normal s\<rangle> \<Rightarrow> t"
show "case t of
Normal s' \<Rightarrow> (Inr (), st s') \<in> fst (whileLoopE (\<lambda>_. C) (\<lambda>_. B) () (st s))
| Abrupt s' \<Rightarrow> (Inl (), st s') \<in> fst (whileLoopE (\<lambda>_. C) (\<lambda>_. B) () (st s))
| _ \<Rightarrow> False"
apply (insert no_fail, erule rev_mp)
apply (rule exec_While_final_inv [OF conc_steps])
apply clarsimp
apply (subst whileLoopE_cond_fail)
apply (force simp: cond_match)
apply (force simp: in_returnOk)
apply clarsimp
apply (insert ccorresE_exec_Normal [OF body_refines])[1]
apply clarsimp
apply atomize
apply (erule allE, erule allE, erule (1) impE)
apply (frule snd_whileLoopE_first_step, force simp: cond_match)
apply clarsimp
apply (erule impE)
apply (erule (1) snd_whileLoopE_unfold)
apply (force simp: cond_match)
apply (clarsimp split: xstate.splits)
apply (subst whileLoopE_unroll)
apply (monad_eq simp: cond_match)
apply blast
apply (subst whileLoopE_unroll)
apply (monad_eq simp: cond_match)
apply clarsimp
apply (insert ccorresE_exec_Abrupt [OF body_refines])[1]
apply clarsimp
apply atomize
apply (erule allE, erule allE, erule (1) impE)
apply (frule snd_whileLoopE_first_step, force simp: cond_match)
apply clarsimp
apply (subst whileLoopE_unroll)
apply (clarsimp simp: in_bindE in_returnOk cond_match split: condition_splits)
apply (insert ccorresE_exec_Stuck [OF body_refines])[1]
apply (rule impI)
apply (frule snd_whileLoopE_first_step)
apply (force simp: cond_match)
apply force
apply (insert ccorresE_exec_Fault [OF body_refines])[1]
apply (rule impI)
apply (frule snd_whileLoopE_first_step)
apply (force simp: cond_match)
apply force
done
next
fix s
assume guard_abs: "G (st s)"
assume guard_conc: "s \<in> G'"
assume no_fail: "\<not> snd (whileLoopE (\<lambda>_. C) (\<lambda>_. B) () (st s))"
show "ct \<longrightarrow> \<Gamma>\<turnstile>While C' B' \<down> Normal s"
apply clarify
apply (rule ccorresE_termination [OF no_fail])
apply (rule refl)
apply (rule body_refines)
apply (rule cond_match)
apply simp
done
qed
lemma ccorresE_get:
"(\<And>s. ccorresE st ct \<Gamma> (P and (\<lambda>s'. s' = s)) Q (L s) R) \<Longrightarrow> ccorresE st ct \<Gamma> P Q ((liftE get) >>=E L) R"
apply atomize
apply (clarsimp simp: liftE_def get_def bindE_def lift_def bind_def return_def)
apply (clarsimp simp: ccorresE_def)
done
lemma ccorresE_fail:
"ccorresE st ct \<Gamma> P Q fail R"
apply (clarsimp simp: ccorresE_def fail_def)
done
lemma ccorresE_DynCom:
"\<lbrakk> \<And>t. \<lbrakk> t \<in> P' \<rbrakk> \<Longrightarrow> ccorresE st ct \<Gamma> P (P' \<inter> {t'. t' = t}) A (B t) \<rbrakk> \<Longrightarrow> ccorresE st ct \<Gamma> P P' A (DynCom B)"
apply atomize
apply (clarsimp simp: ccorresE_def)
apply (rule conjI)
apply clarsimp
apply (erule exec_Normal_elim_cases)
apply (erule allE, erule(1) impE)
apply clarsimp
apply clarify
apply (rule terminates.DynCom)
apply clarsimp
done
lemma ccorresE_Catch_nothrow:
"\<lbrakk>ccorresE st ct \<Gamma> \<top> UNIV A A'; \<not> exceptions_thrown A'\<rbrakk> \<Longrightarrow>
ccorresE st ct \<Gamma> \<top> UNIV A (TRY A' CATCH B' END)"
apply (clarsimp simp: ccorresE_def)
apply (rule conjI)
apply clarsimp
apply (erule exec_Normal_elim_cases)
apply (frule exceptions_thrown_not_abrupt, simp, simp)
apply simp
apply simp
apply clarify
apply (rule terminates.Catch)
apply clarsimp
apply clarsimp
apply (drule (1) exceptions_thrown_not_abrupt)
apply simp
apply simp
done
lemma ccorresE_symb_exec_l:
"\<lbrakk> \<And>x. ccorresE st ct \<Gamma> (P' x) Q (B x) C;
\<And>s. P s \<Longrightarrow> \<lbrace> (=) s \<rbrace> A \<exists>\<lbrace> \<lambda>r' s'. (\<exists>a. r' = Inr a) \<and> s = s' \<rbrace>;
\<lbrace> P \<rbrace> A \<lbrace> P' \<rbrace>,\<lbrace> \<lambda>_ _. False \<rbrace> \<rbrakk>
\<Longrightarrow> ccorresE st ct \<Gamma> P Q (A >>=E B) C"
apply atomize
apply (clarsimp simp: ccorresE_def validE_def valid_def exs_valid_def)
apply (erule allE, erule impE, assumption)+
apply (clarsimp)
apply (drule (1) bspec)
apply clarsimp
apply (monad_eq simp: Bex_def Ball_def split: xstate.splits)
by fastforce
lemma ccorresE_no_fail_term:
" \<lbrakk> ccorresE st ct \<Gamma> G G' A B; no_fail G A; s \<in> G'; G (st s); ct \<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> B \<down> Normal s"
apply (clarsimp simp: ccorresE_def no_fail_def)
done
end