let rec term_type_to_string : Types.basic_type Types.term_structure -> string = function
Base(term) | Prime(term) ->
(match term with
Agent -> "agent"
| Public_key -> "public_key"
| Symmetric_key -> "symmetric_key"
| Text -> "nonce"
| Protocol_id -> "protocol_id"
| Message -> "message"
| Channel -> "channel"
| Channel_dy -> "channel(dy)"
| Channel_ota -> "channel(ota)"
| Bool -> "bool"
| Hash_func -> "hash_func"
| Nat -> "nat"
| Enum(list) ->
"{"
^(List.fold_left
(fun s num ->
if not (num = List.hd list) then
s^","^(string_id#get_name num)
else
s^(string_id#get_name num))
"" list)
^"}")
| Function(term,list)->
(match list with
[] -> "unit"
| _ ->
(List.fold_left
(fun s t ->
s^(term_type_to_string t)^" -> ")
"" list)
^(term_type_to_string term))
| Set([])->
"set"
| Set(list)->
(term_type_to_string (List.hd list))^" set"
| Pair(term1,term2)->
"pair("
^(term_type_to_string term1)^","^(term_type_to_string term2)
^")"
| _ -> "nonce"