equal
deleted
inserted
replaced
209 fun plazy f = Pretty.para (f ()) |
209 fun plazy f = Pretty.para (f ()) |
210 |
210 |
211 fun pick_them_nits_in_term deadline state (params : params) mode i n step |
211 fun pick_them_nits_in_term deadline state (params : params) mode i n step |
212 subst def_assm_ts nondef_assm_ts orig_t = |
212 subst def_assm_ts nondef_assm_ts orig_t = |
213 let |
213 let |
|
214 val time_start = Time.now () |
214 val timer = Timer.startRealTimer () |
215 val timer = Timer.startRealTimer () |
215 val thy = Proof.theory_of state |
216 val thy = Proof.theory_of state |
216 val ctxt = Proof.context_of state |
217 val ctxt = Proof.context_of state |
217 val keywords = Thy_Header.get_keywords thy |
218 val keywords = Thy_Header.get_keywords thy |
218 (* FIXME: reintroduce code before new release: |
219 (* FIXME: reintroduce code before new release: |
246 *) |
247 *) |
247 val print_nt = pprint_nt o K o plazy |
248 val print_nt = pprint_nt o K o plazy |
248 val print_v = pprint_v o K o plazy |
249 val print_v = pprint_v o K o plazy |
249 |
250 |
250 fun check_deadline () = |
251 fun check_deadline () = |
251 if Time.compare (Time.now (), deadline) <> LESS then |
252 let val t = Time.now () in |
252 raise TimeLimit.TimeOut |
253 if Time.compare (t, deadline) <> LESS |
253 else |
254 then raise Timeout.TIMEOUT (Time.- (t, time_start)) |
254 () |
255 else () |
|
256 end |
255 |
257 |
256 val (def_assm_ts, nondef_assm_ts) = |
258 val (def_assm_ts, nondef_assm_ts) = |
257 if assms orelse mode <> Normal then (def_assm_ts, nondef_assm_ts) |
259 if assms orelse mode <> Normal then (def_assm_ts, nondef_assm_ts) |
258 else ([], []) |
260 else ([], []) |
259 val _ = |
261 val _ = |
374 fun is_type_fundamentally_monotonic T = |
376 fun is_type_fundamentally_monotonic T = |
375 (is_data_type ctxt T andalso not (is_quot_type ctxt T) andalso |
377 (is_data_type ctxt T andalso not (is_quot_type ctxt T) andalso |
376 (not (is_pure_typedef ctxt T) orelse is_univ_typedef ctxt T)) orelse |
378 (not (is_pure_typedef ctxt T) orelse is_univ_typedef ctxt T)) orelse |
377 is_number_type ctxt T orelse is_bit_type T |
379 is_number_type ctxt T orelse is_bit_type T |
378 fun is_type_actually_monotonic T = |
380 fun is_type_actually_monotonic T = |
379 TimeLimit.timeLimit tac_timeout (formulas_monotonic hol_ctxt binarize T) |
381 Timeout.apply tac_timeout (formulas_monotonic hol_ctxt binarize T) |
380 (nondef_ts, def_ts) |
382 (nondef_ts, def_ts) |
381 handle TimeLimit.TimeOut => false |
383 handle Timeout.TIMEOUT _ => false |
382 fun is_type_kind_of_monotonic T = |
384 fun is_type_kind_of_monotonic T = |
383 case triple_lookup (type_match thy) monos T of |
385 case triple_lookup (type_match thy) monos T of |
384 SOME (SOME false) => false |
386 SOME (SOME false) => false |
385 | _ => is_type_actually_monotonic T |
387 | _ => is_type_actually_monotonic T |
386 fun is_type_monotonic T = |
388 fun is_type_monotonic T = |
804 donno) false problems |
806 donno) false problems |
805 end |
807 end |
806 end |
808 end |
807 end |
809 end |
808 | KK.TimedOut unsat_js => |
810 | KK.TimedOut unsat_js => |
809 (update_checked_problems problems unsat_js; raise TimeLimit.TimeOut) |
811 (update_checked_problems problems unsat_js; raise Timeout.TIMEOUT Time.zeroTime) |
810 | KK.Error (s, unsat_js) => |
812 | KK.Error (s, unsat_js) => |
811 (update_checked_problems problems unsat_js; |
813 (update_checked_problems problems unsat_js; |
812 print_v (K ("Kodkod error: " ^ s ^ ".")); |
814 print_v (K ("Kodkod error: " ^ s ^ ".")); |
813 (found_really_genuine, max_potential, max_genuine, donno + 1)) |
815 (found_really_genuine, max_potential, max_genuine, donno + 1)) |
814 end |
816 end |
956 |
958 |
957 val batches = chunk_list batch_size (!scopes) |
959 val batches = chunk_list batch_size (!scopes) |
958 val outcome_code = |
960 val outcome_code = |
959 run_batches 0 (length batches) batches |
961 run_batches 0 (length batches) batches |
960 (false, max_potential, max_genuine, 0) |
962 (false, max_potential, max_genuine, 0) |
961 handle TimeLimit.TimeOut => |
963 handle Timeout.TIMEOUT _ => |
962 (print_nt (fn () => excipit "ran out of time after checking"); |
964 (print_nt (fn () => excipit "ran out of time after checking"); |
963 if !met_potential > 0 then potentialN else unknownN) |
965 if !met_potential > 0 then potentialN else unknownN) |
964 val _ = print_v (fn () => |
966 val _ = print_v (fn () => |
965 "Total time: " ^ string_of_time (Timer.checkRealTimer timer) ^ |
967 "Total time: " ^ string_of_time (Timer.checkRealTimer timer) ^ |
966 ".") |
968 ".") |
984 else |
986 else |
985 let |
987 let |
986 val unknown_outcome = (unknownN, []) |
988 val unknown_outcome = (unknownN, []) |
987 val deadline = Time.+ (Time.now (), timeout) |
989 val deadline = Time.+ (Time.now (), timeout) |
988 val outcome as (outcome_code, _) = |
990 val outcome as (outcome_code, _) = |
989 TimeLimit.timeLimit (Time.+ (timeout, timeout_bonus)) |
991 Timeout.apply (Time.+ (timeout, timeout_bonus)) |
990 (pick_them_nits_in_term deadline state params mode i n step subst |
992 (pick_them_nits_in_term deadline state params mode i n step subst |
991 def_assm_ts nondef_assm_ts) orig_t |
993 def_assm_ts nondef_assm_ts) orig_t |
992 handle TOO_LARGE (_, details) => |
994 handle TOO_LARGE (_, details) => |
993 (print_t "% SZS status GaveUp"; |
995 (print_t "% SZS status GaveUp"; |
994 print_nt ("Limit reached: " ^ details ^ "."); unknown_outcome) |
996 print_nt ("Limit reached: " ^ details ^ "."); unknown_outcome) |
997 print_nt ("Limit reached: " ^ details ^ "."); unknown_outcome) |
999 print_nt ("Limit reached: " ^ details ^ "."); unknown_outcome) |
998 | Kodkod.SYNTAX (_, details) => |
1000 | Kodkod.SYNTAX (_, details) => |
999 (print_t "% SZS status GaveUp"; |
1001 (print_t "% SZS status GaveUp"; |
1000 print_nt ("Malformed Kodkodi output: " ^ details ^ "."); |
1002 print_nt ("Malformed Kodkodi output: " ^ details ^ "."); |
1001 unknown_outcome) |
1003 unknown_outcome) |
1002 | TimeLimit.TimeOut => |
1004 | Timeout.TIMEOUT _ => |
1003 (print_t "% SZS status TimedOut"; |
1005 (print_t "% SZS status TimedOut"; |
1004 print_nt "Nitpick ran out of time."; unknown_outcome) |
1006 print_nt "Nitpick ran out of time."; unknown_outcome) |
1005 in |
1007 in |
1006 if expect = "" orelse outcome_code = expect then outcome |
1008 if expect = "" orelse outcome_code = expect then outcome |
1007 else error ("Unexpected outcome: " ^ quote outcome_code ^ ".") |
1009 else error ("Unexpected outcome: " ^ quote outcome_code ^ ".") |