src/HOL/Tools/refute.ML
changeset 33317 b4534348b8fd
parent 33246 46e47aa1558f
child 33339 d41f77196338
equal deleted inserted replaced
33316:6a72af4e84b8 33317:b4534348b8fd
   392     (* TODO: it is currently not possible to specify a size for a type    *)
   392     (* TODO: it is currently not possible to specify a size for a type    *)
   393     (*       whose name is one of the other parameters (e.g. 'maxvars')   *)
   393     (*       whose name is one of the other parameters (e.g. 'maxvars')   *)
   394     (* (string * int) list *)
   394     (* (string * int) list *)
   395     val sizes     = map_filter
   395     val sizes     = map_filter
   396       (fn (name, value) => Option.map (pair name) (Int.fromString value))
   396       (fn (name, value) => Option.map (pair name) (Int.fromString value))
   397       (List.filter (fn (name, _) => name<>"minsize" andalso name<>"maxsize"
   397       (filter (fn (name, _) => name<>"minsize" andalso name<>"maxsize"
   398         andalso name<>"maxvars" andalso name<>"maxtime"
   398         andalso name<>"maxvars" andalso name<>"maxtime"
   399         andalso name<>"satsolver") allparams)
   399         andalso name<>"satsolver") allparams)
   400   in
   400   in
   401     {sizes=sizes, minsize=minsize, maxsize=maxsize, maxvars=maxvars,
   401     {sizes=sizes, minsize=minsize, maxsize=maxsize, maxvars=maxvars,
   402       maxtime=maxtime, satsolver=satsolver, expect=expect}
   402       maxtime=maxtime, satsolver=satsolver, expect=expect}
  1068         SOME (the (make_first max (len+1) (sum+x1-1)) @ (x2+1) :: xs)
  1068         SOME (the (make_first max (len+1) (sum+x1-1)) @ (x2+1) :: xs)
  1069       else
  1069       else
  1070         (* continue search *)
  1070         (* continue search *)
  1071         next max (len+1) (sum+x1) (x2::xs)
  1071         next max (len+1) (sum+x1) (x2::xs)
  1072     (* only consider those types for which the size is not fixed *)
  1072     (* only consider those types for which the size is not fixed *)
  1073     val mutables = List.filter
  1073     val mutables = filter_out (AList.defined (op =) sizes o string_of_typ o fst) xs
  1074       (not o (AList.defined (op =) sizes) o string_of_typ o fst) xs
       
  1075     (* subtract 'minsize' from every size (will be added again at the end) *)
  1074     (* subtract 'minsize' from every size (will be added again at the end) *)
  1076     val diffs = map (fn (_, n) => n-minsize) mutables
  1075     val diffs = map (fn (_, n) => n-minsize) mutables
  1077   in
  1076   in
  1078     case next (maxsize-minsize) 0 0 diffs of
  1077     case next (maxsize-minsize) 0 0 diffs of
  1079       SOME diffs' =>
  1078       SOME diffs' =>
  2550                         val (c, args) = get_cargs idx elem
  2549                         val (c, args) = get_cargs idx elem
  2551                         (* find the indices of the constructor's /recursive/ *)
  2550                         (* find the indices of the constructor's /recursive/ *)
  2552                         (* arguments                                         *)
  2551                         (* arguments                                         *)
  2553                         val (_, _, constrs) = the (AList.lookup (op =) descr idx)
  2552                         val (_, _, constrs) = the (AList.lookup (op =) descr idx)
  2554                         val (_, dtyps)      = List.nth (constrs, c)
  2553                         val (_, dtyps)      = List.nth (constrs, c)
  2555                         val rec_dtyps_args  = List.filter
  2554                         val rec_dtyps_args  = filter
  2556                           (DatatypeAux.is_rec_type o fst) (dtyps ~~ args)
  2555                           (DatatypeAux.is_rec_type o fst) (dtyps ~~ args)
  2557                         (* map those indices to interpretations *)
  2556                         (* map those indices to interpretations *)
  2558                         val rec_dtyps_intrs = map (fn (dtyp, arg) =>
  2557                         val rec_dtyps_intrs = map (fn (dtyp, arg) =>
  2559                           let
  2558                           let
  2560                             val dT     = typ_of_dtyp descr typ_assoc dtyp
  2559                             val dT     = typ_of_dtyp descr typ_assoc dtyp