# An abstract interpretation for ML equality kinds

## Abstract

The definition of Standard ML provides a form of generic equality which is inferred for certain types, called *equality types*, on which it is possible to define a computable equality relation. However, the standard definition is incomplete in the sense that there are interesting and useful types which are *not* inferred to be equality types but which nevertheless have a computable equality relation. In this paper, a refinement of the Standard ML system of equality types is introduced and is proven sound and *complete* with respect to the existence of a computable equality. The technique used here is based on an abstract interpretation of ML operators as monotone functions over a three point lattice. It is shown how the equality relation can be defined (as an ML program) from the definition of a type with our equality property. Finally, a sound, efficient algorithm for inferring the equality property which corrects the limitations of the standard definition in all cases of practical interest is demonstrated.

## Preview

Unable to display preview. Download preview PDF.

## References

- [BGS89]V. Breazu-Tannen, C. Gunter, and A. Scedrov.
*Denotational Semantics for Subtyping between Recursive Types*. Research Report MS-CIS-89-63/Logic & Computation 12, Department of Computer and Information Science, University of Pennsylvania, 1989.Google Scholar - [GS90]C. A. Gunter and D. S. Scott. Semantic domains. In J. van Leeuwen, editor,
*Handbook of Theoretical Computer Science*, pages 633–674, North Holland, 1990.Google Scholar - [MT91]R. Milner and M. Tofte.
*Commentary on Standard ML*. MIT Press, 1991.Google Scholar - [MTH90]R. Milner, M. Tofte, and R. Harper.
*The Definition of Standard ML*. MIT Press, 1990.Google Scholar - [Sco76]D. S. Scott. Data types as lattices.
*SIAM Journal of Computing*, 5:522–587, 1976.CrossRefGoogle Scholar - [Sco82a]D. S. Scott. Domains for denotational semantics. In M. Nielsen and E. M. Schmidt, editors,
*International Colloquium on Automata, Languages and Programs*, pages 577–613,*Lecture Notes in Computer Science vol. 140*, Springer, 1982.Google Scholar - [Sco82b]D. S. Scott. Lectures on a mathematical theory of computation. In M. Broy and G. Schmidt, editors,
*Theoretical Foundations of Programming Methodology*, pages 145–292,*NATO Advanced Study Institutes Series*, D. Reidel, 1982.Google Scholar - [SP82]M. Smyth and G. D. Plotkin. The category-theoretic solution of recursive domain equations.
*SIAM Journal of Computing*, 11:761–783, 1982.CrossRefGoogle Scholar