equal
deleted
inserted
replaced
117 | Normal s' \<Rightarrow> if check G s' then Normal (exec (G, s')) else TypeError" |
117 | Normal s' \<Rightarrow> if check G s' then Normal (exec (G, s')) else TypeError" |
118 |
118 |
119 |
119 |
120 definition |
120 definition |
121 exec_all_d :: "jvm_prog \<Rightarrow> jvm_state type_error \<Rightarrow> jvm_state type_error \<Rightarrow> bool" |
121 exec_all_d :: "jvm_prog \<Rightarrow> jvm_state type_error \<Rightarrow> jvm_state type_error \<Rightarrow> bool" |
122 ("_ |- _ -jvmd-> _" [61,61,61]60) where |
122 ("_ \<turnstile> _ \<midarrow>jvmd\<rightarrow> _" [61,61,61]60) where |
123 "G |- s -jvmd-> t \<longleftrightarrow> |
123 "G \<turnstile> s \<midarrow>jvmd\<rightarrow> t \<longleftrightarrow> |
124 (s,t) \<in> ({(s,t). exec_d G s = TypeError \<and> t = TypeError} \<union> |
124 (s,t) \<in> ({(s,t). exec_d G s = TypeError \<and> t = TypeError} \<union> |
125 {(s,t). \<exists>t'. exec_d G s = Normal (Some t') \<and> t = Normal t'})\<^sup>*" |
125 {(s,t). \<exists>t'. exec_d G s = Normal (Some t') \<and> t = Normal t'})\<^sup>*" |
126 |
|
127 notation (xsymbols) |
|
128 exec_all_d ("_ \<turnstile> _ -jvmd\<rightarrow> _" [61,61,61]60) |
|
129 |
126 |
130 |
127 |
131 declare split_paired_All [simp del] |
128 declare split_paired_All [simp del] |
132 declare split_paired_Ex [simp del] |
129 declare split_paired_Ex [simp del] |
133 |
130 |
144 exec_d G (Normal s) = Normal (exec (G, s))" |
141 exec_d G (Normal s) = Normal (exec (G, s))" |
145 by (unfold exec_d_def, auto) |
142 by (unfold exec_d_def, auto) |
146 |
143 |
147 |
144 |
148 lemma defensive_imp_aggressive: |
145 lemma defensive_imp_aggressive: |
149 "G \<turnstile> (Normal s) -jvmd\<rightarrow> (Normal t) \<Longrightarrow> G \<turnstile> s -jvm\<rightarrow> t" |
146 "G \<turnstile> (Normal s) \<midarrow>jvmd\<rightarrow> (Normal t) \<Longrightarrow> G \<turnstile> s \<midarrow>jvm\<rightarrow> t" |
150 proof - |
147 proof - |
151 have "\<And>x y. G \<turnstile> x -jvmd\<rightarrow> y \<Longrightarrow> \<forall>s t. x = Normal s \<longrightarrow> y = Normal t \<longrightarrow> G \<turnstile> s -jvm\<rightarrow> t" |
148 have "\<And>x y. G \<turnstile> x \<midarrow>jvmd\<rightarrow> y \<Longrightarrow> \<forall>s t. x = Normal s \<longrightarrow> y = Normal t \<longrightarrow> G \<turnstile> s \<midarrow>jvm\<rightarrow> t" |
152 apply (unfold exec_all_d_def) |
149 apply (unfold exec_all_d_def) |
153 apply (erule rtrancl_induct) |
150 apply (erule rtrancl_induct) |
154 apply (simp add: exec_all_def) |
151 apply (simp add: exec_all_def) |
155 apply (fold exec_all_d_def) |
152 apply (fold exec_all_d_def) |
156 apply simp |
153 apply simp |
161 apply (simp add: exec_all_def exec_d_def split: type_error.splits split_if_asm) |
158 apply (simp add: exec_all_def exec_d_def split: type_error.splits split_if_asm) |
162 apply (rule rtrancl_trans, assumption) |
159 apply (rule rtrancl_trans, assumption) |
163 apply blast |
160 apply blast |
164 done |
161 done |
165 moreover |
162 moreover |
166 assume "G \<turnstile> (Normal s) -jvmd\<rightarrow> (Normal t)" |
163 assume "G \<turnstile> (Normal s) \<midarrow>jvmd\<rightarrow> (Normal t)" |
167 ultimately |
164 ultimately |
168 show "G \<turnstile> s -jvm\<rightarrow> t" by blast |
165 show "G \<turnstile> s \<midarrow>jvm\<rightarrow> t" by blast |
169 qed |
166 qed |
170 |
167 |
171 end |
168 end |