author | desharna |
Fri, 04 Apr 2025 15:30:03 +0200 | |
changeset 82399 | 9d457dfb56c5 |
parent 81959 | fae61f1c8113 |
permissions | -rw-r--r-- |
74270 | 1 |
(* Title: Pure/cterm_items.ML |
2 |
Author: Makarius |
|
3 |
||
4 |
Scalable collections of term items: for type thm and cterm. |
|
79162 | 5 |
See also Pure/term_items.ML. |
74270 | 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 |
||
77903 | 22 |
structure Ctermset = Set(Ctermtab.Key); |
23 |
||
74270 | 24 |
|
74271 | 25 |
structure Cterms: |
26 |
sig |
|
27 |
include TERM_ITEMS |
|
28 |
val add_vars: thm -> set -> set |
|
29 |
val add_frees: thm -> set -> set |
|
30 |
end = |
|
31 |
struct |
|
32 |
||
33 |
structure Term_Items = Term_Items |
|
34 |
( |
|
35 |
type key = cterm; |
|
79121 | 36 |
val ord = Thm.fast_term_ord; |
74271 | 37 |
); |
38 |
open Term_Items; |
|
39 |
||
81959
fae61f1c8113
minor performance tuning: more fine-grained guard to skip irrelevant items;
wenzelm
parents:
79162
diff
changeset
|
40 |
val add_vars = Thm.fold_atomic_cterms {hyps = false} (K Term.is_Var) add_set; |
fae61f1c8113
minor performance tuning: more fine-grained guard to skip irrelevant items;
wenzelm
parents:
79162
diff
changeset
|
41 |
val add_frees = Thm.fold_atomic_cterms {hyps = true} (K Term.is_Free) add_set; |
74271 | 42 |
|
43 |
end; |
|
74272 | 44 |
|
45 |
||
46 |
structure Thmtab: |
|
47 |
sig |
|
48 |
include TABLE |
|
49 |
val thm_cache: (thm -> 'a) -> thm -> 'a |
|
50 |
end = |
|
51 |
struct |
|
52 |
||
53 |
structure Table = Table(type key = thm val ord = Thm.thm_ord); |
|
54 |
open Table; |
|
55 |
||
56 |
fun thm_cache f = Cache.create empty lookup update f; |
|
57 |
||
58 |
end; |
|
77903 | 59 |
|
60 |
structure Thmset = Set(Thmtab.Key); |