src/HOL/Tools/Sledgehammer/sledgehammer.ML
changeset 61312 6d779a71086d
parent 61311 150aa3015c47
child 61330 20af2ad9261e
equal deleted inserted replaced
61311:150aa3015c47 61312:6d779a71086d
    57   |> fold (fn candidate =>
    57   |> fold (fn candidate =>
    58       fn accum as SOME _ => accum
    58       fn accum as SOME _ => accum
    59        | NONE => if member (op =) codes candidate then SOME candidate else NONE)
    59        | NONE => if member (op =) codes candidate then SOME candidate else NONE)
    60     ordered_outcome_codes
    60     ordered_outcome_codes
    61   |> the_default unknownN
    61   |> the_default unknownN
    62 
       
    63 fun prover_description verbose name num_facts =
       
    64   (quote name,
       
    65    if verbose then " with " ^ string_of_int num_facts ^ " fact" ^ plural_s num_facts else "")
       
    66 
    62 
    67 fun is_metis_method (Metis_Method _) = true
    63 fun is_metis_method (Metis_Method _) = true
    68   | is_metis_method _ = false
    64   | is_metis_method _ = false
    69 
    65 
    70 fun add_chained [] t = t
    66 fun add_chained [] t = t
   123   let
   119   let
   124     val ctxt = Proof.context_of state
   120     val ctxt = Proof.context_of state
   125 
   121 
   126     val hard_timeout = time_mult 3.0 timeout
   122     val hard_timeout = time_mult 3.0 timeout
   127     val _ = spying spy (fn () => (state, subgoal, name, "Launched"));
   123     val _ = spying spy (fn () => (state, subgoal, name, "Launched"));
   128     val birth_time = Time.now ()
       
   129     val death_time = Time.+ (birth_time, hard_timeout)
       
   130     val max_facts = max_facts |> the_default (default_max_facts_of_prover ctxt name)
   124     val max_facts = max_facts |> the_default (default_max_facts_of_prover ctxt name)
   131     val num_facts = length facts |> not only ? Integer.min max_facts
   125     val num_facts = length facts |> not only ? Integer.min max_facts
   132 
   126 
   133     val problem =
   127     val problem =
   134       {comment = comment, state = state, goal = goal, subgoal = subgoal,
   128       {comment = comment, state = state, goal = goal, subgoal = subgoal,
   226       let
   220       let
   227         val (outcome_code, message) = TimeLimit.timeLimit hard_timeout go ()
   221         val (outcome_code, message) = TimeLimit.timeLimit hard_timeout go ()
   228         val outcome =
   222         val outcome =
   229           if outcome_code = someN orelse mode = Normal then quote name ^ ": " ^ message () else ""
   223           if outcome_code = someN orelse mode = Normal then quote name ^ ": " ^ message () else ""
   230         val _ =
   224         val _ =
   231           if outcome <> "" andalso is_some writeln_result then
   225           if outcome <> "" andalso is_some writeln_result then the writeln_result outcome
   232             the writeln_result outcome
   226           else writeln outcome
   233           else
       
   234             outcome
       
   235             |> Async_Manager_Legacy.break_into_chunks
       
   236             |> List.app writeln
       
   237       in (outcome_code, []) end
   227       in (outcome_code, []) end
   238   end
   228   end
   239 
   229 
   240 val auto_try_max_facts_divisor = 2 (* FUDGE *)
   230 val auto_try_max_facts_divisor = 2 (* FUDGE *)
   241 
   231