src/HOL/Bali/State.thy
changeset 37956 ee939247b2fb
parent 35431 8758fe1fc9f8
child 40607 30d512bf47a7
equal deleted inserted replaced
37955:f87d1105e181 37956:ee939247b2fb
    36   (type) "fspec" <= (type) "vname \<times> qtname" 
    36   (type) "fspec" <= (type) "vname \<times> qtname" 
    37   (type) "vn"    <= (type) "fspec + int"
    37   (type) "vn"    <= (type) "fspec + int"
    38   (type) "obj"   <= (type) "\<lparr>tag::obj_tag, values::vn \<Rightarrow> val option\<rparr>"
    38   (type) "obj"   <= (type) "\<lparr>tag::obj_tag, values::vn \<Rightarrow> val option\<rparr>"
    39   (type) "obj"   <= (type) "\<lparr>tag::obj_tag, values::vn \<Rightarrow> val option,\<dots>::'a\<rparr>"
    39   (type) "obj"   <= (type) "\<lparr>tag::obj_tag, values::vn \<Rightarrow> val option,\<dots>::'a\<rparr>"
    40 
    40 
    41 definition the_Arr :: "obj option \<Rightarrow> ty \<times> int \<times> (vn, val) table" where
    41 definition
    42  "the_Arr obj \<equiv> SOME (T,k,t). obj = Some \<lparr>tag=Arr T k,values=t\<rparr>"
    42   the_Arr :: "obj option \<Rightarrow> ty \<times> int \<times> (vn, val) table"
       
    43   where "the_Arr obj = (SOME (T,k,t). obj = Some \<lparr>tag=Arr T k,values=t\<rparr>)"
    43 
    44 
    44 lemma the_Arr_Arr [simp]: "the_Arr (Some \<lparr>tag=Arr T k,values=cs\<rparr>) = (T,k,cs)"
    45 lemma the_Arr_Arr [simp]: "the_Arr (Some \<lparr>tag=Arr T k,values=cs\<rparr>) = (T,k,cs)"
    45 apply (auto simp: the_Arr_def)
    46 apply (auto simp: the_Arr_def)
    46 done
    47 done
    47 
    48 
    48 lemma the_Arr_Arr1 [simp,intro,dest]:
    49 lemma the_Arr_Arr1 [simp,intro,dest]:
    49  "\<lbrakk>tag obj = Arr T k\<rbrakk> \<Longrightarrow> the_Arr (Some obj) = (T,k,values obj)"
    50  "\<lbrakk>tag obj = Arr T k\<rbrakk> \<Longrightarrow> the_Arr (Some obj) = (T,k,values obj)"
    50 apply (auto simp add: the_Arr_def)
    51 apply (auto simp add: the_Arr_def)
    51 done
    52 done
    52 
    53 
    53 definition upd_obj :: "vn \<Rightarrow> val \<Rightarrow> obj \<Rightarrow> obj" where 
    54 definition
    54  "upd_obj n v \<equiv> \<lambda> obj . obj \<lparr>values:=(values obj)(n\<mapsto>v)\<rparr>"
    55   upd_obj :: "vn \<Rightarrow> val \<Rightarrow> obj \<Rightarrow> obj"
       
    56   where "upd_obj n v = (\<lambda>obj. obj \<lparr>values:=(values obj)(n\<mapsto>v)\<rparr>)"
    55 
    57 
    56 lemma upd_obj_def2 [simp]: 
    58 lemma upd_obj_def2 [simp]: 
    57   "upd_obj n v obj = obj \<lparr>values:=(values obj)(n\<mapsto>v)\<rparr>" 
    59   "upd_obj n v obj = obj \<lparr>values:=(values obj)(n\<mapsto>v)\<rparr>" 
    58 apply (auto simp: upd_obj_def)
    60 apply (auto simp: upd_obj_def)
    59 done
    61 done
    60 
    62 
    61 definition obj_ty :: "obj \<Rightarrow> ty" where
    63 definition
    62  "obj_ty obj    \<equiv> case tag obj of 
    64   obj_ty :: "obj \<Rightarrow> ty" where
    63                     CInst C \<Rightarrow> Class C 
    65   "obj_ty obj = (case tag obj of 
    64                   | Arr T k \<Rightarrow> T.[]"
    66                   CInst C \<Rightarrow> Class C 
       
    67                 | Arr T k \<Rightarrow> T.[])"
    65 
    68 
    66 lemma obj_ty_eq [intro!]: "obj_ty \<lparr>tag=oi,values=x\<rparr> = obj_ty \<lparr>tag=oi,values=y\<rparr>" 
    69 lemma obj_ty_eq [intro!]: "obj_ty \<lparr>tag=oi,values=x\<rparr> = obj_ty \<lparr>tag=oi,values=y\<rparr>" 
    67 by (simp add: obj_ty_def)
    70 by (simp add: obj_ty_def)
    68 
    71 
    69 
    72 
    95  "G\<turnstile>obj_ty obj\<preceq>RefT t \<Longrightarrow> (\<exists>C. tag obj = CInst C) \<or> (\<exists>T k. tag obj = Arr T k)"
    98  "G\<turnstile>obj_ty obj\<preceq>RefT t \<Longrightarrow> (\<exists>C. tag obj = CInst C) \<or> (\<exists>T k. tag obj = Arr T k)"
    96 apply (unfold obj_ty_def)
    99 apply (unfold obj_ty_def)
    97 apply (auto split add: obj_tag.split_asm)
   100 apply (auto split add: obj_tag.split_asm)
    98 done
   101 done
    99 
   102 
   100 definition obj_class :: "obj \<Rightarrow> qtname" where
   103 definition
   101  "obj_class obj \<equiv> case tag obj of 
   104   obj_class :: "obj \<Rightarrow> qtname" where
   102                     CInst C \<Rightarrow> C 
   105   "obj_class obj = (case tag obj of 
   103                   | Arr T k \<Rightarrow> Object"
   106                      CInst C \<Rightarrow> C 
       
   107                    | Arr T k \<Rightarrow> Object)"
   104 
   108 
   105 
   109 
   106 lemma obj_class_CInst [simp]: "obj_class \<lparr>tag=CInst C,values=vs\<rparr> = C" 
   110 lemma obj_class_CInst [simp]: "obj_class \<lparr>tag=CInst C,values=vs\<rparr> = C" 
   107 by (auto simp: obj_class_def)
   111 by (auto simp: obj_class_def)
   108 
   112 
   134 translations
   138 translations
   135   "Heap" => "CONST Inl"
   139   "Heap" => "CONST Inl"
   136   "Stat" => "CONST Inr"
   140   "Stat" => "CONST Inr"
   137   (type) "oref" <= (type) "loc + qtname"
   141   (type) "oref" <= (type) "loc + qtname"
   138 
   142 
   139 definition fields_table :: "prog \<Rightarrow> qtname \<Rightarrow> (fspec \<Rightarrow> field \<Rightarrow> bool)  \<Rightarrow> (fspec, ty) table" where
   143 definition
   140  "fields_table G C P 
   144   fields_table :: "prog \<Rightarrow> qtname \<Rightarrow> (fspec \<Rightarrow> field \<Rightarrow> bool)  \<Rightarrow> (fspec, ty) table" where
   141     \<equiv> Option.map type \<circ> table_of (filter (split P) (DeclConcepts.fields G C))"
   145   "fields_table G C P =
       
   146     Option.map type \<circ> table_of (filter (split P) (DeclConcepts.fields G C))"
   142 
   147 
   143 lemma fields_table_SomeI: 
   148 lemma fields_table_SomeI: 
   144 "\<lbrakk>table_of (DeclConcepts.fields G C) n = Some f; P n f\<rbrakk> 
   149 "\<lbrakk>table_of (DeclConcepts.fields G C) n = Some f; P n f\<rbrakk> 
   145  \<Longrightarrow> fields_table G C P n = Some (type f)"
   150  \<Longrightarrow> fields_table G C P n = Some (type f)"
   146 apply (unfold fields_table_def)
   151 apply (unfold fields_table_def)
   171 apply (erule table_of_filter_unique_SomeD)
   176 apply (erule table_of_filter_unique_SomeD)
   172 apply assumption
   177 apply assumption
   173 apply simp
   178 apply simp
   174 done
   179 done
   175 
   180 
   176 definition in_bounds :: "int \<Rightarrow> int \<Rightarrow> bool" ("(_/ in'_bounds _)" [50, 51] 50) where
   181 definition
   177  "i in_bounds k \<equiv> 0 \<le> i \<and> i < k"
   182   in_bounds :: "int \<Rightarrow> int \<Rightarrow> bool" ("(_/ in'_bounds _)" [50, 51] 50)
   178 
   183   where "i in_bounds k = (0 \<le> i \<and> i < k)"
   179 definition arr_comps :: "'a \<Rightarrow> int \<Rightarrow> int \<Rightarrow> 'a option" where
   184 
   180  "arr_comps T k \<equiv> \<lambda>i. if i in_bounds k then Some T else None"
   185 definition
       
   186   arr_comps :: "'a \<Rightarrow> int \<Rightarrow> int \<Rightarrow> 'a option"
       
   187   where "arr_comps T k = (\<lambda>i. if i in_bounds k then Some T else None)"
   181   
   188   
   182 definition var_tys       :: "prog \<Rightarrow> obj_tag \<Rightarrow> oref \<Rightarrow> (vn, ty) table" where
   189 definition
   183 "var_tys G oi r 
   190   var_tys :: "prog \<Rightarrow> obj_tag \<Rightarrow> oref \<Rightarrow> (vn, ty) table" where
   184   \<equiv> case r of 
   191   "var_tys G oi r =
       
   192     (case r of 
   185       Heap a \<Rightarrow> (case oi of 
   193       Heap a \<Rightarrow> (case oi of 
   186                    CInst C \<Rightarrow> fields_table G C (\<lambda>n f. \<not>static f) (+) empty
   194                    CInst C \<Rightarrow> fields_table G C (\<lambda>n f. \<not>static f) (+) empty
   187                  | Arr T k \<Rightarrow> empty (+) arr_comps T k)
   195                  | Arr T k \<Rightarrow> empty (+) arr_comps T k)
   188     | Stat C \<Rightarrow> fields_table G C (\<lambda>fn f. declclassf fn = C \<and> static f) 
   196     | Stat C \<Rightarrow> fields_table G C (\<lambda>fn f. declclassf fn = C \<and> static f) 
   189                 (+) empty"
   197                 (+) empty)"
   190 
   198 
   191 lemma var_tys_Some_eq: 
   199 lemma var_tys_Some_eq: 
   192  "var_tys G oi r n = Some T 
   200  "var_tys G oi r n = Some T 
   193   = (case r of 
   201   = (case r of 
   194        Inl a \<Rightarrow> (case oi of  
   202        Inl a \<Rightarrow> (case oi of  
   220 datatype st = (* pure state, i.e. contents of all variables *)
   228 datatype st = (* pure state, i.e. contents of all variables *)
   221          st globs locals
   229          st globs locals
   222 
   230 
   223 subsection "access"
   231 subsection "access"
   224 
   232 
   225 definition globs :: "st \<Rightarrow> globs" where
   233 definition
   226  "globs  \<equiv> st_case (\<lambda>g l. g)"
   234   globs :: "st \<Rightarrow> globs"
       
   235   where "globs = st_case (\<lambda>g l. g)"
   227   
   236   
   228 definition locals :: "st \<Rightarrow> locals" where
   237 definition
   229  "locals \<equiv> st_case (\<lambda>g l. l)"
   238   locals :: "st \<Rightarrow> locals"
   230 
   239   where "locals = st_case (\<lambda>g l. l)"
   231 definition heap   :: "st \<Rightarrow> heap" where
   240 
   232  "heap s \<equiv> globs s \<circ> Heap"
   241 definition heap :: "st \<Rightarrow> heap" where
       
   242  "heap s = globs s \<circ> Heap"
   233 
   243 
   234 
   244 
   235 lemma globs_def2 [simp]: " globs (st g l) = g"
   245 lemma globs_def2 [simp]: " globs (st g l) = g"
   236 by (simp add: globs_def)
   246 by (simp add: globs_def)
   237 
   247 
   248 abbreviation lookup_obj :: "st \<Rightarrow> val \<Rightarrow> obj"
   258 abbreviation lookup_obj :: "st \<Rightarrow> val \<Rightarrow> obj"
   249   where "lookup_obj s a' == the (heap s (the_Addr a'))"
   259   where "lookup_obj s a' == the (heap s (the_Addr a'))"
   250 
   260 
   251 subsection "memory allocation"
   261 subsection "memory allocation"
   252 
   262 
   253 definition new_Addr :: "heap \<Rightarrow> loc option" where
   263 definition
   254  "new_Addr h   \<equiv> if (\<forall>a. h a \<noteq> None) then None else Some (SOME a. h a = None)"
   264   new_Addr :: "heap \<Rightarrow> loc option" where
       
   265   "new_Addr h = (if (\<forall>a. h a \<noteq> None) then None else Some (SOME a. h a = None))"
   255 
   266 
   256 lemma new_AddrD: "new_Addr h = Some a \<Longrightarrow> h a = None"
   267 lemma new_AddrD: "new_Addr h = Some a \<Longrightarrow> h a = None"
   257 apply (auto simp add: new_Addr_def)
   268 apply (auto simp add: new_Addr_def)
   258 apply (erule someI) 
   269 apply (erule someI) 
   259 done
   270 done
   288 apply auto
   299 apply auto
   289 done
   300 done
   290 
   301 
   291 subsection "update"
   302 subsection "update"
   292 
   303 
   293 definition gupd :: "oref  \<Rightarrow> obj \<Rightarrow> st \<Rightarrow> st" ("gupd'(_\<mapsto>_')"[10,10]1000) where
   304 definition
   294  "gupd r obj  \<equiv> st_case (\<lambda>g l. st (g(r\<mapsto>obj)) l)"
   305   gupd :: "oref  \<Rightarrow> obj \<Rightarrow> st \<Rightarrow> st" ("gupd'(_\<mapsto>_')" [10, 10] 1000)
   295 
   306   where "gupd r obj = st_case (\<lambda>g l. st (g(r\<mapsto>obj)) l)"
   296 definition lupd       :: "lname \<Rightarrow> val \<Rightarrow> st \<Rightarrow> st" ("lupd'(_\<mapsto>_')"[10,10]1000) where
   307 
   297  "lupd vn v   \<equiv> st_case (\<lambda>g l. st g (l(vn\<mapsto>v)))"
   308 definition
   298 
   309   lupd :: "lname \<Rightarrow> val \<Rightarrow> st \<Rightarrow> st" ("lupd'(_\<mapsto>_')" [10, 10] 1000)
   299 definition upd_gobj   :: "oref \<Rightarrow> vn \<Rightarrow> val \<Rightarrow> st \<Rightarrow> st" where
   310   where "lupd vn v = st_case (\<lambda>g l. st g (l(vn\<mapsto>v)))"
   300  "upd_gobj r n v \<equiv> st_case (\<lambda>g l. st (chg_map (upd_obj n v) r g) l)"
   311 
   301 
   312 definition
   302 definition set_locals  :: "locals \<Rightarrow> st \<Rightarrow> st" where
   313   upd_gobj :: "oref \<Rightarrow> vn \<Rightarrow> val \<Rightarrow> st \<Rightarrow> st"
   303  "set_locals l \<equiv> st_case (\<lambda>g l'. st g l)"
   314   where "upd_gobj r n v = st_case (\<lambda>g l. st (chg_map (upd_obj n v) r g) l)"
   304 
   315 
   305 definition init_obj    :: "prog \<Rightarrow> obj_tag \<Rightarrow> oref \<Rightarrow> st \<Rightarrow> st" where
   316 definition
   306  "init_obj G oi r \<equiv> gupd(r\<mapsto>\<lparr>tag=oi, values=init_vals (var_tys G oi r)\<rparr>)"
   317   set_locals  :: "locals \<Rightarrow> st \<Rightarrow> st"
       
   318   where "set_locals l = st_case (\<lambda>g l'. st g l)"
       
   319 
       
   320 definition
       
   321   init_obj :: "prog \<Rightarrow> obj_tag \<Rightarrow> oref \<Rightarrow> st \<Rightarrow> st"
       
   322   where "init_obj G oi r = gupd(r\<mapsto>\<lparr>tag=oi, values=init_vals (var_tys G oi r)\<rparr>)"
   307 
   323 
   308 abbreviation
   324 abbreviation
   309   init_class_obj :: "prog \<Rightarrow> qtname \<Rightarrow> st \<Rightarrow> st"
   325   init_class_obj :: "prog \<Rightarrow> qtname \<Rightarrow> st \<Rightarrow> st"
   310   where "init_class_obj G C == init_obj G undefined (Inr C)"
   326   where "init_class_obj G C == init_obj G undefined (Inr C)"
   311 
   327 
   445 
   461 
   446 section "abrupt completion"
   462 section "abrupt completion"
   447 
   463 
   448 
   464 
   449 
   465 
   450 consts
   466 primrec the_Xcpt :: "abrupt \<Rightarrow> xcpt"
   451 
   467   where "the_Xcpt (Xcpt x) = x"
   452   the_Xcpt :: "abrupt \<Rightarrow> xcpt"
   468 
   453   the_Jump :: "abrupt => jump"
   469 primrec the_Jump :: "abrupt => jump"
   454   the_Loc  :: "xcpt \<Rightarrow> loc"
   470   where "the_Jump (Jump j) = j"
   455   the_Std  :: "xcpt \<Rightarrow> xname"
   471 
   456 
   472 primrec the_Loc :: "xcpt \<Rightarrow> loc"
   457 primrec "the_Xcpt (Xcpt x) = x"
   473   where "the_Loc (Loc a) = a"
   458 primrec "the_Jump (Jump j) = j"
   474 
   459 primrec "the_Loc (Loc a) = a"
   475 primrec the_Std :: "xcpt \<Rightarrow> xname"
   460 primrec "the_Std (Std x) = x"
   476   where "the_Std (Std x) = x"
   461 
       
   462 
       
   463         
   477         
   464 
   478 
   465 definition abrupt_if :: "bool \<Rightarrow> abopt \<Rightarrow> abopt \<Rightarrow> abopt" where
   479 definition
   466  "abrupt_if c x' x \<equiv> if c \<and> (x = None) then x' else x"
   480   abrupt_if :: "bool \<Rightarrow> abopt \<Rightarrow> abopt \<Rightarrow> abopt"
       
   481   where "abrupt_if c x' x = (if c \<and> (x = None) then x' else x)"
   467 
   482 
   468 lemma abrupt_if_True_None [simp]: "abrupt_if True x None = x"
   483 lemma abrupt_if_True_None [simp]: "abrupt_if True x None = x"
   469 by (simp add: abrupt_if_def)
   484 by (simp add: abrupt_if_def)
   470 
   485 
   471 lemma abrupt_if_True_not_None [simp]: "x \<noteq> None \<Longrightarrow> abrupt_if True x y \<noteq> None"
   486 lemma abrupt_if_True_not_None [simp]: "x \<noteq> None \<Longrightarrow> abrupt_if True x y \<noteq> None"
   540 apply (simp add: abrupt_if_def)
   555 apply (simp add: abrupt_if_def)
   541 apply (simp add: abrupt_if_def)
   556 apply (simp add: abrupt_if_def)
   542 apply auto
   557 apply auto
   543 done
   558 done
   544 
   559 
   545 definition absorb :: "jump \<Rightarrow> abopt \<Rightarrow> abopt" where
   560 definition
   546   "absorb j a \<equiv> if a=Some (Jump j) then None else a"
   561   absorb :: "jump \<Rightarrow> abopt \<Rightarrow> abopt"
       
   562   where "absorb j a = (if a=Some (Jump j) then None else a)"
   547 
   563 
   548 lemma absorb_SomeD [dest!]: "absorb j a = Some x \<Longrightarrow> a = Some x"
   564 lemma absorb_SomeD [dest!]: "absorb j a = Some x \<Longrightarrow> a = Some x"
   549 by (auto simp add: absorb_def)
   565 by (auto simp add: absorb_def)
   550 
   566 
   551 lemma absorb_same [simp]: "absorb j (Some (Jump j)) = None"
   567 lemma absorb_same [simp]: "absorb j (Some (Jump j)) = None"
   591 lemma state_not_single: "All (op = (x::state)) \<Longrightarrow> R"
   607 lemma state_not_single: "All (op = (x::state)) \<Longrightarrow> R"
   592 apply (drule_tac x = "(if abrupt x = None then Some ?x else None,?y)" in spec)
   608 apply (drule_tac x = "(if abrupt x = None then Some ?x else None,?y)" in spec)
   593 apply clarsimp
   609 apply clarsimp
   594 done
   610 done
   595 
   611 
   596 definition normal :: "state \<Rightarrow> bool" where
   612 definition
   597  "normal \<equiv> \<lambda>s. abrupt s = None"
   613   normal :: "state \<Rightarrow> bool"
       
   614   where "normal = (\<lambda>s. abrupt s = None)"
   598 
   615 
   599 lemma normal_def2 [simp]: "normal s = (abrupt s = None)"
   616 lemma normal_def2 [simp]: "normal s = (abrupt s = None)"
   600 apply (unfold normal_def)
   617 apply (unfold normal_def)
   601 apply (simp (no_asm))
   618 apply (simp (no_asm))
   602 done
   619 done
   603 
   620 
   604 definition heap_free :: "nat \<Rightarrow> state \<Rightarrow> bool" where
   621 definition
   605  "heap_free n \<equiv> \<lambda>s. atleast_free (heap (store s)) n"
   622   heap_free :: "nat \<Rightarrow> state \<Rightarrow> bool"
       
   623   where "heap_free n = (\<lambda>s. atleast_free (heap (store s)) n)"
   606 
   624 
   607 lemma heap_free_def2 [simp]: "heap_free n s = atleast_free (heap (store s)) n"
   625 lemma heap_free_def2 [simp]: "heap_free n s = atleast_free (heap (store s)) n"
   608 apply (unfold heap_free_def)
   626 apply (unfold heap_free_def)
   609 apply simp
   627 apply simp
   610 done
   628 done
   611 
   629 
   612 subsection "update"
   630 subsection "update"
   613 
   631 
   614 definition abupd :: "(abopt \<Rightarrow> abopt) \<Rightarrow> state \<Rightarrow> state" where
   632 definition
   615  "abupd f \<equiv> prod_fun f id"
   633   abupd :: "(abopt \<Rightarrow> abopt) \<Rightarrow> state \<Rightarrow> state"
   616 
   634   where "abupd f = prod_fun f id"
   617 definition supd     :: "(st \<Rightarrow> st) \<Rightarrow> state \<Rightarrow> state" where
   635 
   618  "supd \<equiv> prod_fun id"
   636 definition
       
   637   supd :: "(st \<Rightarrow> st) \<Rightarrow> state \<Rightarrow> state"
       
   638   where "supd = prod_fun id"
   619   
   639   
   620 lemma abupd_def2 [simp]: "abupd f (x,s) = (f x,s)"
   640 lemma abupd_def2 [simp]: "abupd f (x,s) = (f x,s)"
   621 by (simp add: abupd_def)
   641 by (simp add: abupd_def)
   622 
   642 
   623 lemma abupd_abrupt_if_False [simp]: "\<And> s. abupd (abrupt_if False xo) s = s"
   643 lemma abupd_abrupt_if_False [simp]: "\<And> s. abupd (abrupt_if False xo) s = s"
   667 apply (simp (no_asm))
   687 apply (simp (no_asm))
   668 done
   688 done
   669 
   689 
   670 section "initialisation test"
   690 section "initialisation test"
   671 
   691 
   672 definition inited :: "qtname \<Rightarrow> globs \<Rightarrow> bool" where
   692 definition
   673  "inited C g \<equiv> g (Stat C) \<noteq> None"
   693   inited :: "qtname \<Rightarrow> globs \<Rightarrow> bool"
   674 
   694   where "inited C g = (g (Stat C) \<noteq> None)"
   675 definition initd    :: "qtname \<Rightarrow> state \<Rightarrow> bool" where
   695 
   676  "initd C \<equiv> inited C \<circ> globs \<circ> store"
   696 definition
       
   697   initd :: "qtname \<Rightarrow> state \<Rightarrow> bool"
       
   698   where "initd C = inited C \<circ> globs \<circ> store"
   677 
   699 
   678 lemma not_inited_empty [simp]: "\<not>inited C empty"
   700 lemma not_inited_empty [simp]: "\<not>inited C empty"
   679 apply (unfold inited_def)
   701 apply (unfold inited_def)
   680 apply (simp (no_asm))
   702 apply (simp (no_asm))
   681 done
   703 done
   704 apply (unfold initd_def)
   726 apply (unfold initd_def)
   705 apply (simp (no_asm))
   727 apply (simp (no_asm))
   706 done
   728 done
   707 
   729 
   708 section {* @{text error_free} *}
   730 section {* @{text error_free} *}
   709 definition error_free :: "state \<Rightarrow> bool" where
   731 
   710 "error_free s \<equiv> \<not> (\<exists> err. abrupt s = Some (Error err))"
   732 definition
       
   733   error_free :: "state \<Rightarrow> bool"
       
   734   where "error_free s = (\<not> (\<exists> err. abrupt s = Some (Error err)))"
   711 
   735 
   712 lemma error_free_Norm [simp,intro]: "error_free (Norm s)"
   736 lemma error_free_Norm [simp,intro]: "error_free (Norm s)"
   713 by (simp add: error_free_def)
   737 by (simp add: error_free_def)
   714 
   738 
   715 lemma error_free_normal [simp,intro]: "normal s \<Longrightarrow> error_free s"
   739 lemma error_free_normal [simp,intro]: "normal s \<Longrightarrow> error_free s"