src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML
changeset 47962 137883567114
parent 47946 33afcfad3f8d
child 47976 6b13451135a9
equal deleted inserted replaced
47958:c5f7be4a1734 47962:137883567114
    28      strict: bool,
    28      strict: bool,
    29      lam_trans: string option,
    29      lam_trans: string option,
    30      uncurried_aliases: bool option,
    30      uncurried_aliases: bool option,
    31      relevance_thresholds: real * real,
    31      relevance_thresholds: real * real,
    32      max_relevant: int option,
    32      max_relevant: int option,
    33      max_mono_iters: int,
    33      max_mono_iters: int option,
    34      max_new_mono_instances: int,
    34      max_new_mono_instances: int option,
    35      isar_proof: bool,
    35      isar_proof: bool,
    36      isar_shrink_factor: int,
    36      isar_shrink_factor: int,
    37      slice: bool,
    37      slice: bool,
    38      minimize: bool option,
    38      minimize: bool option,
    39      timeout: Time.time,
    39      timeout: Time.time,
    84   val extract_reconstructor :
    84   val extract_reconstructor :
    85     params -> reconstructor -> string * (string * string list) list
    85     params -> reconstructor -> string * (string * string list) list
    86   val is_reconstructor : string -> bool
    86   val is_reconstructor : string -> bool
    87   val is_atp : theory -> string -> bool
    87   val is_atp : theory -> string -> bool
    88   val is_smt_prover : Proof.context -> string -> bool
    88   val is_smt_prover : Proof.context -> string -> bool
    89   val is_ho_atp: Proof.context -> string -> bool  
    89   val is_ho_atp: Proof.context -> string -> bool
    90   val is_unit_equational_atp : Proof.context -> string -> bool
    90   val is_unit_equational_atp : Proof.context -> string -> bool
    91   val is_prover_supported : Proof.context -> string -> bool
    91   val is_prover_supported : Proof.context -> string -> bool
    92   val is_prover_installed : Proof.context -> string -> bool
    92   val is_prover_installed : Proof.context -> string -> bool
    93   val default_max_relevant_for_prover : Proof.context -> bool -> string -> int
    93   val default_max_relevant_for_prover : Proof.context -> bool -> string -> int
    94   val is_unit_equality : term -> bool
    94   val is_unit_equality : term -> bool
   293    strict: bool,
   293    strict: bool,
   294    lam_trans: string option,
   294    lam_trans: string option,
   295    uncurried_aliases: bool option,
   295    uncurried_aliases: bool option,
   296    relevance_thresholds: real * real,
   296    relevance_thresholds: real * real,
   297    max_relevant: int option,
   297    max_relevant: int option,
   298    max_mono_iters: int,
   298    max_mono_iters: int option,
   299    max_new_mono_instances: int,
   299    max_new_mono_instances: int option,
   300    isar_proof: bool,
   300    isar_proof: bool,
   301    isar_shrink_factor: int,
   301    isar_shrink_factor: int,
   302    slice: bool,
   302    slice: bool,
   303    minimize: bool option,
   303    minimize: bool option,
   304    timeout: Time.time,
   304    timeout: Time.time,
   563         else
   563         else
   564           (name, [])
   564           (name, [])
   565       | _ => (name, [])
   565       | _ => (name, [])
   566   in minimize_command override_params name end
   566   in minimize_command override_params name end
   567 
   567 
   568 fun repair_monomorph_context max_iters max_new_instances =
   568 fun repair_monomorph_context max_iters best_max_iters max_new_instances
   569   Config.put Monomorph.max_rounds max_iters
   569                              best_max_new_instances =
   570   #> Config.put Monomorph.max_new_instances max_new_instances
   570   Config.put Monomorph.max_rounds (max_iters |> the_default best_max_iters)
       
   571   #> Config.put Monomorph.max_new_instances
       
   572          (max_new_instances |> the_default best_max_new_instances)
   571   #> Config.put Monomorph.keep_partial_instances false
   573   #> Config.put Monomorph.keep_partial_instances false
   572 
   574 
   573 fun suffix_for_mode Auto_Try = "_auto_try"
   575 fun suffix_for_mode Auto_Try = "_auto_try"
   574   | suffix_for_mode Try = "_try"
   576   | suffix_for_mode Try = "_try"
   575   | suffix_for_mode Normal = ""
   577   | suffix_for_mode Normal = ""
   580    Linux appears to be the only ATP that does not honor its time limit. *)
   582    Linux appears to be the only ATP that does not honor its time limit. *)
   581 val atp_timeout_slack = seconds 1.0
   583 val atp_timeout_slack = seconds 1.0
   582 
   584 
   583 fun run_atp mode name
   585 fun run_atp mode name
   584         ({exec, required_vars, arguments, proof_delims, known_failures,
   586         ({exec, required_vars, arguments, proof_delims, known_failures,
   585           prem_kind, best_slices, ...} : atp_config)
   587           prem_kind, best_slices, best_max_mono_iters,
       
   588           best_max_new_mono_instances, ...} : atp_config)
   586         (params as {debug, verbose, overlord, type_enc, strict, lam_trans,
   589         (params as {debug, verbose, overlord, type_enc, strict, lam_trans,
   587                     uncurried_aliases, max_relevant, max_mono_iters,
   590                     uncurried_aliases, max_relevant, max_mono_iters,
   588                     max_new_mono_instances, isar_proof, isar_shrink_factor,
   591                     max_new_mono_instances, isar_proof, isar_shrink_factor,
   589                     slice, timeout, preplay_timeout, ...})
   592                     slice, timeout, preplay_timeout, ...})
   590         minimize_command
   593         minimize_command
   642             val actual_slices = get_slices slice (best_slices ctxt)
   645             val actual_slices = get_slices slice (best_slices ctxt)
   643             val num_actual_slices = length actual_slices
   646             val num_actual_slices = length actual_slices
   644             fun monomorphize_facts facts =
   647             fun monomorphize_facts facts =
   645               let
   648               let
   646                 val ctxt =
   649                 val ctxt =
   647                   ctxt |> repair_monomorph_context max_mono_iters
   650                   ctxt
   648                                                    max_new_mono_instances
   651                   |> repair_monomorph_context max_mono_iters best_max_mono_iters
       
   652                           max_new_mono_instances best_max_new_mono_instances
   649                 (* pseudo-theorem involving the same constants as the subgoal *)
   653                 (* pseudo-theorem involving the same constants as the subgoal *)
   650                 val subgoal_th =
   654                 val subgoal_th =
   651                   Logic.list_implies (hyp_ts, concl_t)
   655                   Logic.list_implies (hyp_ts, concl_t)
   652                   |> Skip_Proof.make_thm thy
   656                   |> Skip_Proof.make_thm thy
   653                 val rths =
   657                 val rths =
   921       let
   925       let
   922         val timer = Timer.startRealTimer ()
   926         val timer = Timer.startRealTimer ()
   923         val state =
   927         val state =
   924           state |> Proof.map_context
   928           state |> Proof.map_context
   925                        (repair_monomorph_context max_mono_iters
   929                        (repair_monomorph_context max_mono_iters
   926                                                  max_new_mono_instances)
   930                             default_max_mono_iters max_new_mono_instances
       
   931                             default_max_new_mono_instances)
   927         val ms = timeout |> Time.toMilliseconds
   932         val ms = timeout |> Time.toMilliseconds
   928         val slice_timeout =
   933         val slice_timeout =
   929           if slice < max_slices then
   934           if slice < max_slices then
   930             Int.min (ms,
   935             Int.min (ms,
   931                 Int.max (1000 * Config.get ctxt smt_slice_min_secs,
   936                 Int.max (1000 * Config.get ctxt smt_slice_min_secs,