33 val dest_type: term -> typ |
33 val dest_type: term -> typ |
34 val const_of_class: class -> string |
34 val const_of_class: class -> string |
35 val class_of_const: string -> class |
35 val class_of_const: string -> class |
36 val mk_inclass: typ * class -> term |
36 val mk_inclass: typ * class -> term |
37 val dest_inclass: term -> typ * class |
37 val dest_inclass: term -> typ * class |
|
38 val name_classrel: string * string -> string |
38 val mk_classrel: class * class -> term |
39 val mk_classrel: class * class -> term |
39 val dest_classrel: term -> class * class |
40 val dest_classrel: term -> class * class |
40 val mk_arities: string * sort list * sort -> term list |
41 val name_arities: arity -> string list |
|
42 val name_arity: string * sort list * class -> string |
|
43 val mk_arities: arity -> term list |
41 val dest_arity: term -> string * sort list * class |
44 val dest_arity: term -> string * sort list * class |
42 val dest_def: Pretty.pp -> (term -> bool) -> (string -> bool) -> (string -> bool) -> |
45 val dest_def: Pretty.pp -> (term -> bool) -> (string -> bool) -> (string -> bool) -> |
43 term -> (term * term) * term |
46 term -> (term * term) * term |
44 val abs_def: term -> term * term |
47 val abs_def: term -> term * term |
45 val mk_cond_defpair: term list -> term * term -> string * term |
48 val mk_cond_defpair: term list -> term * term -> string * term |
219 | dest_inclass t = raise TERM ("dest_inclass", [t]); |
222 | dest_inclass t = raise TERM ("dest_inclass", [t]); |
220 |
223 |
221 |
224 |
222 (* class relations *) |
225 (* class relations *) |
223 |
226 |
|
227 fun name_classrel (c1, c2) = |
|
228 NameSpace.base c1 ^ "_" ^ NameSpace.base c2; |
|
229 |
224 fun mk_classrel (c1, c2) = mk_inclass (Term.aT [c1], c2); |
230 fun mk_classrel (c1, c2) = mk_inclass (Term.aT [c1], c2); |
225 |
231 |
226 fun dest_classrel tm = |
232 fun dest_classrel tm = |
227 (case dest_inclass tm of |
233 (case dest_inclass tm of |
228 (TVar (_, [c1]), c2) => (c1, c2) |
234 (TVar (_, [c1]), c2) => (c1, c2) |
229 | _ => raise TERM ("dest_classrel", [tm])); |
235 | _ => raise TERM ("dest_classrel", [tm])); |
230 |
236 |
231 |
237 |
232 (* type arities *) |
238 (* type arities *) |
|
239 |
|
240 fun name_arities (t, _, S) = |
|
241 let val b = NameSpace.base t |
|
242 in S |> map (fn c => NameSpace.base c ^ "_" ^ b) end; |
|
243 |
|
244 fun name_arity (t, dom, c) = hd (name_arities (t, dom, [c])); |
233 |
245 |
234 fun mk_arities (t, Ss, S) = |
246 fun mk_arities (t, Ss, S) = |
235 let val T = Type (t, ListPair.map TFree (Name.invent_list [] "'a" (length Ss), Ss)) |
247 let val T = Type (t, ListPair.map TFree (Name.invent_list [] "'a" (length Ss), Ss)) |
236 in map (fn c => mk_inclass (T, c)) S end; |
248 in map (fn c => mk_inclass (T, c)) S end; |
237 |
249 |