88 -> context * (term list list * (context -> context)) |
88 -> context * (term list list * (context -> context)) |
89 val bind_propp_schematic: context * (string * (string list * string list)) list list |
89 val bind_propp_schematic: context * (string * (string list * string list)) list list |
90 -> context * (term list list * (context -> context)) |
90 -> context * (term list list * (context -> context)) |
91 val bind_propp_schematic_i: context * (term * (term list * term list)) list list |
91 val bind_propp_schematic_i: context * (term * (term list * term list)) list list |
92 -> context * (term list list * (context -> context)) |
92 -> context * (term list list * (context -> context)) |
93 val get_thm: context -> string -> thm |
93 val get_thm: context -> thmref -> thm |
94 val get_thm_closure: context -> string -> thm |
94 val get_thm_closure: context -> thmref -> thm |
95 val get_thms: context -> string -> thm list |
95 val get_thms: context -> thmref -> thm list |
96 val get_thms_closure: context -> string -> thm list |
96 val get_thms_closure: context -> thmref -> thm list |
97 val cond_extern: context -> string -> xstring |
97 val cond_extern: context -> string -> xstring |
98 val qualified: bool -> context -> context |
98 val qualified: bool -> context -> context |
99 val restore_qualified: context -> context -> context |
99 val restore_qualified: context -> context -> context |
100 val hide_thms: bool -> string list -> context -> context |
100 val hide_thms: bool -> string list -> context -> context |
101 val put_thm: string * thm -> context -> context |
101 val put_thm: string * thm -> context -> context |
102 val put_thms: string * thm list -> context -> context |
102 val put_thms: string * thm list -> context -> context |
103 val put_thmss: (string * thm list) list -> context -> context |
103 val put_thmss: (string * thm list) list -> context -> context |
104 val reset_thms: string -> context -> context |
104 val reset_thms: string -> context -> context |
105 val note_thmss: |
105 val note_thmss: |
106 ((bstring * context attribute list) * (xstring * context attribute list) list) list -> |
106 ((bstring * context attribute list) * (thmref * context attribute list) list) list -> |
107 context -> context * (bstring * thm list) list |
107 context -> context * (bstring * thm list) list |
108 val note_thmss_i: |
108 val note_thmss_i: |
109 ((bstring * context attribute list) * (thm list * context attribute list) list) list -> |
109 ((bstring * context attribute list) * (thm list * context attribute list) list) list -> |
110 context -> context * (bstring * thm list) list |
110 context -> context * (bstring * thm list) list |
111 val export_assume: exporter |
111 val export_assume: exporter |
986 fun retrieve_thms f g (ctxt as Context {thy, thms = (_, space, tab, _), ...}) = |
986 fun retrieve_thms f g (ctxt as Context {thy, thms = (_, space, tab, _), ...}) = |
987 let |
987 let |
988 val sg_ref = Sign.self_ref (Theory.sign_of thy); |
988 val sg_ref = Sign.self_ref (Theory.sign_of thy); |
989 val get_from_thy = f thy; |
989 val get_from_thy = f thy; |
990 in |
990 in |
991 fn xname => |
991 fn xnamei as (xname, _) => |
992 (case Symtab.lookup (tab, NameSpace.intern space xname) of |
992 (case Symtab.lookup (tab, NameSpace.intern space xname) of |
993 Some (Some ths) => map (Thm.transfer_sg (Sign.deref sg_ref)) ths |
993 Some (Some ths) => map (Thm.transfer_sg (Sign.deref sg_ref)) |
994 | _ => get_from_thy xname) |> g xname |
994 (PureThy.select_thm xnamei ths) |
|
995 | _ => get_from_thy xnamei) |> g xname |
995 end; |
996 end; |
996 |
997 |
997 val get_thm = retrieve_thms PureThy.get_thms PureThy.single_thm; |
998 val get_thm = retrieve_thms PureThy.get_thms PureThy.single_thm; |
998 val get_thm_closure = retrieve_thms PureThy.get_thms_closure PureThy.single_thm; |
999 val get_thm_closure = retrieve_thms PureThy.get_thms_closure PureThy.single_thm; |
999 val get_thms = retrieve_thms PureThy.get_thms (K I); |
1000 val get_thms = retrieve_thms PureThy.get_thms (K I); |
1447 (* print_thms_containing *) |
1448 (* print_thms_containing *) |
1448 |
1449 |
1449 fun lthms_containing (ctxt as Context {thms = (_, _, _, index), ...}) idx = |
1450 fun lthms_containing (ctxt as Context {thms = (_, _, _, index), ...}) idx = |
1450 let |
1451 let |
1451 fun valid (name, ths) = |
1452 fun valid (name, ths) = |
1452 (case try (transform_error (fn () => get_thms ctxt name)) () of |
1453 (case try (transform_error (fn () => get_thms ctxt (name, None))) () of |
1453 None => false |
1454 None => false |
1454 | Some ths' => Library.equal_lists Thm.eq_thm (ths, ths')); |
1455 | Some ths' => Library.equal_lists Thm.eq_thm (ths, ths')); |
1455 in gen_distinct eq_fst (filter valid (FactIndex.find idx index)) end; |
1456 in gen_distinct eq_fst (filter valid (FactIndex.find idx index)) end; |
1456 |
1457 |
1457 |
1458 |