493 val unix_failures = |
493 val unix_failures = |
494 [(139, Crashed)] |
494 [(139, Crashed)] |
495 val smt_failures = |
495 val smt_failures = |
496 remote_smt_failures @ z3_wrapper_failures @ z3_failures @ unix_failures |
496 remote_smt_failures @ z3_wrapper_failures @ z3_failures @ unix_failures |
497 |
497 |
498 val internal_error_prefix = "Internal error: " |
|
499 |
|
500 fun failure_from_smt_failure (SMT_Failure.Counterexample _) = Unprovable |
498 fun failure_from_smt_failure (SMT_Failure.Counterexample _) = Unprovable |
501 | failure_from_smt_failure SMT_Failure.Time_Out = TimedOut |
499 | failure_from_smt_failure SMT_Failure.Time_Out = TimedOut |
502 | failure_from_smt_failure (SMT_Failure.Abnormal_Termination code) = |
500 | failure_from_smt_failure (SMT_Failure.Abnormal_Termination code) = |
503 (case AList.lookup (op =) smt_failures code of |
501 (case AList.lookup (op =) smt_failures code of |
504 SOME failure => failure |
502 SOME failure => failure |
505 | NONE => UnknownError ("Abnormal termination with exit code " ^ |
503 | NONE => UnknownError ("Abnormal termination with exit code " ^ |
506 string_of_int code ^ ".")) |
504 string_of_int code ^ ".")) |
507 | failure_from_smt_failure SMT_Failure.Out_Of_Memory = OutOfResources |
505 | failure_from_smt_failure SMT_Failure.Out_Of_Memory = OutOfResources |
508 | failure_from_smt_failure (SMT_Failure.Other_Failure msg) = |
506 | failure_from_smt_failure (SMT_Failure.Other_Failure msg) = |
509 if String.isPrefix internal_error_prefix msg then InternalError |
507 UnknownError msg |
510 else UnknownError msg |
|
511 |
508 |
512 (* FUDGE *) |
509 (* FUDGE *) |
513 val smt_max_iters = Unsynchronized.ref 8 |
510 val smt_max_iters = Unsynchronized.ref 8 |
514 val smt_iter_fact_frac = Unsynchronized.ref 0.5 |
511 val smt_iter_fact_frac = Unsynchronized.ref 0.5 |
515 val smt_iter_time_frac = Unsynchronized.ref 0.5 |
512 val smt_iter_time_frac = Unsynchronized.ref 0.5 |
563 |> SMT_Solver.smt_filter_apply iter_timeout |
560 |> SMT_Solver.smt_filter_apply iter_timeout |
564 |> (fn {outcome, used_facts} => (outcome, used_facts)) |
561 |> (fn {outcome, used_facts} => (outcome, used_facts)) |
565 handle exn => if Exn.is_interrupt exn then |
562 handle exn => if Exn.is_interrupt exn then |
566 reraise exn |
563 reraise exn |
567 else |
564 else |
568 (internal_error_prefix ^ ML_Compiler.exn_message exn |
565 (ML_Compiler.exn_message exn |
569 |> SMT_Failure.Other_Failure |> SOME, []) |
566 |> SMT_Failure.Other_Failure |> SOME, []) |
570 val death = Timer.checkRealTimer timer |
567 val death = Timer.checkRealTimer timer |
571 val _ = |
568 val _ = |
572 if verbose andalso is_some outcome then |
569 if verbose andalso is_some outcome then |
573 "SMT outcome: " ^ SMT_Failure.string_of_failure ctxt (the outcome) |
570 "SMT outcome: " ^ SMT_Failure.string_of_failure ctxt (the outcome) |