src/HOL/MicroJava/JVM/JVMListExample.thy
changeset 21404 eb85850d3eb7
parent 21113 5b76e541cc0a
child 22921 475ff421a6a3
equal deleted inserted replaced
21403:dd58f13a8eb4 21404:eb85850d3eb7
   122   and ty :: eq
   122   and ty :: eq
   123   and val :: eq
   123   and val :: eq
   124   and instr :: eq ..
   124   and instr :: eq ..
   125 
   125 
   126 definition
   126 definition
   127   arbitrary_val :: val
   127   arbitrary_val :: val where
   128   [symmetric, code inline]: "arbitrary_val = arbitrary"
   128   [symmetric, code inline]: "arbitrary_val = arbitrary"
   129   arbitrary_cname :: cname
   129 definition
       
   130   arbitrary_cname :: cname where
   130   [symmetric, code inline]: "arbitrary_cname = arbitrary"
   131   [symmetric, code inline]: "arbitrary_cname = arbitrary"
   131 
   132 
   132 definition
   133 definition "unit' = Unit"
   133   "unit' = Unit"
   134 definition "object' = Object"
   134   "object' = Object"
       
   135 
   135 
   136 code_axioms
   136 code_axioms
   137   arbitrary_val \<equiv> unit'
   137   arbitrary_val \<equiv> unit'
   138   arbitrary_cname \<equiv> object'
   138   arbitrary_cname \<equiv> object'
   139 
   139 
   151 axiomatization
   151 axiomatization
   152   test_loc :: "(loc_ \<Rightarrow> bool) \<Rightarrow> (loc_ \<Rightarrow> 'a) \<Rightarrow> loc_ \<Rightarrow> 'a" where
   152   test_loc :: "(loc_ \<Rightarrow> bool) \<Rightarrow> (loc_ \<Rightarrow> 'a) \<Rightarrow> loc_ \<Rightarrow> 'a" where
   153   "test_loc p v l = (if p l then v l else test_loc p v (incr l))"
   153   "test_loc p v l = (if p l then v l else test_loc p v (incr l))"
   154 
   154 
   155 definition
   155 definition
   156   new_addr' :: "(loc \<Rightarrow> (cname \<times> (vname \<times> cname \<Rightarrow> val option)) option) \<Rightarrow> loc \<times> val option"
   156   new_addr' :: "(loc \<Rightarrow> (cname \<times> (vname \<times> cname \<Rightarrow> val option)) option) \<Rightarrow> loc \<times> val option" where
   157   "new_addr' hp =
   157   "new_addr' hp =
   158     test_loc (\<lambda>i. hp (Loc i) = None) (\<lambda>i. (Loc i, None)) zero_loc"
   158     test_loc (\<lambda>i. hp (Loc i) = None) (\<lambda>i. (Loc i, None)) zero_loc"
   159 
   159 
   160 lemma [code func]:
   160 lemma [code func]:
   161   "wf_class = wf_class" ..
   161   "wf_class = wf_class" ..