src/HOL/Tools/Sledgehammer/sledgehammer.ML
changeset 40561 0125cbb5d3c7
parent 40558 e75614d0a859
child 40562 bbcb7aa90afc
equal deleted inserted replaced
40560:b57f7fee72ee 40561:0125cbb5d3c7
   407   in
   407   in
   408     {outcome = outcome, message = message, used_facts = used_facts,
   408     {outcome = outcome, message = message, used_facts = used_facts,
   409      run_time_in_msecs = msecs}
   409      run_time_in_msecs = msecs}
   410   end
   410   end
   411 
   411 
   412 (* "SMT_Failure.Solver_Crashed" is a misnomer; it should really be called
   412 (* "SMT_Failure.Abnormal_Termination" carries the solver's return code.
   413    "Abnormal_Termination". Return codes 1 to 127 are application-specific,
   413    Return codes 1 to 127 are application-specific, whereas (at least on
   414    whereas (at least on Unix) 128 to 255 are reserved for signals (e.g.,
   414    Unix) 128 to 255 are reserved for signals (e.g., SIGSEGV) and other
   415    SIGSEGV) and other system codes. *)
   415    system codes. *)
   416 
   416 
   417 fun failure_from_smt_failure (SMT_Failure.Counterexample _) = Unprovable
   417 fun failure_from_smt_failure (SMT_Failure.Counterexample _) = Unprovable
   418   | failure_from_smt_failure SMT_Failure.Time_Out = TimedOut
   418   | failure_from_smt_failure SMT_Failure.Time_Out = TimedOut
   419   | failure_from_smt_failure (SMT_Failure.Solver_Crashed code) =
   419   | failure_from_smt_failure (SMT_Failure.Abnormal_Termination code) =
   420     if code >= 128 then Crashed else IncompleteUnprovable
   420     if code >= 128 then Crashed else IncompleteUnprovable
   421   | failure_from_smt_failure SMT_Failure.Out_Of_Memory = OutOfResources
   421   | failure_from_smt_failure SMT_Failure.Out_Of_Memory = OutOfResources
   422   | failure_from_smt_failure _ = UnknownError
   422   | failure_from_smt_failure _ = UnknownError
   423 
   423 
   424 val smt_max_iter = 8
   424 val smt_max_iter = 8
   467         val too_many_facts_perhaps =
   467         val too_many_facts_perhaps =
   468           case outcome of
   468           case outcome of
   469             NONE => false
   469             NONE => false
   470           | SOME (SMT_Failure.Counterexample _) => false
   470           | SOME (SMT_Failure.Counterexample _) => false
   471           | SOME SMT_Failure.Time_Out => iter_timeout <> timeout
   471           | SOME SMT_Failure.Time_Out => iter_timeout <> timeout
   472           | SOME (SMT_Failure.Solver_Crashed code) =>
   472           | SOME (SMT_Failure.Abnormal_Termination code) =>
   473             (if verbose then
   473             (if verbose then
   474                "The SMT solver invoked with " ^ string_of_int num_facts ^
   474                "The SMT solver invoked with " ^ string_of_int num_facts ^
   475                " fact" ^ plural_s num_facts ^ " terminated abnormally with \
   475                " fact" ^ plural_s num_facts ^ " terminated abnormally with \
   476                \exit code " ^ string_of_int code ^ "."
   476                \exit code " ^ string_of_int code ^ "."
   477                |> (if debug then error else warning)
   477                |> (if debug then error else warning)
   510         try_command_line (proof_banner auto)
   510         try_command_line (proof_banner auto)
   511                          (apply_on_subgoal subgoal subgoal_count ^
   511                          (apply_on_subgoal subgoal subgoal_count ^
   512                           command_call smtN (map fst used_facts)) ^
   512                           command_call smtN (map fst used_facts)) ^
   513         minimize_line minimize_command (map fst used_facts)
   513         minimize_line minimize_command (map fst used_facts)
   514       | SOME SMT_Failure.Time_Out => "Timed out."
   514       | SOME SMT_Failure.Time_Out => "Timed out."
   515       | SOME (SMT_Failure.Solver_Crashed code) =>
   515       | SOME (SMT_Failure.Abnormal_Termination code) =>
   516         "The SMT solver terminated abnormally with exit code " ^
   516         "The SMT solver terminated abnormally with exit code " ^
   517         string_of_int code ^ "."
   517         string_of_int code ^ "."
   518       | SOME (SMT_Failure.Counterexample _) => "The SMT problem is unprovable."
   518       | SOME (SMT_Failure.Counterexample _) => "The SMT problem is unprovable."
   519       | SOME failure =>
   519       | SOME failure =>
   520         SMT_Failure.string_of_failure ctxt failure
   520         SMT_Failure.string_of_failure ctxt failure