src/HOL/Tools/Sledgehammer/sledgehammer_proof_methods.ML
changeset 58075 95bab16eac45
parent 58074 87a8cc594bf6
child 58092 4ae52c60603a
equal deleted inserted replaced
58074:87a8cc594bf6 58075:95bab16eac45
   101       | Algebra_Method => "algebra")
   101       | Algebra_Method => "algebra")
   102   in
   102   in
   103     maybe_paren (space_implode " " (meth_s :: ss))
   103     maybe_paren (space_implode " " (meth_s :: ss))
   104   end
   104   end
   105 
   105 
   106 val silence_methods = Try0.silence_methods false
       
   107 
       
   108 fun tac_of_proof_method ctxt (local_facts, global_facts) meth =
   106 fun tac_of_proof_method ctxt (local_facts, global_facts) meth =
   109   Method.insert_tac local_facts THEN'
   107   Method.insert_tac local_facts THEN'
   110   (case meth of
   108   (case meth of
   111     Metis_Method (type_enc_opt, lam_trans_opt) =>
   109     Metis_Method (type_enc_opt, lam_trans_opt) =>
   112     let val ctxt = Config.put Metis_Tactic.verbose false ctxt in
   110     let val ctxt = Config.put Metis_Tactic.verbose false ctxt in
   113       Metis_Tactic.metis_tac [type_enc_opt |> the_default (hd partial_type_encs)]
   111       Metis_Tactic.metis_tac [type_enc_opt |> the_default (hd partial_type_encs)]
   114         (lam_trans_opt |> the_default default_metis_lam_trans) ctxt global_facts
   112         (lam_trans_opt |> the_default default_metis_lam_trans) ctxt global_facts
   115     end
   113     end
   116   | Meson_Method => Meson_Tactic.meson_general_tac (silence_methods ctxt) global_facts
   114   | Meson_Method => Meson_Tactic.meson_general_tac ctxt global_facts
   117   | SMT_Method =>
   115   | SMT_Method => SMT_Solver.smt_tac ctxt global_facts
   118     let val ctxt = Config.put SMT_Config.verbose false ctxt in
   116   | Simp_Method => Simplifier.asm_full_simp_tac (ctxt addsimps global_facts)
   119       SMT_Solver.smt_tac ctxt global_facts
       
   120     end
       
   121   | Simp_Method => Simplifier.asm_full_simp_tac (silence_methods ctxt addsimps global_facts)
       
   122   | Simp_Size_Method =>
   117   | Simp_Size_Method =>
   123     Simplifier.asm_full_simp_tac
   118     Simplifier.asm_full_simp_tac (ctxt addsimps (@{thm size_ne_size_imp_ne} :: global_facts))
   124       (silence_methods ctxt addsimps (@{thm size_ne_size_imp_ne} :: global_facts))
       
   125   | _ =>
   119   | _ =>
   126     Method.insert_tac global_facts THEN'
   120     Method.insert_tac global_facts THEN'
   127     (case meth of
   121     (case meth of
   128       SATx_Method => SAT.satx_tac ctxt
   122       SATx_Method => SAT.satx_tac ctxt
   129     | Blast_Method => blast_tac ctxt
   123     | Blast_Method => blast_tac ctxt
   130     | Auto_Method => SELECT_GOAL (Clasimp.auto_tac (silence_methods ctxt))
   124     | Auto_Method => SELECT_GOAL (Clasimp.auto_tac ctxt)
   131     | Force_Method => Clasimp.force_tac (silence_methods ctxt)
   125     | Force_Method => Clasimp.force_tac ctxt
   132     | Skolemize_method => skolem_tac (silence_methods ctxt)
   126     | Skolem_Method => skolem_tac ctxt
   133     | Linarith_Method =>
   127     | Linarith_Method =>
   134       let val ctxt = Config.put Lin_Arith.verbose false ctxt in Lin_Arith.tac ctxt end
   128       let val ctxt = Config.put Lin_Arith.verbose false ctxt in Lin_Arith.tac ctxt end
   135     | Presburger_Method => Cooper.tac true [] [] ctxt
   129     | Presburger_Method => Cooper.tac true [] [] ctxt
   136     | Algebra_Method => Groebner.algebra_tac [] [] ctxt))
   130     | Algebra_Method => Groebner.algebra_tac [] [] ctxt))
   137 
   131 
   138 val simp_based_methods = [Simp_Method, Simp_Size_Method, Auto_Method, Force_Method, Skolem_Method]
   132 val simp_based_methods = [Simp_Method, Simp_Size_Method, Auto_Method, Force_Method, Skolem_Method]
   139 
   133 
   140 fun thms_influence_proof_method ctxt meth ths =
   134 fun thms_influence_proof_method ctxt meth ths =
   141   not (member (op =) simp_based_methods meth) orelse
   135   not (member (op =) simp_based_methods meth) orelse
   142   let val ctxt' = silence_methods ctxt in
   136   (* unfortunate pointer comparison -- but it's always safe to consider a theorem useful *)
   143     (* unfortunate pointer comparison -- but it's always safe to consider a theorem useful *)
   137   not (pointer_eq (ctxt addsimps ths, ctxt))
   144     not (pointer_eq (ctxt' addsimps ths, ctxt'))
       
   145   end
       
   146 
   138 
   147 fun string_of_play_outcome (Played time) = string_of_ext_time (false, time)
   139 fun string_of_play_outcome (Played time) = string_of_ext_time (false, time)
   148   | string_of_play_outcome (Play_Timed_Out time) =
   140   | string_of_play_outcome (Play_Timed_Out time) =
   149     if time = Time.zeroTime then "" else string_of_ext_time (true, time) ^ ", timed out"
   141     if time = Time.zeroTime then "" else string_of_ext_time (true, time) ^ ", timed out"
   150   | string_of_play_outcome Play_Failed = "failed"
   142   | string_of_play_outcome Play_Failed = "failed"