equal
deleted
inserted
replaced
150 include BASIC_TERM |
150 include BASIC_TERM |
151 val aT: sort -> typ |
151 val aT: sort -> typ |
152 val itselfT: typ -> typ |
152 val itselfT: typ -> typ |
153 val a_itselfT: typ |
153 val a_itselfT: typ |
154 val argument_type_of: term -> typ |
154 val argument_type_of: term -> typ |
|
155 val head_name_of: term -> string |
155 val add_tvarsT: typ -> (indexname * sort) list -> (indexname * sort) list |
156 val add_tvarsT: typ -> (indexname * sort) list -> (indexname * sort) list |
156 val add_tvars: term -> (indexname * sort) list -> (indexname * sort) list |
157 val add_tvars: term -> (indexname * sort) list -> (indexname * sort) list |
157 val add_vars: term -> (indexname * typ) list -> (indexname * typ) list |
158 val add_vars: term -> (indexname * typ) list -> (indexname * typ) list |
158 val add_tfreesT: typ -> (string * sort) list -> (string * sort) list |
159 val add_tfreesT: typ -> (string * sort) list -> (string * sort) list |
159 val add_tfrees: term -> (string * sort) list -> (string * sort) list |
160 val add_tfrees: term -> (string * sort) list -> (string * sort) list |
404 |
405 |
405 (* maps f(t1,...,tn) to f , which is never a combination *) |
406 (* maps f(t1,...,tn) to f , which is never a combination *) |
406 fun head_of (f$t) = head_of f |
407 fun head_of (f$t) = head_of f |
407 | head_of u = u; |
408 | head_of u = u; |
408 |
409 |
|
410 fun head_name_of tm = |
|
411 (case head_of tm of |
|
412 t as Const (c, _) => |
|
413 if NameSpace.is_qualified c then c |
|
414 else raise TERM ("Malformed constant name", [t]) |
|
415 | t as Free (x, _) => |
|
416 if not (NameSpace.is_qualified x) then x |
|
417 else raise TERM ("Malformed fixed variable name", [t]) |
|
418 | t => raise TERM ("No fixed head of term", [t])); |
409 |
419 |
410 (*number of atoms and abstractions in a term*) |
420 (*number of atoms and abstractions in a term*) |
411 fun size_of_term tm = |
421 fun size_of_term tm = |
412 let |
422 let |
413 fun add_size (t $ u, n) = add_size (t, add_size (u, n)) |
423 fun add_size (t $ u, n) = add_size (t, add_size (u, n)) |