BRICS BRICS Dissertation SeriesISSN 1396-7002 DS-98-2 December 1998 Søren Bøgh Lassen Relational Reasoning about Functions and Nondeterminism Basic Research in Computer Science

BRICS DS-98-2 S. B. Lassen: Relational Reasoning about Functions and Nondeterminism Copyright c 1998, BRICS, Department of Computer Science University of Aarhus. All rights reserved.

Reproduction of all or part of this work is permitted for educational or research use on condition that this copyright notice is included in any copy.

See back inner page for a list of recent BRICS Dissertation Series publi- cations. Copies may be obtained by contacting:

BRICS Department of Computer Science University of Aarhus Ny Munkegade, building 540 DK–8000 Aarhus C Denmark Telephone: +45 8942 3360 Telefax: +45 8942 3255 Internet: [email protected]

BRICS publications are in general accessible through the World Wide Web and anonymous FTP through these URLs:

http://www.brics.dk ftp://ftp.brics.dk This document in subdirectory DS/98/2/ Relational Reasoning about Functions and Nondeterminism Søren Bøgh Lassen

Ph.D. Dissertation

Department of Computer Science University of Aarhus Denmark

Relational Reasoning about Functions and Nondeterminism

Dissertation presented to the Faculty of Science of the University of Aarhus in partial fulfillment of the requirements for the Ph.D. degree

by Søren Bøgh Lassen December 7, 1998

Abstract

This dissertation explores a uniform, relational proof style for operational arguments about program equivalences. It improves and facilitates many previously given proofs, and it is used to establish new proof rules for reasoning about term contexts, recursion, and nondeterminism in higher-order programming languages. Part I develops an algebra of relations on terms and exploits these relations in operational arguments about contextual equivalence for a typed deterministic functional language. Novel proofs of the basic laws, sequentiality and continuity properties, induction rules, and the CIU Theorem are presented together with new relational proof rules akin to Sangiorgi’s “bisimulation up to context” for process calculi. Part II extends the results from the first part to nondeterministic functional programs. May and must operational semantics and contextual equivalences are defined and their prop- erties are explored by means of relational techniques. For must contextual equivalence, the failure of ordinary syntactic ω-continuity in the presence of countable nondeterminism is ad- dressed by a novel transfinite syntactic continuity principle. The relational techniques are also applied to the study of lower and upper applicative simulation relations, yielding new results about their properties in the presence of countable and fair nondeterminism, and about their relationship with the contextual equivalences.

v Acknowledgments

I thank Peter Mosses for advice and support. I am also grateful to many others for discussions and valuable inputs to my work. In Aarhus, these included Olivier Danvy, Glynn Winskel, Jaap van Oosten, Torben Bra¨uner, Peter Ørbæk, and Ian Stark. Special thanks go to Andrew Gordon and Andrew Pitts for inviting me to Cambridge and for their inputs and guidance throughout the work that led to this dissertation. I also wish to thank Dave Sands, Luke Ong, Paritosh Pandya, Carolyn Talcott, and Dave Schmidt, whom I communicated with and met on various occasions around the world. Dave Sands and Carolyn Talcott also provided valuable feedback as my Ph.D. examiners. During the last phase of the work on Part II of the dissertation, I benefitted immensely from extended discussions with Corin Pitcher and Andrew Moran. I wish them luck with their dissertations. Last, but not least, I wish to thank my wife and children, Sharmila, Paul and Philip, for their incredible patience and support. We are grateful to Laju and Nitin for their help. I was supported by grants from Aarhus University Research Foundation and the Danish Nat