src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML
changeset 61322 44f4ffe2b210
parent 61054 add998b3c597
child 61646 61995131cf28
equal deleted inserted replaced
61321:c982a4cc8dc4 61322:44f4ffe2b210
    26   val backquote_thm : Proof.context -> thm -> string
    26   val backquote_thm : Proof.context -> thm -> string
    27   val is_blacklisted_or_something : Proof.context -> bool -> string -> bool
    27   val is_blacklisted_or_something : Proof.context -> bool -> string -> bool
    28   val clasimpset_rule_table_of : Proof.context -> status Termtab.table
    28   val clasimpset_rule_table_of : Proof.context -> status Termtab.table
    29   val build_name_tables : (thm -> string) -> ('a * thm) list ->
    29   val build_name_tables : (thm -> string) -> ('a * thm) list ->
    30     string Symtab.table * string Symtab.table
    30     string Symtab.table * string Symtab.table
       
    31   val fact_distinct : (term * term -> bool) -> ('a * thm) list -> ('a * thm) list
    31   val maybe_instantiate_inducts : Proof.context -> term list -> term ->
    32   val maybe_instantiate_inducts : Proof.context -> term list -> term ->
    32     (((unit -> string) * 'a) * thm) list -> (((unit -> string) * 'a) * thm) list
    33     (((unit -> string) * 'a) * thm) list -> (((unit -> string) * 'a) * thm) list
    33   val fact_of_raw_fact : raw_fact -> fact
    34   val fact_of_raw_fact : raw_fact -> fact
    34   val is_useful_unnamed_local_fact : Proof.context -> thm -> bool
    35   val is_useful_unnamed_local_fact : Proof.context -> thm -> bool
    35 
    36 
   373   in
   374   in
   374     (plain_name_tab, inclass_name_tab)
   375     (plain_name_tab, inclass_name_tab)
   375   end
   376   end
   376 
   377 
   377 fun fact_distinct eq facts =
   378 fun fact_distinct eq facts =
   378   fold (fn fact as (_, th) =>
   379   fold (fn (i, fact as (_, th)) =>
   379       Net.insert_term_safe (eq o apply2 (normalize_eq o Thm.prop_of o snd))
   380       Net.insert_term_safe (eq o apply2 (normalize_eq o Thm.prop_of o snd o snd))
   380         (normalize_eq (Thm.prop_of th), fact))
   381         (normalize_eq (Thm.prop_of th), (i, fact)))
   381     facts Net.empty
   382     (tag_list 0 facts) Net.empty
   382   |> Net.entries
   383   |> Net.entries
       
   384   |> sort (int_ord o apply2 fst)
       
   385   |> map snd
   383 
   386 
   384 fun struct_induct_rule_on th =
   387 fun struct_induct_rule_on th =
   385   (case Logic.strip_horn (Thm.prop_of th) of
   388   (case Logic.strip_horn (Thm.prop_of th) of
   386     (prems, @{const Trueprop} $ ((p as Var ((p_name, 0), _)) $ (a as Var (_, ind_T)))) =>
   389     (prems, @{const Trueprop} $ ((p as Var ((p_name, 0), _)) $ (a as Var (_, ind_T)))) =>
   387     if not (is_TVar ind_T) andalso length prems > 1 andalso
   390     if not (is_TVar ind_T) andalso length prems > 1 andalso