src/HOL/Tools/refute.ML
changeset 22024 adf64b316f07
parent 21998 aa2764dda077
child 22055 7c81de75d2c3
equal deleted inserted replaced
22023:487b79b95a20 22024:adf64b316f07
  2227 												val _ = Array.update ((Option.valOf o AList.lookup (op =) INTRS) idx, elem, SOME result)
  2227 												val _ = Array.update ((Option.valOf o AList.lookup (op =) INTRS) idx, elem, SOME result)
  2228 											in
  2228 											in
  2229 												result
  2229 												result
  2230 											end
  2230 											end
  2231 									(* compute all entries in INTRS for the current datatype (given by 'index') *)
  2231 									(* compute all entries in INTRS for the current datatype (given by 'index') *)
  2232 									val _ = Array.modifyi (fn (i, _) => SOME (compute_array_entry index i)) ((Option.valOf o AList.lookup (op =) INTRS) index)
  2232 									(* TODO: we can use Array.modify instead once PolyML conforms to the ML standard *)
       
  2233 									(* (int * 'a -> 'a) -> 'a array -> unit *)
       
  2234 									fun modifyi f arr =
       
  2235 										let
       
  2236 											val size = Array.length arr
       
  2237 											fun modifyi_loop i =
       
  2238 												if i < size then (
       
  2239 													Array.update (arr, i, f (i, Array.sub (arr, i)));
       
  2240 													modifyi_loop (i+1)
       
  2241 												) else
       
  2242 													()
       
  2243 										in
       
  2244 											modifyi_loop 0
       
  2245 										end
       
  2246 									val _ = modifyi (fn (i, _) => SOME (compute_array_entry index i)) ((Option.valOf o AList.lookup (op =) INTRS) index)
  2233 									(* 'a Array.array -> 'a list *)
  2247 									(* 'a Array.array -> 'a list *)
  2234 									fun toList arr =
  2248 									fun toList arr =
  2235 										Array.foldr op:: [] arr
  2249 										Array.foldr op:: [] arr
  2236 								in
  2250 								in
  2237 									(* return the part of 'INTRS' that corresponds to the current datatype *)
  2251 									(* return the part of 'INTRS' that corresponds to the current datatype *)