# HG changeset patch # User blanchet # Date 1288116578 -7200 # Node ID ce996440ff2b2959d0a8ed308a57505301fcc321 # Parent 2963511e121c576324e90da62bb103c9e13fe1d6# Parent 0dcd03b05da4e01fbe5f409d07af43cec031d8ab merge diff -r 2963511e121c -r ce996440ff2b src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML --- a/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML Tue Oct 26 17:35:54 2010 +0200 +++ b/src/HOL/Mirabelle/Tools/mirabelle_sledgehammer.ML Tue Oct 26 20:09:38 2010 +0200 @@ -316,10 +316,11 @@ fun get_prover ctxt args = let + val thy = ProofContext.theory_of ctxt fun default_prover_name () = hd (#provers (Sledgehammer_Isar.default_params ctxt [])) handle Empty => error "No ATP available." - fun get_prover name = (name, Sledgehammer.get_prover ctxt false name) + fun get_prover name = (name, Sledgehammer.get_prover thy false name) in (case AList.lookup (op =) args proverK of SOME name => get_prover name diff -r 2963511e121c -r ce996440ff2b src/HOL/Tools/Sledgehammer/sledgehammer.ML --- a/src/HOL/Tools/Sledgehammer/sledgehammer.ML Tue Oct 26 17:35:54 2010 +0200 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer.ML Tue Oct 26 20:09:38 2010 +0200 @@ -63,7 +63,7 @@ val kill_provers : unit -> unit val running_provers : unit -> unit val messages : int option -> unit - val get_prover : Proof.context -> bool -> string -> prover + val get_prover : theory -> bool -> string -> prover val run_sledgehammer : params -> bool -> int -> relevance_override -> (string -> minimize_command) -> Proof.state -> bool * Proof.state @@ -410,14 +410,13 @@ | failure_from_smt_failure (SMT_Solver.Counterexample _) = Unprovable | failure_from_smt_failure (SMT_Solver.Other_Failure _) = UnknownError -fun run_smt_solver ctxt remote ({timeout, ...} : params) minimize_command +fun run_smt_solver remote ({timeout, ...} : params) minimize_command ({state, subgoal, subgoal_count, axioms, ...} : prover_problem) = let val {outcome, used_facts, run_time_in_msecs} = SMT_Solver.smt_filter remote timeout state (map_filter (try dest_Untranslated) axioms) subgoal - val outcome' = outcome |> Option.map failure_from_smt_failure (* FIXME *) val message = case outcome of NONE => @@ -425,22 +424,18 @@ (apply_on_subgoal subgoal subgoal_count ^ command_call smtN (map fst used_facts)) ^ minimize_line minimize_command (map fst used_facts) - | SOME (failure as SMT_Solver.Other_Failure _) => - SMT_Solver.string_of_failure ctxt - (SMT_Solver.solver_name_of (Context.Proof ctxt)) failure - | SOME _ => string_for_failure (the outcome') + | SOME SMT_Solver.Time_Out => "Timed out." + | SOME (SMT_Solver.Counterexample _) => "The SMT problem is unprovable." + | SOME (failure as SMT_Solver.Other_Failure message) => message + val outcome = outcome |> Option.map failure_from_smt_failure (* FIXME *) in - {outcome = outcome', used_axioms = used_facts, - run_time_in_msecs = run_time_in_msecs, message = message} + {outcome = outcome, used_axioms = used_facts, + run_time_in_msecs = SOME run_time_in_msecs, message = message} end -fun get_prover ctxt auto name = - let val thy = ProofContext.theory_of ctxt in - if is_smt_prover name then - run_smt_solver ctxt (String.isPrefix remote_prefix name) - else - run_atp auto name (get_atp thy name) - end +fun get_prover thy auto name = + if is_smt_prover name then run_smt_solver (String.isPrefix remote_prefix name) + else run_atp auto name (get_atp thy name) fun run_prover (params as {blocking, debug, max_relevant, timeout, expect, ...}) auto minimize_command @@ -459,7 +454,7 @@ fun go () = let fun really_go () = - get_prover ctxt auto name params (minimize_command name) problem + get_prover thy auto name params (minimize_command name) problem |> (fn {outcome, message, ...} => (if is_some outcome then "none" else "some", message)) val (outcome_code, message) = @@ -508,7 +503,8 @@ let val _ = Proof.assert_backward state val thy = Proof.theory_of state - val {context = ctxt, facts = chained_ths, goal} = Proof.goal state + val ctxt = Proof.context_of state + val {facts = chained_ths, goal, ...} = Proof.goal state val (_, hyp_ts, concl_t) = strip_subgoal goal i val _ = () |> not blocking ? kill_provers val _ = if auto then () else Output.urgent_message "Sledgehammering..." diff -r 2963511e121c -r ce996440ff2b src/HOL/Tools/Sledgehammer/sledgehammer_minimize.ML --- a/src/HOL/Tools/Sledgehammer/sledgehammer_minimize.ML Tue Oct 26 17:35:54 2010 +0200 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_minimize.ML Tue Oct 26 20:09:38 2010 +0200 @@ -92,8 +92,7 @@ state axioms = let val thy = Proof.theory_of state - val ctxt = Proof.context_of state - val prover = get_prover ctxt false prover_name + val prover = get_prover thy false prover_name val msecs = Time.toMilliseconds timeout val _ = Output.urgent_message ("Sledgehammer minimize: " ^ quote prover_name ^ ".") val {goal, ...} = Proof.goal state