Operational reasoning for functions with local state

Languages such as ML or Lisp permit the use of recursively defined function expressions with locally declared storage locations. Although this can be very convenient from a programming point of view it severely complicates the properties of program equivalence even for relatively simple fragments of such languages—such as the simply typed fragment of Standard ML with integer-valued references considered here. This paper presents a method for reasoning about contextual equivalence of programs involving this combination of functional and procedural features. The method is based upon the use of a certain kind of logical relation parameterised by relations between program states. The form of this logical relation is novel, in as much as it involves relations not only between program expressions, but also between program continuations (also known as evaluation contexts). The authors found this approach necessary in order to establish the ‘Fundamental Property of logical relations’ in the presence of both dynamically allocated local state and recursion. The logical relation characterises contextual equivalence and yields a proof of the best known context lemma for this kind of language— the Mason-Talcott ‘ciu’ theorem. Moreover, it is shown that the method can prove examples where such a context lemma is not much help and which involve representation independence, higher order memoising functions, and profiling functions.

[1]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[2]  Ian A. Mason The Semantics of Destructive LISP , 1986 .

[3]  Matthias Felleisen,et al.  Control operators, the SECD-machine, and the λ-calculus , 1987, Formal Description of Programming Concepts.

[4]  John Hughes,et al.  Why Functional Programming Matters , 1989, Comput. J..

[5]  李幼升,et al.  Ph , 1989 .

[6]  Robin Milner,et al.  Definition of standard ML , 1990 .

[7]  Robert Harper,et al.  Typing first-class continuations in ML , 1991, POPL '91.

[8]  Carolyn L. Talcott,et al.  1 Equivalence in Functional Languages with E ectsIan , 2007 .

[9]  Carolyn L. Talcott,et al.  Program transformations for configuring components , 1991, PEPM '91.

[10]  Lawrence C. Paulson,et al.  ML for the working programmer , 1991 .

[11]  Carolyn L. Talcott,et al.  Inferring the Equivalence of Functional Programs That Mutate Data , 1992, Theor. Comput. Sci..

[12]  Carolyn L. Talcott,et al.  References, local variables and operational reasoning , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

[13]  Andrew M. Pitts,et al.  Observable Properties of Higher Order Functions that Dynamically Create Local Names, or What's new? , 1993, MFCS.

[14]  Peter W. O'Hearn,et al.  Relational parametricity and local variables , 1993, POPL '93.

[15]  Andrew M. Pitts,et al.  Computational Adequacy via "Mixed" Inductive Definitions , 1993, MFPS.

[16]  Ian David Bede Stark,et al.  Names and higher-order functions , 1994 .

[17]  Kurt Sieber,et al.  Full Abstraction for the Second Order Subset of an Algol-Like Language , 1996, Theor. Comput. Sci..

[18]  Peter W. O'Hearn,et al.  Parametricity and local variables , 1995, JACM.

[19]  Carolyn L. Talcott,et al.  A Variable Typed Logic of Effects , 1995, Inf. Comput..

[20]  Andrew M. Pitts Reasoning about local variables with operationally-based logical relations , 1996, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[21]  Kurt Sieber Full Abstraction for the Second Order Subset of an Algol-Like Language , 1996, Theor. Comput. Sci..

[22]  Carolyn L. Talcott,et al.  From Operational Semantics to Domain Theory , 1996, Inf. Comput..

[23]  Robert Harper,et al.  A Type-Theoretic Account of Standard ML 1996 (Version 1). , 1996 .

[24]  Andrew M. Pitts,et al.  Relational Properties of Domains , 1996, Inf. Comput..

[25]  John C. Reynolds,et al.  The essence of ALGOL , 1997 .

[26]  John C. Reynolds,et al.  Idealized ALGOL and its specification logic , 1997 .

[27]  Lars Birkedal,et al.  Relational Interpretations of Recursive Types in an operational Setting (Summary) , 1997, TACS.

[28]  C. Talcott,et al.  Reasoning about functions with effects , 1999 .

[29]  Peter W. O'Hearn,et al.  From Algol to polymorphic linear lambda-calculus , 2000, JACM.