src/HOL/Tools/Sledgehammer/sledgehammer_proof_methods.ML
changeset 55323 253a029335a2
parent 55315 54b0352fb46d
child 55451 ea1d9408a233
equal deleted inserted replaced
55322:3bf50e3cd727 55323:253a029335a2
    11 
    11 
    12   datatype proof_method =
    12   datatype proof_method =
    13     Metis_Method of string option * string option |
    13     Metis_Method of string option * string option |
    14     Meson_Method |
    14     Meson_Method |
    15     SMT_Method |
    15     SMT_Method |
       
    16     Blast_Method |
    16     Simp_Method |
    17     Simp_Method |
    17     Simp_Size_Method |
    18     Simp_Size_Method |
    18     Auto_Method |
    19     Auto_Method |
    19     Fastforce_Method |
    20     Fastforce_Method |
    20     Force_Method |
    21     Force_Method |
    21     Arith_Method |
    22     Linarith_Method |
    22     Blast_Method |
    23     Presburger_Method |
    23     Algebra_Method
    24     Algebra_Method
    24 
    25 
    25   datatype play_outcome =
    26   datatype play_outcome =
    26     Played of Time.time |
    27     Played of Time.time |
    27     Play_Timed_Out of Time.time |
    28     Play_Timed_Out of Time.time |
    29     Not_Played
    30     Not_Played
    30 
    31 
    31   type minimize_command = string list -> string
    32   type minimize_command = string list -> string
    32   type one_line_params =
    33   type one_line_params =
    33     (proof_method * play_outcome) * string * (string * stature) list * minimize_command * int * int
    34     (proof_method * play_outcome) * string * (string * stature) list * minimize_command * int * int
    34 
       
    35   val smtN : string
       
    36 
    35 
    37   val string_of_proof_method : proof_method -> string
    36   val string_of_proof_method : proof_method -> string
    38   val tac_of_proof_method : Proof.context -> thm list * thm list -> proof_method -> int -> tactic
    37   val tac_of_proof_method : Proof.context -> thm list * thm list -> proof_method -> int -> tactic
    39   val string_of_play_outcome : play_outcome -> string
    38   val string_of_play_outcome : play_outcome -> string
    40   val play_outcome_ord : play_outcome * play_outcome -> order
    39   val play_outcome_ord : play_outcome * play_outcome -> order
    51 
    50 
    52 datatype proof_method =
    51 datatype proof_method =
    53   Metis_Method of string option * string option |
    52   Metis_Method of string option * string option |
    54   Meson_Method |
    53   Meson_Method |
    55   SMT_Method |
    54   SMT_Method |
       
    55   Blast_Method |
    56   Simp_Method |
    56   Simp_Method |
    57   Simp_Size_Method |
    57   Simp_Size_Method |
    58   Auto_Method |
    58   Auto_Method |
    59   Fastforce_Method |
    59   Fastforce_Method |
    60   Force_Method |
    60   Force_Method |
    61   Arith_Method |
    61   Linarith_Method |
    62   Blast_Method |
    62   Presburger_Method |
    63   Algebra_Method
    63   Algebra_Method
    64 
    64 
    65 datatype play_outcome =
    65 datatype play_outcome =
    66   Played of Time.time |
    66   Played of Time.time |
    67   Play_Timed_Out of Time.time |
    67   Play_Timed_Out of Time.time |
    69   Not_Played
    69   Not_Played
    70 
    70 
    71 type minimize_command = string list -> string
    71 type minimize_command = string list -> string
    72 type one_line_params =
    72 type one_line_params =
    73   (proof_method * play_outcome) * string * (string * stature) list * minimize_command * int * int
    73   (proof_method * play_outcome) * string * (string * stature) list * minimize_command * int * int
    74 
       
    75 val smtN = "smt"
       
    76 
    74 
    77 fun string_of_proof_method meth =
    75 fun string_of_proof_method meth =
    78   (case meth of
    76   (case meth of
    79     Metis_Method (NONE, NONE) => "metis"
    77     Metis_Method (NONE, NONE) => "metis"
    80   | Metis_Method (type_enc_opt, lam_trans_opt) =>
    78   | Metis_Method (type_enc_opt, lam_trans_opt) =>
    81     "metis (" ^ commas (map_filter I [type_enc_opt, lam_trans_opt]) ^ ")"
    79     "metis (" ^ commas (map_filter I [type_enc_opt, lam_trans_opt]) ^ ")"
    82   | Meson_Method => "meson"
    80   | Meson_Method => "meson"
    83   | SMT_Method => "smt"
    81   | SMT_Method => "smt"
       
    82   | Blast_Method => "blast"
    84   | Simp_Method => "simp"
    83   | Simp_Method => "simp"
    85   | Simp_Size_Method => "simp add: size_ne_size_imp_ne"
    84   | Simp_Size_Method => "simp add: size_ne_size_imp_ne"
    86   | Auto_Method => "auto"
    85   | Auto_Method => "auto"
    87   | Fastforce_Method => "fastforce"
    86   | Fastforce_Method => "fastforce"
    88   | Force_Method => "force"
    87   | Force_Method => "force"
    89   | Arith_Method => "arith"
    88   | Linarith_Method => "linarith"
    90   | Blast_Method => "blast"
    89   | Presburger_Method => "presburger"
    91   | Algebra_Method => "algebra")
    90   | Algebra_Method => "algebra")
    92 
    91 
    93 fun tac_of_proof_method ctxt (local_facts, global_facts) meth =
    92 fun tac_of_proof_method ctxt (local_facts, global_facts) meth =
    94   Method.insert_tac local_facts THEN'
    93   Method.insert_tac local_facts THEN'
    95   (case meth of
    94   (case meth of
    96     Metis_Method (type_enc_opt, lam_trans_opt) =>
    95     Metis_Method (type_enc_opt, lam_trans_opt) =>
    97     Metis_Tactic.metis_tac [type_enc_opt |> the_default (hd partial_type_encs)]
    96     Metis_Tactic.metis_tac [type_enc_opt |> the_default (hd partial_type_encs)]
    98       (lam_trans_opt |> the_default default_metis_lam_trans) ctxt global_facts
    97       (lam_trans_opt |> the_default default_metis_lam_trans) ctxt global_facts
       
    98   | Meson_Method => Meson.meson_tac ctxt global_facts
    99   | SMT_Method => SMT_Solver.smt_tac ctxt global_facts
    99   | SMT_Method => SMT_Solver.smt_tac ctxt global_facts
   100   | Meson_Method => Meson.meson_tac ctxt global_facts
       
   101   | _ =>
   100   | _ =>
   102     Method.insert_tac global_facts THEN'
   101     Method.insert_tac global_facts THEN'
   103     (case meth of
   102     (case meth of
   104       Simp_Method => Simplifier.asm_full_simp_tac ctxt
   103       Blast_Method => blast_tac ctxt
       
   104     | Simp_Method => Simplifier.asm_full_simp_tac ctxt
   105     | Simp_Size_Method =>
   105     | Simp_Size_Method =>
   106       Simplifier.asm_full_simp_tac (Simplifier.add_simp @{thm size_ne_size_imp_ne} ctxt)
   106       Simplifier.asm_full_simp_tac (Simplifier.add_simp @{thm size_ne_size_imp_ne} ctxt)
   107     | Auto_Method => K (Clasimp.auto_tac ctxt)
   107     | Auto_Method => K (Clasimp.auto_tac ctxt)
   108     | Fastforce_Method => Clasimp.fast_force_tac ctxt
   108     | Fastforce_Method => Clasimp.fast_force_tac ctxt
   109     | Force_Method => Clasimp.force_tac ctxt
   109     | Force_Method => Clasimp.force_tac ctxt
   110     | Arith_Method => Arith_Data.arith_tac ctxt
   110     | Linarith_Method => Lin_Arith.tac ctxt
   111     | Blast_Method => blast_tac ctxt
   111     | Presburger_Method => Cooper.tac true [] [] ctxt
   112     | Algebra_Method => Groebner.algebra_tac [] [] ctxt))
   112     | Algebra_Method => Groebner.algebra_tac [] [] ctxt))
   113 
   113 
   114 fun string_of_play_outcome (Played time) = string_of_ext_time (false, time)
   114 fun string_of_play_outcome (Played time) = string_of_ext_time (false, time)
   115   | string_of_play_outcome (Play_Timed_Out time) = string_of_ext_time (true, time) ^ ", timed out"
   115   | string_of_play_outcome (Play_Timed_Out time) = string_of_ext_time (true, time) ^ ", timed out"
   116   | string_of_play_outcome Play_Failed = "failed"
   116   | string_of_play_outcome Play_Failed = "failed"