This paper discusses issues in a sequential implementation of a subset-equational language, an extension of the equational programming paradigm for efficient treatment of set-valued functions. Subset assertions have the form f(terms)⊇expression, and in general, multiple subset assertions may be used to define a set-valued function f. They incorporate a collect-all capability, so that the meaning of a set-valued function f applied to argument terms is equal to the union of the respective sets defined by the different subset assertions for f. The universe of terms also includes set-valued terms; hence the matching operation between terms is set matching. The multiple matches arising from set matching effectively serve to iterate over the elements of sets, thus permitting many useful set operations to be stated nonrecursively. The main features of this implementation are: (1) compiling the commonly occurring forms of set patterns using instructions similar to the WAM instructions for PROLOG; (2) avoiding checks for duplicates and construction of intermediate sets in argument positions of functions when they distribute over union in these arguments; and (3) performing last-call optimization for both equational and subset assertions. An implementation of these ideas has been completed, and compiled code for typical program fragments is presented, as well as performance figures for the key optimizations. © 1992.
Jayaraman, B. (1992). Implementation of subset-equational programs. The Journal of Logic Programming, 12(4), 299–324. https://doi.org/10.1016/0743-1066(92)90005-N