| 74270 |      1 | (*  Title:      Pure/cterm_items.ML
 | 
|  |      2 |     Author:     Makarius
 | 
|  |      3 | 
 | 
|  |      4 | Scalable collections of term items: for type thm and cterm.
 | 
|  |      5 | See als Pure/term_items.ML.
 | 
|  |      6 | *)
 | 
|  |      7 | 
 | 
|  |      8 | structure Ctermtab:
 | 
|  |      9 | sig
 | 
|  |     10 |   include TABLE
 | 
|  |     11 |   val cterm_cache: (cterm -> 'a) -> cterm -> 'a
 | 
|  |     12 | end =
 | 
|  |     13 | struct
 | 
|  |     14 | 
 | 
|  |     15 | structure Table = Table(type key = cterm val ord = Thm.fast_term_ord);
 | 
|  |     16 | open Table;
 | 
|  |     17 | 
 | 
|  |     18 | fun cterm_cache f = Cache.create empty lookup update f;
 | 
|  |     19 | 
 | 
|  |     20 | end;
 | 
|  |     21 | 
 | 
|  |     22 | 
 | 
| 74271 |     23 | structure Cterms:
 | 
|  |     24 | sig
 | 
|  |     25 |   include TERM_ITEMS
 | 
|  |     26 |   val add_vars: thm -> set -> set
 | 
|  |     27 |   val add_frees: thm -> set -> set
 | 
|  |     28 | end =
 | 
|  |     29 | struct
 | 
|  |     30 | 
 | 
|  |     31 | structure Term_Items = Term_Items
 | 
|  |     32 | (
 | 
|  |     33 |   type key = cterm;
 | 
|  |     34 |   val ord = Thm.fast_term_ord
 | 
|  |     35 | );
 | 
|  |     36 | open Term_Items;
 | 
|  |     37 | 
 | 
|  |     38 | val add_vars = Thm.fold_atomic_cterms {hyps = false} Term.is_Var add_set;
 | 
|  |     39 | val add_frees = Thm.fold_atomic_cterms {hyps = true} Term.is_Free add_set;
 | 
|  |     40 | 
 | 
|  |     41 | end;
 | 
| 74272 |     42 | 
 | 
|  |     43 | 
 | 
|  |     44 | structure Thmtab:
 | 
|  |     45 | sig
 | 
|  |     46 |   include TABLE
 | 
|  |     47 |   val thm_cache: (thm -> 'a) -> thm -> 'a
 | 
|  |     48 | end =
 | 
|  |     49 | struct
 | 
|  |     50 | 
 | 
|  |     51 | structure Table = Table(type key = thm val ord = Thm.thm_ord);
 | 
|  |     52 | open Table;
 | 
|  |     53 | 
 | 
|  |     54 | fun thm_cache f = Cache.create empty lookup update f;
 | 
|  |     55 | 
 | 
|  |     56 | end;
 |