src/HOL/Tools/Sledgehammer/sledgehammer_proof_methods.ML
changeset 60252 2c468c062589
parent 59058 a78612c67ec0
child 60305 7d278b0617d3
equal deleted inserted replaced
60251:98754695b421 60252:2c468c062589
    32 
    32 
    33   type one_line_params =
    33   type one_line_params =
    34     ((string * stature) list * (proof_method * play_outcome)) * string * int * int
    34     ((string * stature) list * (proof_method * play_outcome)) * string * int * int
    35 
    35 
    36   val is_proof_method_direct : proof_method -> bool
    36   val is_proof_method_direct : proof_method -> bool
       
    37   val proof_method_distinguishes_chained_and_direct : proof_method -> bool
    37   val string_of_proof_method : Proof.context -> string list -> proof_method -> string
    38   val string_of_proof_method : Proof.context -> string list -> proof_method -> string
    38   val tac_of_proof_method : Proof.context -> thm list * thm list -> proof_method -> int -> tactic
    39   val tac_of_proof_method : Proof.context -> thm list * thm list -> proof_method -> int -> tactic
    39   val thms_influence_proof_method : Proof.context -> proof_method -> thm list -> bool
    40   val thms_influence_proof_method : Proof.context -> proof_method -> thm list -> bool
    40   val string_of_play_outcome : play_outcome -> string
    41   val string_of_play_outcome : play_outcome -> string
    41   val play_outcome_ord : play_outcome * play_outcome -> order
    42   val play_outcome_ord : play_outcome * play_outcome -> order
    77   | is_proof_method_direct Meson_Method = true
    78   | is_proof_method_direct Meson_Method = true
    78   | is_proof_method_direct SMT_Method = true
    79   | is_proof_method_direct SMT_Method = true
    79   | is_proof_method_direct Simp_Method = true
    80   | is_proof_method_direct Simp_Method = true
    80   | is_proof_method_direct Simp_Size_Method = true
    81   | is_proof_method_direct Simp_Size_Method = true
    81   | is_proof_method_direct _ = false
    82   | is_proof_method_direct _ = false
       
    83 
       
    84 fun proof_method_distinguishes_chained_and_direct Simp_Method = true
       
    85   | proof_method_distinguishes_chained_and_direct Simp_Size_Method = true
       
    86   | proof_method_distinguishes_chained_and_direct _ = false
    82 
    87 
    83 fun is_proof_method_multi_goal Auto_Method = true
    88 fun is_proof_method_multi_goal Auto_Method = true
    84   | is_proof_method_multi_goal _ = false
    89   | is_proof_method_multi_goal _ = false
    85 
    90 
    86 fun maybe_paren s = s |> not (Symbol_Pos.is_identifier s) ? enclose "(" ")"
    91 fun maybe_paren s = s |> not (Symbol_Pos.is_identifier s) ? enclose "(" ")"
   161 fun apply_on_subgoal _ 1 = "by "
   166 fun apply_on_subgoal _ 1 = "by "
   162   | apply_on_subgoal 1 _ = "apply "
   167   | apply_on_subgoal 1 _ = "apply "
   163   | apply_on_subgoal i n = "prefer " ^ string_of_int i ^ " " ^ apply_on_subgoal 1 n
   168   | apply_on_subgoal i n = "prefer " ^ string_of_int i ^ " " ^ apply_on_subgoal 1 n
   164 
   169 
   165 (* FIXME *)
   170 (* FIXME *)
   166 fun proof_method_command ctxt meth i n _(*used_chaineds*) _(*num_chained*) ss =
   171 fun proof_method_command ctxt meth i n used_chaineds _(*num_chained*) extras =
   167   let val (indirect_ss, direct_ss) = if is_proof_method_direct meth then ([], ss) else (ss, []) in
   172   let
       
   173     val (indirect_ss, direct_ss) =
       
   174       if is_proof_method_direct meth then
       
   175         ([], extras |> proof_method_distinguishes_chained_and_direct meth ? append used_chaineds)
       
   176       else
       
   177         (extras, [])
       
   178   in
   168     (if null indirect_ss then "" else "using " ^ space_implode " " indirect_ss ^ " ") ^
   179     (if null indirect_ss then "" else "using " ^ space_implode " " indirect_ss ^ " ") ^
   169     apply_on_subgoal i n ^ string_of_proof_method ctxt direct_ss meth ^
   180     apply_on_subgoal i n ^ string_of_proof_method ctxt direct_ss meth ^
   170     (if is_proof_method_multi_goal meth andalso n <> 1 then "[1]" else "")
   181     (if is_proof_method_multi_goal meth andalso n <> 1 then "[1]" else "")
   171   end
   182   end
   172 
   183