Abstract
We study issues that arise in programming with primitive recursion over non-free datatypes such as lists, bags and sets. Programs written in this style can lack a meaning in the sense that their outputs may be sensitive to the choice of input expression. We are, thus, naturally lead to a set-theoretic denotational semantics with partial functions. We set up a logic for reasoning about the definedness of terms and a deterministic and terminating evaluator. The logic is shown to be sound in the model, and its recursion free fragment is shown to be complete for proving definedness of recursion free programs. The logic is then shown to be as strong as the evaluator, and this implies that the evaluator is compatible with the provable equivalence between different set (or bag, or list) expression . Oftentimes,the same non-free datatype may have different presentations, and it is not clear a priori whether programming and reasoning with the two presentations are equivalent. We formulate these questions, precisely, in the context of alternative presentations of the list, bag, and set datatypes and study some aspects of these questions. In particular, we establish back-and-forth translations between the two presentations, from which it follows that they are equally expressive, and prove results relating proofs of program properties, in the two presentations.
The authors are partially supported by ONR Grant NOOO14-88-K-0634, by NSF Grant CCR-90-57570, and by an IBM Graduate Fellowship.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
M.P. Atkinson and O.P. Buneman. Types and Persistence in Database Programming Languages. ACM Computing Surveys, June 1987.
J. Backus. Can Programming Be Liberated from the von Neumann style? A Functional Style and its Algebra of Programs. Communications of the ACM, 21:613–641, august 1978.
H. P. Barendregt. The Lambda Calculus: Its Syntax and Semantics. Volume 103 of Studies in Logic and the Foundations of Mathematics, North-Holland, Amsterdam, second edition, 1984.
R. Bird and P. Wadler. Introduction to Functional Programming. Series in Computer Science, Prentice Hall International, 1988.
[Breazu-Tannen et al., 1991] V. Breazu-Tannen, P. Buneman, and S. Naqvi. Structural Recursion as a Query Language. Unpublished Manuscript, University of Pennsylvania. 1991.
P. Buneman, A. Jung, and A. Ohori. Using Powerdomains to Generalize Relational Databases. Theoretical Computer Science, august 1989.
E. F. Codd. A Relational Model For Large Shared Databank. Communications of the ACM, 13(6):377–387, 1970.
J. Y. Girard, Y. Lafont, and P. Taylor. Typed Lambda Calculus. Cambridge University Press, 1989.
C. A. Gunter. Sets and the semantics of bounded non-determinism. Unpublished manuscript, University of Cambridge. 1986.
E. Moggi. Categories of Partial Morphisms and the λ p -calculus. In Proceedings of the Category Theory and Computer Programming, Springer-Verlag, 1985.
A. Ohori, P. Buneman, and V. Breazu-Tannen. Database Programming in Machiavelli — a Polymorphic Language with Static Type Inference. In Proceedings of the ACM SIGMOD conference, pages 46–57, May–June 1989.
J.W. Schmidt. Some High Level Language Constructs for Data of Type Relation. ACM Transactions on Database Systems, 2(3):247–261, september 1977.
J. T. Schwartz, R. B. K. Dewar, E. Dubinsky, and E. Schonberg. Programming with Sets: An Introduction to SETL. Springer-Verlag, New York, 1986.
P. Wadler. Views: A Way For Pattern Matching to Cohabit with Data Abstraction. In Proceedings of the Conference on the Principles of Programming Languages, pages 307–313, 1987.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1991 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Breazu-Tannen, V., Subrahmanyam, R. (1991). Logical and computational aspects of programming with sets/bags/lists. In: Albert, J.L., Monien, B., Artalejo, M.R. (eds) Automata, Languages and Programming. ICALP 1991. Lecture Notes in Computer Science, vol 510. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-54233-7_125
Download citation
DOI: https://doi.org/10.1007/3-540-54233-7_125
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-54233-9
Online ISBN: 978-3-540-47516-3
eBook Packages: Springer Book Archive