src/HOL/Bali/State.thy
changeset 62390 842917225d56
parent 62042 6c6ccf573479
child 63648 f9f3006a5579
equal deleted inserted replaced
62380:29800666e526 62390:842917225d56
   499 
   499 
   500 lemma split_abrupt_if: 
   500 lemma split_abrupt_if: 
   501 "P (abrupt_if c x' x) = 
   501 "P (abrupt_if c x' x) = 
   502       ((c \<and> x = None \<longrightarrow> P x') \<and> (\<not> (c \<and> x = None) \<longrightarrow> P x))"
   502       ((c \<and> x = None \<longrightarrow> P x') \<and> (\<not> (c \<and> x = None) \<longrightarrow> P x))"
   503 apply (unfold abrupt_if_def)
   503 apply (unfold abrupt_if_def)
   504 apply (split split_if)
   504 apply (split if_split)
   505 apply auto
   505 apply auto
   506 done
   506 done
   507 
   507 
   508 abbreviation raise_if :: "bool \<Rightarrow> xname \<Rightarrow> abopt \<Rightarrow> abopt"
   508 abbreviation raise_if :: "bool \<Rightarrow> xname \<Rightarrow> abopt \<Rightarrow> abopt"
   509   where "raise_if c xn == abrupt_if c (Some (Xcpt (Std xn)))"
   509   where "raise_if c xn == abrupt_if c (Some (Xcpt (Std xn)))"
   754 
   754 
   755 lemma error_free_abupd_absorb [simp,intro]: 
   755 lemma error_free_abupd_absorb [simp,intro]: 
   756  "error_free s \<Longrightarrow> error_free (abupd (absorb j) s)"
   756  "error_free s \<Longrightarrow> error_free (abupd (absorb j) s)"
   757 by (cases s) 
   757 by (cases s) 
   758    (auto simp add: error_free_def absorb_def
   758    (auto simp add: error_free_def absorb_def
   759          split: split_if_asm)
   759          split: if_split_asm)
   760 
   760 
   761 lemma error_free_absorb [simp,intro]: 
   761 lemma error_free_absorb [simp,intro]: 
   762  "error_free (a,s) \<Longrightarrow> error_free (absorb j a, s)"
   762  "error_free (a,s) \<Longrightarrow> error_free (absorb j a, s)"
   763 by (auto simp add: error_free_def absorb_def
   763 by (auto simp add: error_free_def absorb_def
   764             split: split_if_asm)
   764             split: if_split_asm)
   765 
   765 
   766 lemma error_free_abrupt_if [simp,intro]:
   766 lemma error_free_abrupt_if [simp,intro]:
   767 "\<lbrakk>error_free s; \<not> (\<exists> err. x=Error err)\<rbrakk>
   767 "\<lbrakk>error_free s; \<not> (\<exists> err. x=Error err)\<rbrakk>
   768  \<Longrightarrow> error_free (abupd (abrupt_if p (Some x)) s)"
   768  \<Longrightarrow> error_free (abupd (abrupt_if p (Some x)) s)"
   769 by (cases s)
   769 by (cases s)
   770    (auto simp add: abrupt_if_def
   770    (auto simp add: abrupt_if_def
   771             split: split_if)
   771             split: if_split)
   772 
   772 
   773 lemma error_free_abrupt_if1 [simp,intro]:
   773 lemma error_free_abrupt_if1 [simp,intro]:
   774 "\<lbrakk>error_free (a,s); \<not> (\<exists> err. x=Error err)\<rbrakk>
   774 "\<lbrakk>error_free (a,s); \<not> (\<exists> err. x=Error err)\<rbrakk>
   775  \<Longrightarrow> error_free (abrupt_if p (Some x) a, s)"
   775  \<Longrightarrow> error_free (abrupt_if p (Some x) a, s)"
   776 by  (auto simp add: abrupt_if_def
   776 by  (auto simp add: abrupt_if_def
   777             split: split_if)
   777             split: if_split)
   778 
   778 
   779 lemma error_free_abrupt_if_Xcpt [simp,intro]:
   779 lemma error_free_abrupt_if_Xcpt [simp,intro]:
   780  "error_free s 
   780  "error_free s 
   781   \<Longrightarrow> error_free (abupd (abrupt_if p (Some (Xcpt x))) s)"
   781   \<Longrightarrow> error_free (abupd (abrupt_if p (Some (Xcpt x))) s)"
   782 by simp 
   782 by simp