src/HOL/MicroJava/BV/StepMono.thy
changeset 10812 ead84e90bfeb
parent 10649 fb27b5547765
child 10897 697fab84709e
equal deleted inserted replaced
10811:98f52cb93d93 10812:ead84e90bfeb
    18   (\<exists>t. b!n = OK t \<and> (G \<turnstile> (b!n) <=o (y!n)))" (is "?P b")
    18   (\<exists>t. b!n = OK t \<and> (G \<turnstile> (b!n) <=o (y!n)))" (is "?P b")
    19 proof (induct (open) ?P b)
    19 proof (induct (open) ?P b)
    20   show "?P []" by simp
    20   show "?P []" by simp
    21 
    21 
    22   case Cons
    22   case Cons
    23   show "?P (a#list)"
    23   show "?P (a#list)" 
    24   proof (clarsimp simp add: list_all2_Cons1 sup_loc_def)
    24   proof (clarsimp simp add: list_all2_Cons1 sup_loc_def Listn.le_def lesub_def)
    25     fix z zs n
    25     fix z zs n
    26     assume * : 
    26     assume * : 
    27       "G \<turnstile> a <=o z" "list_all2 (sup_ty_opt G) list zs" 
    27       "G \<turnstile> a <=o z" "list_all2 (sup_ty_opt G) list zs" 
    28       "n < Suc (length zs)" "(z # zs) ! n = OK t"
    28       "n < Suc (length list)" "(z # zs) ! n = OK t"
    29 
    29 
    30     show "(\<exists>t. (a # list) ! n = OK t) \<and> G \<turnstile>(a # list) ! n <=o OK t" 
    30     show "(\<exists>t. (a # list) ! n = OK t) \<and> G \<turnstile>(a # list) ! n <=o OK t" 
    31     proof (cases n) 
    31     proof (cases n) 
    32       case 0
    32       case 0
    33       with * show ?thesis by (simp add: sup_ty_opt_OK)
    33       with * show ?thesis by (simp add: sup_ty_opt_OK)
    34     next
    34     next
    35       case Suc
    35       case Suc
    36       with Cons *
    36       with Cons *
    37       show ?thesis by (simp add: sup_loc_def)
    37       show ?thesis by (simp add: sup_loc_def Listn.le_def lesub_def) 
    38     qed
    38     qed
    39   qed
    39   qed 
    40 qed
    40 qed
    41    
    41    
    42 
    42 
    43 lemma all_widen_is_sup_loc:
    43 lemma all_widen_is_sup_loc:
    44 "\<forall>b. length a = length b --> 
    44 "\<forall>b. length a = length b --> 
   114       thus ?thesis by blast
   114       thus ?thesis by blast
   115     qed
   115     qed
   116   qed
   116   qed
   117 qed
   117 qed
   118 
   118 
       
   119 lemmas [iff] = not_Err_eq
   119 
   120 
   120 lemma app_mono: 
   121 lemma app_mono: 
   121 "[|G \<turnstile> s <=' s'; app i G m rT s'|] ==> app i G m rT s"
   122 "[|G \<turnstile> s <=' s'; app i G m rT s'|] ==> app i G m rT s"
   122 proof -
   123 proof -
   123 
   124 
   124   { fix s1 s2
   125   { fix s1 s2
   125     assume G:   "G \<turnstile> s2 <=s s1"
   126     assume G:   "G \<turnstile> s2 <=s s1"
   126     assume app: "app i G m rT (Some s1)"
   127     assume app: "app i G m rT (Some s1)"
   127 
   128 
   128     (*
       
   129     from G
       
   130     have l: "length (fst s2) = length (fst s1)"
       
   131       by simp
       
   132       *)
       
   133 
       
   134     have "app i G m rT (Some s2)"
   129     have "app i G m rT (Some s2)"
   135     proof (cases (open) i)
   130     proof (cases (open) i)
   136       case Load
   131       case Load
   137     
   132     
   138       from G Load app
   133       from G Load app
   139       have "G \<turnstile> snd s2 <=l snd s1" by (auto simp add: sup_state_def)
   134       have "G \<turnstile> snd s2 <=l snd s1" by (auto simp add: sup_state_conv)
   140       
   135       
   141       with G Load app 
   136       with G Load app 
   142       show ?thesis by clarsimp (drule sup_loc_some, simp+)
   137       show ?thesis 
       
   138         by clarsimp (drule sup_loc_some, simp+)
   143     next
   139     next
   144       case Store
   140       case Store
   145       with G app
   141       with G app
   146       show ?thesis
   142       show ?thesis
   147         by - (cases s2, auto simp add: map_eq_Cons sup_loc_Cons2 
   143         by - (cases s2, auto simp add: map_eq_Cons sup_loc_Cons2 
   148                                        sup_loc_length sup_state_def)
   144                                        sup_loc_length sup_state_conv)
   149     next
   145     next
   150       case Bipush
   146       case Bipush
   151       with G app
   147       with G app
   152       show ?thesis by simp 
   148       show ?thesis by simp 
   153     next
   149     next
   281       have C': "G \<turnstile> X' \<preceq> Class cname"
   277       have C': "G \<turnstile> X' \<preceq> Class cname"
   282         by - (rule widen_trans, auto)
   278         by - (rule widen_trans, auto)
   283     
   279     
   284       from G'
   280       from G'
   285       have "G \<turnstile> map OK apTs' <=l map OK apTs"
   281       have "G \<turnstile> map OK apTs' <=l map OK apTs"
   286         by (simp add: sup_state_def)
   282         by (simp add: sup_state_conv)
   287       also
   283       also
   288       from l w
   284       from l w
   289       have "G \<turnstile> map OK apTs <=l map OK list" 
   285       have "G \<turnstile> map OK apTs <=l map OK list" 
   290         by (simp add: all_widen_is_sup_loc)
   286         by (simp add: all_widen_is_sup_loc)
   291       finally
   287       finally
   343     from Load s app2
   339     from Load s app2
   344     obtain y' where
   340     obtain y' where
   345        y': "nat < length b2" "b2 ! nat = OK y'" by clarsimp
   341        y': "nat < length b2" "b2 ! nat = OK y'" by clarsimp
   346 
   342 
   347     from G s 
   343     from G s 
   348     have "G \<turnstile> b1 <=l b2" by (simp add: sup_state_def)
   344     have "G \<turnstile> b1 <=l b2" by (simp add: sup_state_conv)
   349 
   345 
   350     with y y'
   346     with y y'
   351     have "G \<turnstile> y \<preceq> y'" 
   347     have "G \<turnstile> y \<preceq> y'" 
   352       by - (drule sup_loc_some, simp+)
   348       by - (drule sup_loc_some, simp+)
   353     
   349     
   354     with Load G y y' s step app1 app2 
   350     with Load G y y' s step app1 app2 
   355     show ?thesis by (clarsimp simp add: sup_state_def)
   351     show ?thesis by (clarsimp simp add: sup_state_conv)
   356   next
   352   next
   357     case Store
   353     case Store
   358     with G s step app1 app2
   354     with G s step app1 app2
   359     show ?thesis
   355     show ?thesis
   360       by (clarsimp simp add: sup_state_def sup_loc_update)
   356       by (clarsimp simp add: sup_state_conv sup_loc_update)
   361   next
   357   next
   362     case Bipush
   358     case Bipush
   363     with G s step app1 app2
   359     with G s step app1 app2
   364     show ?thesis
   360     show ?thesis
   365       by (clarsimp simp add: sup_state_Cons1)
   361       by (clarsimp simp add: sup_state_Cons1)
   419 
   415 
   420     have "G \<turnstile> (ST, b1') <=s (ST', b2')" by simp
   416     have "G \<turnstile> (ST, b1') <=s (ST', b2')" by simp
   421 
   417 
   422     with Invoke G s step app1 app2 s1 s2 l l'
   418     with Invoke G s step app1 app2 s1 s2 l l'
   423     show ?thesis 
   419     show ?thesis 
   424       by (clarsimp simp add: sup_state_def)
   420       by (clarsimp simp add: sup_state_conv)
   425   next
   421   next
   426     case Return 
   422     case Return 
   427     with G step
   423     with G step
   428     show ?thesis
   424     show ?thesis
   429       by simp
   425       by simp
   476   "[| app i G m rT s2; G \<turnstile> s1 <=' s2 |] ==>
   472   "[| app i G m rT s2; G \<turnstile> s1 <=' s2 |] ==>
   477   G \<turnstile> step i G s1 <=' step i G s2"
   473   G \<turnstile> step i G s1 <=' step i G s2"
   478   by (cases s1, cases s2, auto dest: step_mono_Some)
   474   by (cases s1, cases s2, auto dest: step_mono_Some)
   479 
   475 
   480 lemmas [simp del] = step_def
   476 lemmas [simp del] = step_def
       
   477 lemmas [iff del] = not_Err_eq
   481 
   478 
   482 end
   479 end
   483 
   480