src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML
changeset 45514 973bb7846505
parent 45512 a6cce8032fff
child 45519 cd6e78cb6ee8
equal deleted inserted replaced
45513:25388cf06437 45514:973bb7846505
    24      overlord: bool,
    24      overlord: bool,
    25      blocking: bool,
    25      blocking: bool,
    26      provers: string list,
    26      provers: string list,
    27      type_enc: string option,
    27      type_enc: string option,
    28      sound: bool,
    28      sound: bool,
       
    29      lam_trans: string,
    29      relevance_thresholds: real * real,
    30      relevance_thresholds: real * real,
    30      max_relevant: int option,
    31      max_relevant: int option,
    31      max_mono_iters: int,
    32      max_mono_iters: int,
    32      max_new_mono_instances: int,
    33      max_new_mono_instances: int,
    33      isar_proof: bool,
    34      isar_proof: bool,
    60   type prover =
    61   type prover =
    61     params -> (string -> minimize_command) -> prover_problem -> prover_result
    62     params -> (string -> minimize_command) -> prover_problem -> prover_result
    62 
    63 
    63   val dest_dir : string Config.T
    64   val dest_dir : string Config.T
    64   val problem_prefix : string Config.T
    65   val problem_prefix : string Config.T
    65   val atp_lambda_trans : string Config.T
       
    66   val atp_full_names : bool Config.T
    66   val atp_full_names : bool Config.T
    67   val smt_triggers : bool Config.T
    67   val smt_triggers : bool Config.T
    68   val smt_weights : bool Config.T
    68   val smt_weights : bool Config.T
    69   val smt_weight_min_facts : int Config.T
    69   val smt_weight_min_facts : int Config.T
    70   val smt_min_weight : int Config.T
    70   val smt_min_weight : int Config.T
   295    overlord: bool,
   295    overlord: bool,
   296    blocking: bool,
   296    blocking: bool,
   297    provers: string list,
   297    provers: string list,
   298    type_enc: string option,
   298    type_enc: string option,
   299    sound: bool,
   299    sound: bool,
       
   300    lam_trans: string,
   300    relevance_thresholds: real * real,
   301    relevance_thresholds: real * real,
   301    max_relevant: int option,
   302    max_relevant: int option,
   302    max_mono_iters: int,
   303    max_mono_iters: int,
   303    max_new_mono_instances: int,
   304    max_new_mono_instances: int,
   304    isar_proof: bool,
   305    isar_proof: bool,
   337 val dest_dir =
   338 val dest_dir =
   338   Attrib.setup_config_string @{binding sledgehammer_dest_dir} (K "")
   339   Attrib.setup_config_string @{binding sledgehammer_dest_dir} (K "")
   339 val problem_prefix =
   340 val problem_prefix =
   340   Attrib.setup_config_string @{binding sledgehammer_problem_prefix} (K "prob")
   341   Attrib.setup_config_string @{binding sledgehammer_problem_prefix} (K "prob")
   341 
   342 
   342 val atp_lambda_trans =
       
   343   Attrib.setup_config_string @{binding sledgehammer_atp_lambda_trans} (K smartN)
       
   344 (* In addition to being easier to read, readable names are often much shorter,
   343 (* In addition to being easier to read, readable names are often much shorter,
   345    especially if types are mangled in names. This makes a difference for some
   344    especially if types are mangled in names. This makes a difference for some
   346    provers (e.g., E). For these reason, short names are enabled by default. *)
   345    provers (e.g., E). For these reason, short names are enabled by default. *)
   347 val atp_full_names =
   346 val atp_full_names =
   348   Attrib.setup_config_bool @{binding sledgehammer_atp_full_names} (K false)
   347   Attrib.setup_config_bool @{binding sledgehammer_atp_full_names} (K false)
   410     val {context = ctxt, facts, goal} = Proof.goal state
   409     val {context = ctxt, facts, goal} = Proof.goal state
   411     val full_tac = Method.insert_tac facts i THEN tac ctxt i
   410     val full_tac = Method.insert_tac facts i THEN tac ctxt i
   412   in TimeLimit.timeLimit timeout (try (Seq.pull o full_tac)) goal end
   411   in TimeLimit.timeLimit timeout (try (Seq.pull o full_tac)) goal end
   413 
   412 
   414 fun tac_for_reconstructor Metis =
   413 fun tac_for_reconstructor Metis =
   415     Metis_Tactic.metis_tac [Metis_Tactic.partial_type_enc]
   414     Metis_Tactic.metis_tac [Metis_Tactic.partial_type_enc] combinatorsN
   416   | tac_for_reconstructor Metis_Full_Types =
   415   | tac_for_reconstructor Metis_Full_Types =
   417     Metis_Tactic.metis_tac Metis_Tactic.full_type_syss
   416     Metis_Tactic.metis_tac Metis_Tactic.full_type_syss combinatorsN
   418   | tac_for_reconstructor Metis_No_Types =
   417   | tac_for_reconstructor Metis_No_Types =
   419     Metis_Tactic.metis_tac [Metis_Tactic.no_type_enc]
   418     Metis_Tactic.metis_tac [Metis_Tactic.no_type_enc] combinatorsN
   420   | tac_for_reconstructor SMT = SMT_Solver.smt_tac
   419   | tac_for_reconstructor SMT = SMT_Solver.smt_tac
   421 
   420 
   422 fun timed_reconstructor reconstructor debug timeout ths =
   421 fun timed_reconstructor reconstructor debug timeout ths =
   423   (Config.put Metis_Tactic.verbose debug
   422   (Config.put Metis_Tactic.verbose debug
   424    #> (fn ctxt => tac_for_reconstructor reconstructor ctxt ths))
   423    #> (fn ctxt => tac_for_reconstructor reconstructor ctxt ths))
   559 val atp_timeout_slack = seconds 1.0
   558 val atp_timeout_slack = seconds 1.0
   560 
   559 
   561 fun run_atp mode name
   560 fun run_atp mode name
   562         ({exec, required_execs, arguments, proof_delims, known_failures,
   561         ({exec, required_execs, arguments, proof_delims, known_failures,
   563           conj_sym_kind, prem_kind, best_slices, ...} : atp_config)
   562           conj_sym_kind, prem_kind, best_slices, ...} : atp_config)
   564         ({debug, verbose, overlord, type_enc, sound, max_relevant,
   563         ({debug, verbose, overlord, type_enc, sound, lam_trans, max_relevant,
   565           max_mono_iters, max_new_mono_instances, isar_proof,
   564           max_mono_iters, max_new_mono_instances, isar_proof,
   566           isar_shrink_factor, slicing, timeout, preplay_timeout, ...} : params)
   565           isar_shrink_factor, slicing, timeout, preplay_timeout, ...} : params)
   567         minimize_command
   566         minimize_command
   568         ({state, goal, subgoal, subgoal_count, facts, ...} : prover_problem) =
   567         ({state, goal, subgoal, subgoal_count, facts, ...} : prover_problem) =
   569   let
   568   let
   668                     plural_s num_facts ^ " for " ^
   667                     plural_s num_facts ^ " for " ^
   669                     string_from_time slice_timeout ^ "..."
   668                     string_from_time slice_timeout ^ "..."
   670                     |> Output.urgent_message
   669                     |> Output.urgent_message
   671                   else
   670                   else
   672                     ()
   671                     ()
       
   672                 val readable_names = not (Config.get ctxt atp_full_names)
   673                 val (atp_problem, pool, conjecture_offset, facts_offset,
   673                 val (atp_problem, pool, conjecture_offset, facts_offset,
   674                      fact_names, typed_helpers, _, sym_tab) =
   674                      fact_names, typed_helpers, _, sym_tab) =
   675                   prepare_atp_problem ctxt format conj_sym_kind prem_kind
   675                   prepare_atp_problem ctxt format conj_sym_kind prem_kind
   676                       type_enc false (Config.get ctxt atp_lambda_trans)
   676                       type_enc false lam_trans readable_names true hyp_ts
   677                       (not (Config.get ctxt atp_full_names)) true hyp_ts concl_t
   677                       concl_t facts
   678                       facts
       
   679                 fun weights () = atp_problem_weights atp_problem
   678                 fun weights () = atp_problem_weights atp_problem
   680                 val full_proof = debug orelse isar_proof
   679                 val full_proof = debug orelse isar_proof
   681                 val core =
   680                 val core =
   682                   File.shell_path command ^ " " ^
   681                   File.shell_path command ^ " " ^
   683                   arguments ctxt full_proof extra slice_timeout weights ^ " " ^
   682                   arguments ctxt full_proof extra slice_timeout weights ^ " " ^