Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Program equivalence in linear contexts

Published: 20 June 2015 Publication History

Abstract

Program equivalence in linear contexts, where programs are used or executed exactly once, is an important issue in programming languages. However, existing techniques like those based on bisimulations and logical relations only target at contextual equivalence in the usual (non-linear) functional languages, and fail in capturing non-trivial equivalent programs in linear contexts, particularly when non-determinism is present.We propose the notion of linear contextual equivalence to formally characterize such program equivalence, as well as a novel and general approach to studying it in higher-order languages, based on labeled transition systems specifically designed for functional languages. We show that linear contextual equivalence indeed coincides with trace equivalence. We illustrate our technique in both deterministic (a linear version of PCF) and non-deterministic (linear PCF in Moggi's framework) functional languages.

References

[1]
S. Abramsky, The Lazy Lambda Calculus. Research Topics in Functional Programming, Addison-Wesley, 1990.
[2]
S. Abramsky, G. McCusker, Call-by-value games, in: LNCS, vol. 1414, Springer, 1998.
[3]
A. Barber, Dual intuitionistic linear logic, University of Edinburgh, 1996.
[4]
M. Bundgaard, T. Hildebrandt, J.C. Godskesen, Typing linear and non-linear higher-order mobile embedded resources with local names, IT University of Copenhagen, 2007.
[5]
G.M. Bierman, Program equivalence in a linear functional language, J. Funct. Program., 10 (2000) 167-190.
[6]
G.M. Bierman, A.M. Pitts, C.V. Russo, Operational properties of Lily, a polymorphic linear lambda calculus with recursion, Electron. Notes Theor. Comput. Sci., 41 (2000) 70-88.
[7]
I. Cervesato, F. Pfenning, A linear logical framework, Inform. and Comput., 179 (2002) 19-75.
[8]
R.L. Crole, Completeness of bisimilarity for contextual equivalence in linear theories, Log. J. IGPL, 9 (2001) 27-51.
[9]
Xinyu Feng, Local rely-guarantee reasoning, in: Proc. of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 2009, pp. 315-327.
[10]
O. Goldreich, The Foundations of Cryptography: Basic Tools, Cambridge University Press, 2001.
[11]
O. Goldreich, The Foundations of Cryptography: Basic Applications, Cambridge University Press, 2004.
[12]
A.D. Gordon, A tutorial on co-induction and functional programming, in: Glasgow Workshop on Functional Programming, 1995, pp. 78-95.
[13]
J. Goubault-Larrecq, S. Lasota, D. Nowak, Logical relations for monadic types, Math. Struct. Comput. Sci., 18 (2008) 1169-1217.
[14]
C.A.R. Hoare, Communicating Sequential Processes, Prentice-Hall, 1985.
[15]
M. Hofmann, A type system for bounded space and functional in-place update, Nordic J. Comput., 7 (2000) 258-289.
[16]
M. Hofmann, Linear types and non-size increasing polynomial time computation, Inform. and Comput., 183 (2003) 57-85.
[17]
D.J. Howe, Proving congruence of bisimulation in functional programming languages, Inform. and Comput., 124 (1996) 103-112.
[18]
J.M.E. Hyland, C.H.L. Ong, On full abstraction for PCF: I, II, and III, Inform. and Comput., 163 (2000) 285-408.
[19]
A.S.A. Jeffrey, A fully abstract semantics for a non-deterministic functional language with monadic types, Theoret. Comput. Sci., 228 (1999) 105-150.
[20]
N. Kobayashi, B.C. Pierce, D.N. Turner, Linearity and the pi-calculus, ACM Trans. Program. Lang. Syst., 21 (1999) 914-947.
[21]
S. Lasota, D. Nowak, Y. Zhang, On completeness of logical relations for monadic types, in: LNCS, vol. 4435, Springer, 2008.
[22]
J.C. Mitchell, Foundations for Programming Languages, MIT Press, 1996.
[23]
E. Moggi, Notions of computation and monads, Inform. and Comput., 93 (1991) 55-92.
[24]
D. Nowak, Y. Zhang, A calculus for game-based security proofs, in: LNCS, vol. 6402, Springer, 2010.
[25]
A.M. Pitts, Operationally-Based Theories of Program Equivalence. Semantics and Logics of Computation, Cambridge University Press, 1997.
[26]
A.M. Pitts, Parametric polymorphism and operational equivalence, Math. Struct. Comput. Sci., 10 (2000) 321-359.
[27]
A.M. Pitts, Typed operational reasoning, in: Advanced Topics in Types and Programming Languages, The MIT Press, 2005.
[28]
G.D. Plotkin, LCF considered as a programming language, Theoret. Comput. Sci., 5 (1977) 223-255.
[29]
G.D. Plotkin, Lambda definability in the full type hierarchy, in: To H.B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, Academic Press, 1980.
[30]
G.D. Plotkin, Second order type theory and recursion, Notes for a talk at Scott Fest, 1993.
[31]
D. Sangiorgi, N. Kobayashi, E. Sumii, Environmental bisimulations for higher-order languages, ACM Trans. Program. Lang. Syst., 33 (2011) 5.
[32]
R. Statman, Logical relations and the typed lambda calculus, Inf. Control, 65 (1985) 85-97.
[33]
V. Vafeiadis, M. Parkinson, A marriage of rely/guarantee and separation logic, in: LNCS, vol. 4703, Springer, 2007.
[34]
D. Walker, K. Watkins, On regions and linear types, in: Proc. of the 6th ACM SIGPLAN International Conference on Functional Programming, ACM, 2001.
[35]
Q. Xu, W.P. de Roever, J. He, The rely-guarantee method for verifying shared variable concurrent programs, Form. Asp. Comput., 9 (1997) 149-174.
[36]
N. Yoshida, K. Honda, M. Berger, Linearity and bisimulation, J. Log. Algebr. Program., 72 (2007) 207-238.
[37]
Y. Zhang, The computational SLR: a logic for reasoning about computational indistinguishability, Math. Struct. Comput. Sci., 20 (2010) 951-975.

Cited By

View all
  • (2015)Metric reasoning about λ-termsProceedings of the 2015 30th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS)10.1109/LICS.2015.64(633-644)Online publication date: 6-Jul-2015

