src/Pure/Isar/find_theorems.ML
changeset 16071 e0136cdef722
parent 16036 1da07ac33711
child 16074 9e569163ba8c
equal deleted inserted replaced
16070:4a83dd540b88 16071:e0136cdef722
     8 val thms_containing_limit = ref 40;
     8 val thms_containing_limit = ref 40;
     9 
     9 
    10 signature FIND_THEOREMS =
    10 signature FIND_THEOREMS =
    11 sig
    11 sig
    12   val find_thms: Proof.context -> FactIndex.spec -> (thmref * thm) list
    12   val find_thms: Proof.context -> FactIndex.spec -> (thmref * thm) list
    13   val find_intros: Proof.context -> term -> (thmref * thm) list
       
    14   val find_intros_goal: Proof.context -> thm -> int -> (thmref * thm) list
       
    15   val find_elims: Proof.context -> term -> (thmref * thm) list
       
    16   datatype 'term criterion =
    13   datatype 'term criterion =
    17     Name of string | Intro | Elim | Dest | Rewrite of 'term | Pattern of 'term
    14     Name of string | Intro | Elim | Dest | Rewrite of 'term | Pattern of 'term
    18   val print_theorems: Proof.context -> term option -> int option ->
    15   val print_theorems: Proof.context -> term option -> int option ->
    19     (bool * string criterion) list -> unit
    16     (bool * string criterion) list -> unit
    20 end;
    17 end;
    78 
    75 
    79 fun is_matching_thm extract ctxt prop fact =
    76 fun is_matching_thm extract ctxt prop fact =
    80   not (null (select_match extract ctxt prop [fact]));
    77   not (null (select_match extract ctxt prop [fact]));
    81 
    78 
    82 end;
    79 end;
    83 
       
    84 
       
    85 (* intro/elim rules *)
       
    86 
       
    87 (*match statement against conclusion of some rule*)
       
    88 val find_intros =
       
    89   find_matching_thms (single, Logic.strip_imp_concl);
       
    90 
       
    91 (*match conclusion of subgoal i against conclusion of some rule*)
       
    92 fun find_intros_goal ctxt st i =
       
    93   find_intros ctxt (Logic.concl_of_goal (Thm.prop_of st) i);
       
    94 
       
    95 (*match statement against major premise of some rule*)
       
    96 val find_elims = find_matching_thms
       
    97   (fn thm => if Thm.no_prems thm then [] else [thm],
       
    98    hd o Logic.strip_imp_prems);
       
    99 
    80 
   100 
    81 
   101 
    82 
   102 (** search criteria **)
    83 (** search criteria **)
   103 
    84