src/HOL/Library/refute.ML
changeset 62519 a564458f94db
parent 61770 a20048c78891
child 67399 eab6ce8368fa
equal deleted inserted replaced
62518:b8efcc9edd7b 62519:a564458f94db
  1029           else ()
  1029           else ()
  1030         fun find_model_loop universe =
  1030         fun find_model_loop universe =
  1031           let
  1031           let
  1032             val msecs_spent = Time.toMilliseconds (Timer.checkRealTimer timer)
  1032             val msecs_spent = Time.toMilliseconds (Timer.checkRealTimer timer)
  1033             val _ = maxtime = 0 orelse msecs_spent < 1000 * maxtime
  1033             val _ = maxtime = 0 orelse msecs_spent < 1000 * maxtime
  1034                     orelse raise TimeLimit.TimeOut
  1034                     orelse raise Timeout.TIMEOUT (Time.fromMilliseconds msecs_spent)
  1035             val init_model = (universe, [])
  1035             val init_model = (universe, [])
  1036             val init_args  = {maxvars = maxvars, def_eq = false, next_idx = 1,
  1036             val init_args  = {maxvars = maxvars, def_eq = false, next_idx = 1,
  1037               bounds = [], wellformed = True}
  1037               bounds = [], wellformed = True}
  1038             val _ = tracing ("Translating term (sizes: "
  1038             val _ = tracing ("Translating term (sizes: "
  1039               ^ commas (map (fn (_, n) => string_of_int n) universe) ^ ") ...")
  1039               ^ commas (map (fn (_, n) => string_of_int n) universe) ^ ") ...")
  1113     (* enter loop with or without time limit *)
  1113     (* enter loop with or without time limit *)
  1114     writeln ("Trying to find a model that "
  1114     writeln ("Trying to find a model that "
  1115       ^ (if negate then "refutes" else "satisfies") ^ ": "
  1115       ^ (if negate then "refutes" else "satisfies") ^ ": "
  1116       ^ Syntax.string_of_term ctxt t);
  1116       ^ Syntax.string_of_term ctxt t);
  1117     if maxtime > 0 then (
  1117     if maxtime > 0 then (
  1118       TimeLimit.timeLimit (Time.fromSeconds maxtime)
  1118       Timeout.apply (Time.fromSeconds maxtime)
  1119         wrapper ()
  1119         wrapper ()
  1120       handle TimeLimit.TimeOut =>
  1120       handle Timeout.TIMEOUT _ =>
  1121         (writeln ("Search terminated, time limit (" ^
  1121         (writeln ("Search terminated, time limit (" ^
  1122             string_of_int maxtime
  1122             string_of_int maxtime
  1123             ^ (if maxtime=1 then " second" else " seconds") ^ ") exceeded.");
  1123             ^ (if maxtime=1 then " second" else " seconds") ^ ") exceeded.");
  1124          check_expect "unknown")
  1124          check_expect "unknown")
  1125     ) else wrapper ()
  1125     ) else wrapper ()