Functional programming with sets

  • Bharat Jayaraman
  • David A. Plaisted
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 274)


Set abstraction, originally introduced in fuctional languages by Turner, is an appealing construct because it leads to concise definitions of many interesting operations. However, existing approaches treat sets as lists for the sake of efficiency, and thereby sacrifice a simple declarative semantics. In this paper, we present a novel language based on sets and equations, where sets are treated as sets, consistent with their semantics. The language is called SEL, for Set-Equation Language. Equations are assumed to define a confluent rewriting system when oriented left to right. Sets are defined in terms of their subsets; these rules define a nonconfluent rewriting system when oriented left to right. We show examples of programs in this language, and provide an operational semantics for such programs. Programs are executed by innermost reduction, which may be nondeterministic or deterministic. Nondeterministic reduction is used when one of the elements of a set is desired. Deterministic reduction is used to simplify a term via an equation or to obtain all the elements of a set. The correctness of the operational semantics is also established.


Normal Form Logic Program Operational Semantic Functional Programming Functional Language 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. [B83]
    A. Bundy, “The Computer Modelling of Mathematical Reasoning,” Academic Press, New York, 1983.Google Scholar
  2. [BD85]
    L. Bachmair and N. Dershowitz, “Commutation, transformation, and temination,” In Proc. of 8th Int'l CADE, Oxford, Springer Lecture Notes in Computer Science, 230, pp. 5–20.Google Scholar
  3. [BKN85]
    D. Benanav, D. Kapur, and P. Narendran, “On the complexity of matching problems,” In Rewriting Techniques and Applications, pp. 417–429, Dijon, France, May 1985.Google Scholar
  4. [BP85]
    L. Bachmair and D.A. Plaisted, “Associative Path Ordering,” J. of Symbolic Computation, 1, pp. 329–349.Google Scholar
  5. [C78]
    K. L. Clark, “Negation as Failure,” In Logic and Data Bases, Ed. H. Gallaire and J. Minker, Plenum Press, New York, 1978, pp. 293–322.Google Scholar
  6. [CK81]
    J. S. Conery and D. F. Kibler, “Parallel Interpretation of Logic Programs,” In Conf. Functional Prog. Lang. and Comp. Arch., ACM, 1981, pp. 163–170.Google Scholar
  7. [CM81]
    W. F. Clocksin and C. S. Mellish, Programming in Prolog. Springer-Verlag, New York, 1981.Google Scholar
  8. [D82]
    N. Dershowitz, “Orderings for term-rewriting systems,” Theoretical Computer Science, 17, pp. 279–301.Google Scholar
  9. [D85]
    N. Dershowitz, “Termination of Rewriting,” Technical report UIUCDCS-R-85-1220, University of Illinois at Urbana-Champaign, August 1985.Google Scholar
  10. [DP85]
    N. Dershowitz and D. A. Plaisted, “Applicative Programming cum Logic Programming,” In 1985 Symp. on Logic Programming, Boston, pp. 54–66.Google Scholar
  11. [DFP86]
    J. Darlington, A.J. Field, and H. Pull, “Unification of Functional and Logic Languages,” In DeGroot and Lindstrom (eds.), Logic Programming, Relations, Functions and Equations, pp. 37–70, Prentice-Hall, 1986.Google Scholar
  12. [FW80]
    D.P. Friedman and D.S. Wise, “An Indeterminate Constructor for Applicative Programming,” In 7th ACM POPL, pp. 245–250, Las Vegas, January 1980.Google Scholar
  13. [H80]
    G. Huet, “Confluent Reductions: abstract properties and applications to term rewriting systems,” J. ACM, 27, 1980, pp. 797–821.Google Scholar
  14. [HO80]
    G. Huet and D. Oppen, “Equations and Rewrite Rules: a Survey,” In Formal Languages: Perspectives and Open Problems, R. Book (ed.), Academic Press, New York 1980.Google Scholar
  15. [HO82]
    C. M. Hoffman and M. J. O'Donnell, “Programming with Equations,” ACM TOPLAS 4, No. 1 (January 1982) pp. 83–112.Google Scholar
  16. [JS86]
    B. Jayaraman and F.S.K. Silbermann, “Equations, Sets, and Reduction Semantics for Functional and Logic Programming,” In 1986 ACM Symposium on LISP and Functional Programming, pp. 320–331, Boston, 1986.Google Scholar
  17. [KB70]
    D. E. Knuth and P. Bendix, “Simple Word Problems in Universal Algebras,” In Computational Problems in Abstract Algebra, J. Leech (ed.), Pergamon Press, New York, pp. 263–297, 1970.Google Scholar
  18. [K82]
    R. M. Keller, “FEL (Function Equation Language) Programmer's Guide,” AMPS Technical Memo 7, Department of Computer Science, University of Utah, April 1982.Google Scholar
  19. [N85]
    L. Naish, “All Solutions Predicates in Prolog,” In Symp. on Logic Programming, Boston, 1985, pp. 73–77.Google Scholar
  20. [O85]
    M. J. O'Donnell, “Equational logic as a programming language,” M.I.T. Press, 1985.Google Scholar
  21. [P85]
    D.A. Plaisted, “Semantic Confluence Tests and Completion Methods,” Information and Control, 65, pp. 182–215, 1985.Google Scholar
  22. [P86]
    D.A. Plaisted, “Nondeterminism by Associative-Commutative Rewriting,” Internal Report, Department of Computer Science, University of North Carolina, Chapel Hill, March 1986, 30 pages.Google Scholar
  23. [R84]
    J. A. Robinson, “New Generation Knowledge Processing: Syracuse University Parallel Expression Reduction,” First Annual Progress Report, December 1984.Google Scholar
  24. [R85]
    U. S. Reddy, “Narrowing as the Operational Semantics of Functional Languages,” In 1985 Symp. on Logic Programming, Boston, 1985, pp. 138–151.Google Scholar
  25. [T81]
    D. A. Turner, “The semantic elegance of applicative languages,” In ACM Symp. on Func. Prog. and Comp. Arch., New Hampshire, October, 1981, pp. 85–92.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1987

Authors and Affiliations

  • Bharat Jayaraman
    • 1
  • David A. Plaisted
    • 1
  1. 1.Department of Computer ScienceUniversity of North Carolina at Chapel HillChapel Hill

Personalised recommendations