src/HOL/Imperative_HOL/Array.thy
author haftmann
Thu Aug 26 10:16:22 2010 +0200 (2010-08-26)
changeset 38771 f9cd27cbe8a4
parent 37964 0a1ae22df1f1
child 38968 e55deaa22fff
permissions -rw-r--r--
code_include Scala: qualify module nmae
     1 (*  Title:      HOL/Imperative_HOL/Array.thy
     2     Author:     John Matthews, Galois Connections; Alexander Krauss, Lukas Bulwahn & Florian Haftmann, TU Muenchen
     3 *)
     4 
     5 header {* Monadic arrays *}
     6 
     7 theory Array
     8 imports Heap_Monad
     9 begin
    10 
    11 subsection {* Primitives *}
    12 
    13 definition present :: "heap \<Rightarrow> 'a\<Colon>heap array \<Rightarrow> bool" where
    14   "present h a \<longleftrightarrow> addr_of_array a < lim h"
    15 
    16 definition get :: "heap \<Rightarrow> 'a\<Colon>heap array \<Rightarrow> 'a list" where
    17   "get h a = map from_nat (arrays h (TYPEREP('a)) (addr_of_array a))"
    18 
    19 definition set :: "'a\<Colon>heap array \<Rightarrow> 'a list \<Rightarrow> heap \<Rightarrow> heap" where
    20   "set a x = arrays_update (\<lambda>h. h(TYPEREP('a) := ((h(TYPEREP('a))) (addr_of_array a:=map to_nat x))))"
    21 
    22 definition alloc :: "'a list \<Rightarrow> heap \<Rightarrow> 'a\<Colon>heap array \<times> heap" where
    23   "alloc xs h = (let
    24      l = lim h;
    25      r = Array l;
    26      h'' = set r xs (h\<lparr>lim := l + 1\<rparr>)
    27    in (r, h''))"
    28 
    29 definition length :: "heap \<Rightarrow> 'a\<Colon>heap array \<Rightarrow> nat" where
    30   "length h a = List.length (get h a)"
    31   
    32 definition update :: "'a\<Colon>heap array \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> heap \<Rightarrow> heap" where
    33   "update a i x h = set a ((get h a)[i:=x]) h"
    34 
    35 definition noteq :: "'a\<Colon>heap array \<Rightarrow> 'b\<Colon>heap array \<Rightarrow> bool" (infix "=!!=" 70) where
    36   "r =!!= s \<longleftrightarrow> TYPEREP('a) \<noteq> TYPEREP('b) \<or> addr_of_array r \<noteq> addr_of_array s"
    37 
    38 
    39 subsection {* Monad operations *}
    40 
    41 definition new :: "nat \<Rightarrow> 'a\<Colon>heap \<Rightarrow> 'a array Heap" where
    42   [code del]: "new n x = Heap_Monad.heap (alloc (replicate n x))"
    43 
    44 definition of_list :: "'a\<Colon>heap list \<Rightarrow> 'a array Heap" where
    45   [code del]: "of_list xs = Heap_Monad.heap (alloc xs)"
    46 
    47 definition make :: "nat \<Rightarrow> (nat \<Rightarrow> 'a\<Colon>heap) \<Rightarrow> 'a array Heap" where
    48   [code del]: "make n f = Heap_Monad.heap (alloc (map f [0 ..< n]))"
    49 
    50 definition len :: "'a\<Colon>heap array \<Rightarrow> nat Heap" where
    51   [code del]: "len a = Heap_Monad.tap (\<lambda>h. length h a)"
    52 
    53 definition nth :: "'a\<Colon>heap array \<Rightarrow> nat \<Rightarrow> 'a Heap" where
    54   [code del]: "nth a i = Heap_Monad.guard (\<lambda>h. i < length h a)
    55     (\<lambda>h. (get h a ! i, h))"
    56 
    57 definition upd :: "nat \<Rightarrow> 'a \<Rightarrow> 'a\<Colon>heap array \<Rightarrow> 'a\<Colon>heap array Heap" where
    58   [code del]: "upd i x a = Heap_Monad.guard (\<lambda>h. i < length h a)
    59     (\<lambda>h. (a, update a i x h))"
    60 
    61 definition map_entry :: "nat \<Rightarrow> ('a\<Colon>heap \<Rightarrow> 'a) \<Rightarrow> 'a array \<Rightarrow> 'a array Heap" where
    62   [code del]: "map_entry i f a = Heap_Monad.guard (\<lambda>h. i < length h a)
    63     (\<lambda>h. (a, update a i (f (get h a ! i)) h))"
    64 
    65 definition swap :: "nat \<Rightarrow> 'a \<Rightarrow> 'a\<Colon>heap array \<Rightarrow> 'a Heap" where
    66   [code del]: "swap i x a = Heap_Monad.guard (\<lambda>h. i < length h a)
    67     (\<lambda>h. (get h a ! i, update a i x h))"
    68 
    69 definition freeze :: "'a\<Colon>heap array \<Rightarrow> 'a list Heap" where
    70   [code del]: "freeze a = Heap_Monad.tap (\<lambda>h. get h a)"
    71 
    72 
    73 subsection {* Properties *}
    74 
    75 text {* FIXME: Does there exist a "canonical" array axiomatisation in
    76 the literature?  *}
    77 
    78 text {* Primitives *}
    79 
    80 lemma noteq_sym: "a =!!= b \<Longrightarrow> b =!!= a"
    81   and unequal [simp]: "a \<noteq> a' \<longleftrightarrow> a =!!= a'"
    82   unfolding noteq_def by auto
    83 
    84 lemma noteq_irrefl: "r =!!= r \<Longrightarrow> False"
    85   unfolding noteq_def by auto
    86 
    87 lemma present_alloc_noteq: "present h a \<Longrightarrow> a =!!= fst (alloc xs h)"
    88   by (simp add: present_def noteq_def alloc_def Let_def)
    89 
    90 lemma get_set_eq [simp]: "get (set r x h) r = x"
    91   by (simp add: get_def set_def o_def)
    92 
    93 lemma get_set_neq [simp]: "r =!!= s \<Longrightarrow> get (set s x h) r = get h r"
    94   by (simp add: noteq_def get_def set_def)
    95 
    96 lemma set_same [simp]:
    97   "set r x (set r y h) = set r x h"
    98   by (simp add: set_def)
    99 
   100 lemma set_set_swap:
   101   "r =!!= r' \<Longrightarrow> set r x (set r' x' h) = set r' x' (set r x h)"
   102   by (simp add: Let_def expand_fun_eq noteq_def set_def)
   103 
   104 lemma get_update_eq [simp]:
   105   "get (update a i v h) a = (get h a) [i := v]"
   106   by (simp add: update_def)
   107 
   108 lemma nth_update_neq [simp]:
   109   "a =!!= b \<Longrightarrow> get (update b j v h) a ! i = get h a ! i"
   110   by (simp add: update_def noteq_def)
   111 
   112 lemma get_update_elem_neqIndex [simp]:
   113   "i \<noteq> j \<Longrightarrow> get (update a j v h) a ! i = get h a ! i"
   114   by simp
   115 
   116 lemma length_update [simp]: 
   117   "length (update b i v h) = length h"
   118   by (simp add: update_def length_def set_def get_def expand_fun_eq)
   119 
   120 lemma update_swap_neq:
   121   "a =!!= a' \<Longrightarrow> 
   122   update a i v (update a' i' v' h) 
   123   = update a' i' v' (update a i v h)"
   124 apply (unfold update_def)
   125 apply simp
   126 apply (subst set_set_swap, assumption)
   127 apply (subst get_set_neq)
   128 apply (erule noteq_sym)
   129 apply simp
   130 done
   131 
   132 lemma update_swap_neqIndex:
   133   "\<lbrakk> i \<noteq> i' \<rbrakk> \<Longrightarrow> update a i v (update a i' v' h) = update a i' v' (update a i v h)"
   134   by (auto simp add: update_def set_set_swap list_update_swap)
   135 
   136 lemma get_alloc:
   137   "get (snd (alloc ls' h)) (fst (alloc ls h)) = ls'"
   138   by (simp add: Let_def split_def alloc_def)
   139 
   140 lemma set:
   141   "set (fst (alloc ls h))
   142      new_ls (snd (alloc ls h))
   143        = snd (alloc new_ls h)"
   144   by (simp add: Let_def split_def alloc_def)
   145 
   146 lemma present_update [simp]: 
   147   "present (update b i v h) = present h"
   148   by (simp add: update_def present_def set_def get_def expand_fun_eq)
   149 
   150 lemma present_alloc [simp]:
   151   "present (snd (alloc xs h)) (fst (alloc xs h))"
   152   by (simp add: present_def alloc_def set_def Let_def)
   153 
   154 lemma not_present_alloc [simp]:
   155   "\<not> present h (fst (alloc xs h))"
   156   by (simp add: present_def alloc_def Let_def)
   157 
   158 
   159 text {* Monad operations *}
   160 
   161 lemma execute_new [execute_simps]:
   162   "execute (new n x) h = Some (alloc (replicate n x) h)"
   163   by (simp add: new_def execute_simps)
   164 
   165 lemma success_newI [success_intros]:
   166   "success (new n x) h"
   167   by (auto intro: success_intros simp add: new_def)
   168 
   169 lemma crel_newI [crel_intros]:
   170   assumes "(a, h') = alloc (replicate n x) h"
   171   shows "crel (new n x) h h' a"
   172   by (rule crelI) (simp add: assms execute_simps)
   173 
   174 lemma crel_newE [crel_elims]:
   175   assumes "crel (new n x) h h' r"
   176   obtains "r = fst (alloc (replicate n x) h)" "h' = snd (alloc (replicate n x) h)" 
   177     "get h' r = replicate n x" "present h' r" "\<not> present h r"
   178   using assms by (rule crelE) (simp add: get_alloc execute_simps)
   179 
   180 lemma execute_of_list [execute_simps]:
   181   "execute (of_list xs) h = Some (alloc xs h)"
   182   by (simp add: of_list_def execute_simps)
   183 
   184 lemma success_of_listI [success_intros]:
   185   "success (of_list xs) h"
   186   by (auto intro: success_intros simp add: of_list_def)
   187 
   188 lemma crel_of_listI [crel_intros]:
   189   assumes "(a, h') = alloc xs h"
   190   shows "crel (of_list xs) h h' a"
   191   by (rule crelI) (simp add: assms execute_simps)
   192 
   193 lemma crel_of_listE [crel_elims]:
   194   assumes "crel (of_list xs) h h' r"
   195   obtains "r = fst (alloc xs h)" "h' = snd (alloc xs h)" 
   196     "get h' r = xs" "present h' r" "\<not> present h r"
   197   using assms by (rule crelE) (simp add: get_alloc execute_simps)
   198 
   199 lemma execute_make [execute_simps]:
   200   "execute (make n f) h = Some (alloc (map f [0 ..< n]) h)"
   201   by (simp add: make_def execute_simps)
   202 
   203 lemma success_makeI [success_intros]:
   204   "success (make n f) h"
   205   by (auto intro: success_intros simp add: make_def)
   206 
   207 lemma crel_makeI [crel_intros]:
   208   assumes "(a, h') = alloc (map f [0 ..< n]) h"
   209   shows "crel (make n f) h h' a"
   210   by (rule crelI) (simp add: assms execute_simps)
   211 
   212 lemma crel_makeE [crel_elims]:
   213   assumes "crel (make n f) h h' r"
   214   obtains "r = fst (alloc (map f [0 ..< n]) h)" "h' = snd (alloc (map f [0 ..< n]) h)" 
   215     "get h' r = map f [0 ..< n]" "present h' r" "\<not> present h r"
   216   using assms by (rule crelE) (simp add: get_alloc execute_simps)
   217 
   218 lemma execute_len [execute_simps]:
   219   "execute (len a) h = Some (length h a, h)"
   220   by (simp add: len_def execute_simps)
   221 
   222 lemma success_lenI [success_intros]:
   223   "success (len a) h"
   224   by (auto intro: success_intros simp add: len_def)
   225 
   226 lemma crel_lengthI [crel_intros]:
   227   assumes "h' = h" "r = length h a"
   228   shows "crel (len a) h h' r"
   229   by (rule crelI) (simp add: assms execute_simps)
   230 
   231 lemma crel_lengthE [crel_elims]:
   232   assumes "crel (len a) h h' r"
   233   obtains "r = length h' a" "h' = h" 
   234   using assms by (rule crelE) (simp add: execute_simps)
   235 
   236 lemma execute_nth [execute_simps]:
   237   "i < length h a \<Longrightarrow>
   238     execute (nth a i) h = Some (get h a ! i, h)"
   239   "i \<ge> length h a \<Longrightarrow> execute (nth a i) h = None"
   240   by (simp_all add: nth_def execute_simps)
   241 
   242 lemma success_nthI [success_intros]:
   243   "i < length h a \<Longrightarrow> success (nth a i) h"
   244   by (auto intro: success_intros simp add: nth_def)
   245 
   246 lemma crel_nthI [crel_intros]:
   247   assumes "i < length h a" "h' = h" "r = get h a ! i"
   248   shows "crel (nth a i) h h' r"
   249   by (rule crelI) (insert assms, simp add: execute_simps)
   250 
   251 lemma crel_nthE [crel_elims]:
   252   assumes "crel (nth a i) h h' r"
   253   obtains "i < length h a" "r = get h a ! i" "h' = h"
   254   using assms by (rule crelE)
   255     (erule successE, cases "i < length h a", simp_all add: execute_simps)
   256 
   257 lemma execute_upd [execute_simps]:
   258   "i < length h a \<Longrightarrow>
   259     execute (upd i x a) h = Some (a, update a i x h)"
   260   "i \<ge> length h a \<Longrightarrow> execute (upd i x a) h = None"
   261   by (simp_all add: upd_def execute_simps)
   262 
   263 lemma success_updI [success_intros]:
   264   "i < length h a \<Longrightarrow> success (upd i x a) h"
   265   by (auto intro: success_intros simp add: upd_def)
   266 
   267 lemma crel_updI [crel_intros]:
   268   assumes "i < length h a" "h' = update a i v h"
   269   shows "crel (upd i v a) h h' a"
   270   by (rule crelI) (insert assms, simp add: execute_simps)
   271 
   272 lemma crel_updE [crel_elims]:
   273   assumes "crel (upd i v a) h h' r"
   274   obtains "r = a" "h' = update a i v h" "i < length h a"
   275   using assms by (rule crelE)
   276     (erule successE, cases "i < length h a", simp_all add: execute_simps)
   277 
   278 lemma execute_map_entry [execute_simps]:
   279   "i < length h a \<Longrightarrow>
   280    execute (map_entry i f a) h =
   281       Some (a, update a i (f (get h a ! i)) h)"
   282   "i \<ge> length h a \<Longrightarrow> execute (map_entry i f a) h = None"
   283   by (simp_all add: map_entry_def execute_simps)
   284 
   285 lemma success_map_entryI [success_intros]:
   286   "i < length h a \<Longrightarrow> success (map_entry i f a) h"
   287   by (auto intro: success_intros simp add: map_entry_def)
   288 
   289 lemma crel_map_entryI [crel_intros]:
   290   assumes "i < length h a" "h' = update a i (f (get h a ! i)) h" "r = a"
   291   shows "crel (map_entry i f a) h h' r"
   292   by (rule crelI) (insert assms, simp add: execute_simps)
   293 
   294 lemma crel_map_entryE [crel_elims]:
   295   assumes "crel (map_entry i f a) h h' r"
   296   obtains "r = a" "h' = update a i (f (get h a ! i)) h" "i < length h a"
   297   using assms by (rule crelE)
   298     (erule successE, cases "i < length h a", simp_all add: execute_simps)
   299 
   300 lemma execute_swap [execute_simps]:
   301   "i < length h a \<Longrightarrow>
   302    execute (swap i x a) h =
   303       Some (get h a ! i, update a i x h)"
   304   "i \<ge> length h a \<Longrightarrow> execute (swap i x a) h = None"
   305   by (simp_all add: swap_def execute_simps)
   306 
   307 lemma success_swapI [success_intros]:
   308   "i < length h a \<Longrightarrow> success (swap i x a) h"
   309   by (auto intro: success_intros simp add: swap_def)
   310 
   311 lemma crel_swapI [crel_intros]:
   312   assumes "i < length h a" "h' = update a i x h" "r = get h a ! i"
   313   shows "crel (swap i x a) h h' r"
   314   by (rule crelI) (insert assms, simp add: execute_simps)
   315 
   316 lemma crel_swapE [crel_elims]:
   317   assumes "crel (swap i x a) h h' r"
   318   obtains "r = get h a ! i" "h' = update a i x h" "i < length h a"
   319   using assms by (rule crelE)
   320     (erule successE, cases "i < length h a", simp_all add: execute_simps)
   321 
   322 lemma execute_freeze [execute_simps]:
   323   "execute (freeze a) h = Some (get h a, h)"
   324   by (simp add: freeze_def execute_simps)
   325 
   326 lemma success_freezeI [success_intros]:
   327   "success (freeze a) h"
   328   by (auto intro: success_intros simp add: freeze_def)
   329 
   330 lemma crel_freezeI [crel_intros]:
   331   assumes "h' = h" "r = get h a"
   332   shows "crel (freeze a) h h' r"
   333   by (rule crelI) (insert assms, simp add: execute_simps)
   334 
   335 lemma crel_freezeE [crel_elims]:
   336   assumes "crel (freeze a) h h' r"
   337   obtains "h' = h" "r = get h a"
   338   using assms by (rule crelE) (simp add: execute_simps)
   339 
   340 lemma upd_return:
   341   "upd i x a \<guillemotright> return a = upd i x a"
   342   by (rule Heap_eqI) (simp add: bind_def guard_def upd_def execute_simps)
   343 
   344 lemma array_make:
   345   "new n x = make n (\<lambda>_. x)"
   346   by (rule Heap_eqI) (simp add: map_replicate_trivial execute_simps)
   347 
   348 lemma array_of_list_make [code]:
   349   "of_list xs = make (List.length xs) (\<lambda>n. xs ! n)"
   350   by (rule Heap_eqI) (simp add: map_nth execute_simps)
   351 
   352 hide_const (open) present get set alloc length update noteq new of_list make len nth upd map_entry swap freeze
   353 
   354 
   355 subsection {* Code generator setup *}
   356 
   357 subsubsection {* Logical intermediate layer *}
   358 
   359 definition new' where
   360   [code del]: "new' = Array.new o Code_Numeral.nat_of"
   361 
   362 lemma [code]:
   363   "Array.new = new' o Code_Numeral.of_nat"
   364   by (simp add: new'_def o_def)
   365 
   366 definition make' where
   367   [code del]: "make' i f = Array.make (Code_Numeral.nat_of i) (f o Code_Numeral.of_nat)"
   368 
   369 lemma [code]:
   370   "Array.make n f = make' (Code_Numeral.of_nat n) (f o Code_Numeral.nat_of)"
   371   by (simp add: make'_def o_def)
   372 
   373 definition len' where
   374   [code del]: "len' a = Array.len a \<guillemotright>= (\<lambda>n. return (Code_Numeral.of_nat n))"
   375 
   376 lemma [code]:
   377   "Array.len a = len' a \<guillemotright>= (\<lambda>i. return (Code_Numeral.nat_of i))"
   378   by (simp add: len'_def)
   379 
   380 definition nth' where
   381   [code del]: "nth' a = Array.nth a o Code_Numeral.nat_of"
   382 
   383 lemma [code]:
   384   "Array.nth a n = nth' a (Code_Numeral.of_nat n)"
   385   by (simp add: nth'_def)
   386 
   387 definition upd' where
   388   [code del]: "upd' a i x = Array.upd (Code_Numeral.nat_of i) x a \<guillemotright> return ()"
   389 
   390 lemma [code]:
   391   "Array.upd i x a = upd' a (Code_Numeral.of_nat i) x \<guillemotright> return a"
   392   by (simp add: upd'_def upd_return)
   393 
   394 lemma [code]:
   395   "Array.map_entry i f a = do {
   396      x \<leftarrow> Array.nth a i;
   397      Array.upd i (f x) a
   398    }"
   399   by (rule Heap_eqI) (simp add: bind_def guard_def map_entry_def execute_simps)
   400 
   401 lemma [code]:
   402   "Array.swap i x a = do {
   403      y \<leftarrow> Array.nth a i;
   404      Array.upd i x a;
   405      return y
   406    }"
   407   by (rule Heap_eqI) (simp add: bind_def guard_def swap_def execute_simps)
   408 
   409 lemma [code]:
   410   "Array.freeze a = do {
   411      n \<leftarrow> Array.len a;
   412      Heap_Monad.fold_map (\<lambda>i. Array.nth a i) [0..<n]
   413    }"
   414 proof (rule Heap_eqI)
   415   fix h
   416   have *: "List.map
   417      (\<lambda>x. fst (the (if x < Array.length h a
   418                     then Some (Array.get h a ! x, h) else None)))
   419      [0..<Array.length h a] =
   420        List.map (List.nth (Array.get h a)) [0..<Array.length h a]"
   421     by simp
   422   have "execute (Heap_Monad.fold_map (Array.nth a) [0..<Array.length h a]) h =
   423     Some (Array.get h a, h)"
   424     apply (subst execute_fold_map_unchanged_heap)
   425     apply (simp_all add: nth_def guard_def *)
   426     apply (simp add: length_def map_nth)
   427     done
   428   then have "execute (do {
   429       n \<leftarrow> Array.len a;
   430       Heap_Monad.fold_map (Array.nth a) [0..<n]
   431     }) h = Some (Array.get h a, h)"
   432     by (auto intro: execute_bind_eq_SomeI simp add: execute_simps)
   433   then show "execute (Array.freeze a) h = execute (do {
   434       n \<leftarrow> Array.len a;
   435       Heap_Monad.fold_map (Array.nth a) [0..<n]
   436     }) h" by (simp add: execute_simps)
   437 qed
   438 
   439 hide_const (open) new' make' len' nth' upd'
   440 
   441 
   442 text {* SML *}
   443 
   444 code_type array (SML "_/ array")
   445 code_const Array (SML "raise/ (Fail/ \"bare Array\")")
   446 code_const Array.new' (SML "(fn/ ()/ =>/ Array.array/ ((_),/ (_)))")
   447 code_const Array.of_list (SML "(fn/ ()/ =>/ Array.fromList/ _)")
   448 code_const Array.make' (SML "(fn/ ()/ =>/ Array.tabulate/ ((_),/ (_)))")
   449 code_const Array.len' (SML "(fn/ ()/ =>/ Array.length/ _)")
   450 code_const Array.nth' (SML "(fn/ ()/ =>/ Array.sub/ ((_),/ (_)))")
   451 code_const Array.upd' (SML "(fn/ ()/ =>/ Array.update/ ((_),/ (_),/ (_)))")
   452 
   453 code_reserved SML Array
   454 
   455 
   456 text {* OCaml *}
   457 
   458 code_type array (OCaml "_/ array")
   459 code_const Array (OCaml "failwith/ \"bare Array\"")
   460 code_const Array.new' (OCaml "(fun/ ()/ ->/ Array.make/ (Big'_int.int'_of'_big'_int/ _)/ _)")
   461 code_const Array.of_list (OCaml "(fun/ ()/ ->/ Array.of'_list/ _)")
   462 code_const Array.make' (OCaml "(fun/ ()/ ->/ Array.init/ (Big'_int.int'_of'_big'_int/ _)/
   463   (fun k'_ ->/ _/ (Big'_int.big'_int'_of'_int/ k'_)))")
   464 code_const Array.len' (OCaml "(fun/ ()/ ->/ Big'_int.big'_int'_of'_int/ (Array.length/ _))")
   465 code_const Array.nth' (OCaml "(fun/ ()/ ->/ Array.get/ _/ (Big'_int.int'_of'_big'_int/ _))")
   466 code_const Array.upd' (OCaml "(fun/ ()/ ->/ Array.set/ _/ (Big'_int.int'_of'_big'_int/ _)/ _)")
   467 
   468 code_reserved OCaml Array
   469 
   470 
   471 text {* Haskell *}
   472 
   473 code_type array (Haskell "Heap.STArray/ Heap.RealWorld/ _")
   474 code_const Array (Haskell "error/ \"bare Array\"")
   475 code_const Array.new' (Haskell "Heap.newArray")
   476 code_const Array.of_list (Haskell "Heap.newListArray")
   477 code_const Array.make' (Haskell "Heap.newFunArray")
   478 code_const Array.len' (Haskell "Heap.lengthArray")
   479 code_const Array.nth' (Haskell "Heap.readArray")
   480 code_const Array.upd' (Haskell "Heap.writeArray")
   481 
   482 
   483 text {* Scala *}
   484 
   485 code_type array (Scala "!collection.mutable.ArraySeq[_]")
   486 code_const Array (Scala "!error(\"bare Array\")")
   487 code_const Array.new' (Scala "('_: Unit)/ => / Heap.Array.alloc((_))((_))")
   488 code_const Array.make' (Scala "('_: Unit)/ =>/ Heap.Array.make((_))((_))")
   489 code_const Array.len' (Scala "('_: Unit)/ =>/ Heap.Array.len((_))")
   490 code_const Array.nth' (Scala "('_: Unit)/ =>/ Heap.Array.nth((_), (_))")
   491 code_const Array.upd' (Scala "('_: Unit)/ =>/ Heap.Array.upd((_), (_), (_))")
   492 code_const Array.freeze (Scala "('_: Unit)/ =>/ Heap.Array.freeze((_))")
   493 
   494 end