src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML
changeset 75025 f741d55a81e5
parent 75024 114eb0af123d
child 75026 b61949cba32a
equal deleted inserted replaced
75024:114eb0af123d 75025:f741d55a81e5
   101 
   101 
   102 (* Important messages are important but not so important that users want to see them each time. *)
   102 (* Important messages are important but not so important that users want to see them each time. *)
   103 val atp_important_message_keep_quotient = 25
   103 val atp_important_message_keep_quotient = 25
   104 
   104 
   105 fun run_atp mode name
   105 fun run_atp mode name
   106     ({debug, verbose, overlord, type_enc, strict, lam_trans, uncurried_aliases, max_facts,
   106     ({debug, verbose, overlord, type_enc, strict, lam_trans, uncurried_aliases, fact_filter,
   107       max_mono_iters, max_new_mono_instances, isar_proofs, compress, try0, smt_proofs, minimize,
   107       max_facts, max_mono_iters, max_new_mono_instances, isar_proofs, compress, try0, smt_proofs,
   108       slices, timeout, preplay_timeout, spy, ...} : params)
   108       minimize, slices, timeout, preplay_timeout, spy, ...} : params)
   109     ({comment, state, goal, subgoal, subgoal_count, facts, found_proof} : prover_problem) =
   109     ({comment, state, goal, subgoal, subgoal_count, factss, found_proof} : prover_problem)
       
   110     slice =
   110   let
   111   let
   111     val thy = Proof.theory_of state
   112     val thy = Proof.theory_of state
   112     val ctxt = Proof.context_of state
   113     val ctxt = Proof.context_of state
   113 
   114 
   114     val {exec, arguments, proof_delims, known_failures, prem_role, best_slices, best_max_mono_iters,
   115     val ATP_Slice ((best_max_facts, best_fact_filter), format, best_type_enc, best_lam_trans,
       
   116       best_uncurried_aliases, extra) = slice
       
   117 
       
   118     val {exec, arguments, proof_delims, known_failures, prem_role, best_max_mono_iters,
   115       best_max_new_mono_instances, ...} = get_atp thy name ()
   119       best_max_new_mono_instances, ...} = get_atp thy name ()
   116 
   120 
   117     val full_proofs = isar_proofs |> the_default (mode = Minimize)
   121     val full_proofs = isar_proofs |> the_default (mode = Minimize)
   118     val local_name = perhaps (try (unprefix remote_prefix)) name
   122     val local_name = perhaps (try (unprefix remote_prefix)) name
   119 
   123 
   156         end
   160         end
   157       | NONE => error ("The environment variable " ^ quote (List.last (fst exec)) ^ " is not set"))
   161       | NONE => error ("The environment variable " ^ quote (List.last (fst exec)) ^ " is not set"))
   158 
   162 
   159     fun run () =
   163     fun run () =
   160       let
   164       let
   161         val ((best_max_facts, _), format, best_type_enc, best_lam_trans, best_uncurried_aliases,
       
   162             extra) =
       
   163           List.last (best_slices ctxt)
       
   164 
       
   165         fun monomorphize_facts facts =
   165         fun monomorphize_facts facts =
   166           let
   166           let
   167             val ctxt =
   167             val ctxt =
   168               ctxt
   168               ctxt
   169               |> repair_monomorph_context max_mono_iters best_max_mono_iters max_new_mono_instances
   169               |> repair_monomorph_context max_mono_iters best_max_mono_iters max_new_mono_instances
   181             Monomorph.monomorph atp_schematic_consts_of ctxt rths
   181             Monomorph.monomorph atp_schematic_consts_of ctxt rths
   182             |> tl |> curry ListPair.zip (map fst facts)
   182             |> tl |> curry ListPair.zip (map fst facts)
   183             |> maps (fn (name, rths) => map (pair name o zero_var_indexes o snd) rths)
   183             |> maps (fn (name, rths) => map (pair name o zero_var_indexes o snd) rths)
   184           end
   184           end
   185 
   185 
   186         val facts = snd facts
   186         val effective_fact_filter = fact_filter |> the_default best_fact_filter
       
   187         val facts = get_facts_of_filter effective_fact_filter factss
   187         val num_facts =
   188         val num_facts =
   188           (case max_facts of
   189           (case max_facts of
   189             NONE => best_max_facts
   190             NONE => best_max_facts
   190           | SOME max_facts => max_facts)
   191           | SOME max_facts => max_facts)
   191           |> Integer.min (length facts)
   192           |> Integer.min (length facts)