Functional programming with sets

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.

[1]  William F. Clocksin,et al.  Programming in Prolog , 1981, Springer Berlin Heidelberg.

[2]  Lee Naish All Solutions Predicates in Prolog , 1985, SLP.

[3]  H. Brown,et al.  Computational Problems in Abstract Algebra , 1971 .

[4]  D. A. Turner The semantic elegance of applicative languages , 1981, FPCA '81.

[5]  Alan Bundy,et al.  The Computer Modelling of Mathematical Reasoning , 1983 .

[6]  David A. Plaisted,et al.  Semantic Confluence Tests and Completion Methods , 1985, Inf. Control..

[7]  Gérard P. Huet,et al.  Confluent Reductions: Abstract Properties and Applications to Term Rewriting Systems , 1980, J. ACM.

[8]  Michael J. O'Donnell,et al.  Equational Logic as a Programming Language , 1985, Logic of Programs.

[9]  LEO BACHMAIR,et al.  Termination Orderings for Associative-Commutative Rewriting Systems , 1985, J. Symb. Comput..

[10]  Nachum Dershowitz,et al.  Orderings for term-rewriting systems , 1979, 20th Annual Symposium on Foundations of Computer Science (sfcs 1979).

[11]  Christoph M. Hoffmann,et al.  Programming with Equations , 1982, TOPL.

[12]  G. Huet,et al.  Equations and rewrite rules: a survey , 1980 .

[13]  Dennis F. Kibler,et al.  Parallel interpretation of logic programs , 1981, FPCA '81.

[14]  Nachum Dershowitz,et al.  Commutation, Transformation, and Termination , 1986, CADE.

[15]  D. Knuth,et al.  Simple Word Problems in Universal Algebras , 1983 .

[16]  Daniel P. Friedman,et al.  An indeterminate constructor for applicative programming , 1980, POPL '80.

[17]  Keith L. Clark,et al.  Negation as Failure , 1987, Logic and Data Bases.

[18]  Uday S. Reddy,et al.  Narrowing as the Operational Semantics of Functional Languages , 1985, SLP.

[19]  Nachum Dershowitz,et al.  Termination of Rewriting , 1987, J. Symb. Comput..

[20]  John Darlington,et al.  The Unification of Functional and Logic Languages , 1986, Logic Programming: Functions, Relations, and Equations.

[21]  Bharat Jayaraman,et al.  Equations, sets, and reduction semantics for functional and logic programming , 1986, LFP '86.

[22]  Paliath Narendran,et al.  Complexity of Matching Problems , 1985, J. Symb. Comput..

[23]  Gerard Huet,et al.  Conflunt reductions: Abstract properties and applications to term rewriting systems , 1977, 18th Annual Symposium on Foundations of Computer Science (sfcs 1977).

[24]  Jack Minker,et al.  Logic and Data Bases , 1978, Springer US.

[25]  Nachum Dershowitz,et al.  Logic Programming cum Applicative Programming , 1985, SLP.