165 |
165 |
166 @{text "\<dots>"} |
166 @{text "\<dots>"} |
167 |
167 |
168 @{prop [display] "P n"} |
168 @{prop [display] "P n"} |
169 *} |
169 *} |
170 constdefs |
170 definition intervall :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> bool" ("_ \<in> [_, _')") where |
171 intervall :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> bool" ("_ \<in> [_, _')") |
|
172 "x \<in> [a, b) \<equiv> a \<le> x \<and> x < b" |
171 "x \<in> [a, b) \<equiv> a \<le> x \<and> x < b" |
173 |
172 |
174 lemma pc_0: "x < n \<Longrightarrow> (x \<in> [0, n) \<Longrightarrow> P x) \<Longrightarrow> P x" |
173 lemma pc_0: "x < n \<Longrightarrow> (x \<in> [0, n) \<Longrightarrow> P x) \<Longrightarrow> P x" |
175 by (simp add: intervall_def) |
174 by (simp add: intervall_def) |
176 |
175 |
236 and @{term makelist_name} in class @{term test_name}: |
235 and @{term makelist_name} in class @{term test_name}: |
237 *} |
236 *} |
238 lemmas eff_simps [simp] = eff_def norm_eff_def xcpt_eff_def |
237 lemmas eff_simps [simp] = eff_def norm_eff_def xcpt_eff_def |
239 declare appInvoke [simp del] |
238 declare appInvoke [simp del] |
240 |
239 |
241 constdefs |
240 definition phi_append :: method_type ("\<phi>\<^sub>a") where |
242 phi_append :: method_type ("\<phi>\<^sub>a") |
|
243 "\<phi>\<^sub>a \<equiv> map (\<lambda>(x,y). Some (x, map OK y)) [ |
241 "\<phi>\<^sub>a \<equiv> map (\<lambda>(x,y). Some (x, map OK y)) [ |
244 ( [], [Class list_name, Class list_name]), |
242 ( [], [Class list_name, Class list_name]), |
245 ( [Class list_name], [Class list_name, Class list_name]), |
243 ( [Class list_name], [Class list_name, Class list_name]), |
246 ( [Class list_name], [Class list_name, Class list_name]), |
244 ( [Class list_name], [Class list_name, Class list_name]), |
247 ( [Class list_name, Class list_name], [Class list_name, Class list_name]), |
245 ( [Class list_name, Class list_name], [Class list_name, Class list_name]), |
299 abbreviation Clist :: ty |
297 abbreviation Clist :: ty |
300 where "Clist == Class list_name" |
298 where "Clist == Class list_name" |
301 abbreviation Ctest :: ty |
299 abbreviation Ctest :: ty |
302 where "Ctest == Class test_name" |
300 where "Ctest == Class test_name" |
303 |
301 |
304 constdefs |
302 definition phi_makelist :: method_type ("\<phi>\<^sub>m") where |
305 phi_makelist :: method_type ("\<phi>\<^sub>m") |
|
306 "\<phi>\<^sub>m \<equiv> map (\<lambda>(x,y). Some (x, y)) [ |
303 "\<phi>\<^sub>m \<equiv> map (\<lambda>(x,y). Some (x, y)) [ |
307 ( [], [OK Ctest, Err , Err ]), |
304 ( [], [OK Ctest, Err , Err ]), |
308 ( [Clist], [OK Ctest, Err , Err ]), |
305 ( [Clist], [OK Ctest, Err , Err ]), |
309 ( [Clist, Clist], [OK Ctest, Err , Err ]), |
306 ( [Clist, Clist], [OK Ctest, Err , Err ]), |
310 ( [Clist], [OK Clist, Err , Err ]), |
307 ( [Clist], [OK Clist, Err , Err ]), |
374 apply (simp add: app_def xcpt_app_def) |
371 apply (simp add: app_def xcpt_app_def) |
375 apply simp |
372 apply simp |
376 done |
373 done |
377 |
374 |
378 text {* The whole program is welltyped: *} |
375 text {* The whole program is welltyped: *} |
379 constdefs |
376 definition Phi :: prog_type ("\<Phi>") where |
380 Phi :: prog_type ("\<Phi>") |
|
381 "\<Phi> C sg \<equiv> if C = test_name \<and> sg = (makelist_name, []) then \<phi>\<^sub>m else |
377 "\<Phi> C sg \<equiv> if C = test_name \<and> sg = (makelist_name, []) then \<phi>\<^sub>m else |
382 if C = list_name \<and> sg = (append_name, [Class list_name]) then \<phi>\<^sub>a else []" |
378 if C = list_name \<and> sg = (append_name, [Class list_name]) then \<phi>\<^sub>a else []" |
383 |
379 |
384 lemma wf_prog: |
380 lemma wf_prog: |
385 "wt_jvm_prog E \<Phi>" |
381 "wt_jvm_prog E \<Phi>" |