equal
deleted
inserted
replaced
54 val dest_internal = unsuffix "_"; |
54 val dest_internal = unsuffix "_"; |
55 |
55 |
56 val skolem = suffix "__"; |
56 val skolem = suffix "__"; |
57 val dest_skolem = unsuffix "__"; |
57 val dest_skolem = unsuffix "__"; |
58 |
58 |
59 fun clean_index ("", i) = ("u", i + 1) |
59 fun clean_index (x, i) = |
60 | clean_index (x, i) = |
60 (case try dest_internal x of |
61 (case try dest_internal x of |
61 NONE => (x, i) |
62 NONE => (x, i) |
62 | SOME x' => clean_index (x', i + 1)); |
63 | SOME x' => clean_index (x', i + 1)); |
|
64 |
63 |
65 fun clean x = #1 (clean_index (x, 0)); |
64 fun clean x = #1 (clean_index (x, 0)); |
66 |
65 |
67 |
66 |
68 |
67 |
71 (* context *) |
70 (* context *) |
72 |
71 |
73 datatype context = |
72 datatype context = |
74 Context of string option Symtab.table; (*declared names with latest renaming*) |
73 Context of string option Symtab.table; (*declared names with latest renaming*) |
75 |
74 |
76 fun declare x (Context tab) = Context (Symtab.default (x, NONE) tab); |
75 fun declare x (Context tab) = |
77 fun declare_renaming (x, x') (Context tab) = Context (Symtab.update (x, SOME x') tab); |
76 Context (Symtab.default (clean x, NONE) tab); |
|
77 |
|
78 fun declare_renaming (x, x') (Context tab) = |
|
79 Context (Symtab.update (clean x, SOME (clean x')) tab); |
78 |
80 |
79 fun declared (Context tab) = Symtab.lookup tab; |
81 fun declared (Context tab) = Symtab.lookup tab; |
80 |
82 |
81 val context = Context Symtab.empty; |
83 val context = Context Symtab.empty; |
82 fun make_context used = fold declare used context; |
84 fun make_context used = fold declare used context; |
90 | invs x n = |
92 | invs x n = |
91 let val x' = Symbol.bump_string x in |
93 let val x' = Symbol.bump_string x in |
92 if is_some (declared ctxt x) then invs x' n |
94 if is_some (declared ctxt x) then invs x' n |
93 else x :: invs x' (n - 1) |
95 else x :: invs x' (n - 1) |
94 end; |
96 end; |
95 in invs end; |
97 in invs o clean end; |
96 |
98 |
97 val invent_list = invents o make_context; |
99 val invent_list = invents o make_context; |
98 |
100 |
99 |
101 |
100 (* variants *) |
102 (* variants *) |