Recommendations

Reviews

Prahladavaradan Sampath

It is not too much of a stretch of the imagination to say that mathematics boils down to the study of the question: When are two terms equal__?__ (along with all of the consequences of the various answers to this question). These studies are motivated by various applications that require different variations on the notion of equality. Programming language semantics is no different, and the study of program equivalence is a central theme. The study of equivalence of programs is well established, and techniques such as applicative bisimulation and logical relations have a distinguished history. These techniques have found applications in the area of program analysis and verification. This paper studies a particular notion of program equivalence-linear contextual equivalence-motivated by applications in the area of language-based security, which the authors have also worked on. The authors have devised a notion of equivalence of programs where two programs are equivalent if they result in observationally equivalent programs when substituted in all possible linear contexts. Such programs are in some sense indistinguishable with respect to linear contexts. This extrinsic notion of contextual equivalence can be characterized in terms of certain intrinsic properties of programs-this is the crux of the technical development in the paper. This intrinsic characterization is provided by a transition relation imposed on programs, showing that trace equivalence with respect to this transition relation characterizes contextual equivalence. The techniques developed in this paper to characterize contextual equivalence are interesting in themselves and are not a straightforward consequence of techniques in the literature. They are tantalizingly similar, but there are some crucial differences-in this case, the novel concept of contextual transitions. One hopes for a follow-up work that compares and contrasts the menagerie of equivalences and techniques for studying them that are now available in the literature. Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Information & Contributors

Information

Published In

cover image Theoretical Computer Science
Theoretical Computer Science  Volume 585, Issue C
June 2015
140 pages

Publisher

Elsevier Science Publishers Ltd.

United Kingdom

Publication History

Published: 20 June 2015

Author Tags

  1. Contextual equivalence
  2. Linear PCF
  3. Non-determinism
  4. Trace equivalence

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 01 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2015)Metric reasoning about λ-termsProceedings of the 2015 30th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS)10.1109/LICS.2015.64(633-644)Online publication date: 6-Jul-2015

View Options

View options

Get Access

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media