The specification of a LIST type which can be take an element as parameter is of fundamental importance as not only the vocabulary system but also strings are instantiations of datatype.
loose pspec LIST(sort el)
import el;
sorts freely generated list;
length([]) = 0;
length(add(e1, l)) = succ(length(l));
e1 in [] = false;
e1 in add(e2, l) = (e1 == e2) or e1 in l;
reduceList([]) = [];
reduceList(add(e1, l)) =
if e1 in l then reduceList(l)
else add(e1, reduceList(l));
The PAIR specification:
All vocabulary entries are pairs, a specification of the datatype can be found below .
Strings are list of characters. It can be achieved by renaming (1).
loose pspec STRING(sort char)
import char;
import (LIST(char) rename sort list opns []
to sort string, opn "");
end spec