27 include BASIC_THM_DATABASE |
27 include BASIC_THM_DATABASE |
28 val qed_thms: thm list ref |
28 val qed_thms: thm list ref |
29 val ml_store_thm: string * thm -> unit |
29 val ml_store_thm: string * thm -> unit |
30 val ml_store_thms: string * thm list -> unit |
30 val ml_store_thms: string * thm list -> unit |
31 val is_ml_identifier: string -> bool |
31 val is_ml_identifier: string -> bool |
|
32 val print_thms_containing: theory -> xstring list -> unit |
32 end; |
33 end; |
33 |
34 |
34 structure ThmDatabase: THM_DATABASE = |
35 structure ThmDatabase: THM_DATABASE = |
35 struct |
36 struct |
36 |
37 |
91 |
92 |
92 |
93 |
93 (** retrieve theorems **) |
94 (** retrieve theorems **) |
94 |
95 |
95 (*get theorems that contain all of given constants*) |
96 (*get theorems that contain all of given constants*) |
96 fun thms_containing raw_consts = |
97 fun thms_containing_thy thy raw_consts = |
97 let |
98 let val consts = map (Sign.intern_const (Theory.sign_of thy)) raw_consts; |
98 val sign = sign_of_thm (topthm ()); |
|
99 val consts = map (Sign.intern_const sign) raw_consts; |
|
100 val thy = ThyInfo.theory_of_sign sign; |
|
101 in PureThy.thms_containing thy consts end |
99 in PureThy.thms_containing thy consts end |
102 handle THEORY (msg,_) => error msg; |
100 handle THEORY (msg,_) => error msg; |
|
101 |
|
102 fun thms_containing cs = |
|
103 thms_containing_thy (ThyInfo.theory_of_sign (Thm.sign_of_thm (Goals.topthm ()))) cs; |
|
104 |
|
105 fun prt_thm (a, th) = |
|
106 Pretty.block [Pretty.str (a ^ ":"), Pretty.brk 1, |
|
107 Display.pretty_thm_no_quote (#1 (Drule.freeze_thaw th))]; |
|
108 |
|
109 fun print_thms_containing thy cs = |
|
110 Pretty.writeln (Pretty.blk (0, Pretty.fbreaks (map prt_thm (thms_containing_thy thy cs)))); |
103 |
111 |
104 |
112 |
105 (*top_const: main constant, ignoring Trueprop*) |
113 (*top_const: main constant, ignoring Trueprop*) |
106 fun top_const (_ $ t) = (case head_of t of Const (c, _) => Some c | _ => None) |
114 fun top_const (_ $ t) = (case head_of t of Const (c, _) => Some c | _ => None) |
107 | top_const _ = None; |
115 | top_const _ = None; |