skip to main content
research-article
Open access

Behavioural Equivalence via Modalities for Algebraic Effects

Published: 21 November 2019 Publication History

Abstract

The article investigates behavioural equivalence between programs in a call-by-value functional language extended with a signature of (algebraic) effect-triggering operations. Two programs are considered as being behaviourally equivalent if they enjoy the same behavioural properties. To formulate this, we define a logic whose formulas specify behavioural properties. A crucial ingredient is a collection of modalities expressing effect-specific aspects of behaviour. We give a general theory of such modalities. If two conditions, openness and decomposability, are satisfied by the modalities, then the logically specified behavioural equivalence coincides with a modality-defined notion of applicative bisimilarity, which can be proven to be a congruence by a generalisation of Howe’s method. We show that the openness and decomposability conditions hold for several examples of algebraic effects: nondeterminism, probabilistic choice, global store, and input/output.

References

[1]
Martin Abadi and Gordon Plotkin. 2009. A model of cooperative threads. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’09). ACM, New York, 29--40.
[2]
Samson Abramsky. 1990. The lazy lambda calculus. In Research Topics in Functional Programming, David A. Turner (Ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 65--116.
[3]
Samson Abramsky. 1991. Domain theory in logical form. Annals of Pure and Applied Logic 51, 1--2 (1991), 1--77.
[4]
Danel Ahman, Catalin Hritcu, Kenji Maillard, Guido Martínez, Gordon Plotkin, Jonathan Protzenko, Aseem Rastogi, and Nikhil Swamy. 2017. Dijkstra monads for free. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL’17). ACM, New York, 515--529.
[5]
Nick Benton, Martin Hofmann, and Vivek Nigam. 2014. Abstract effects and proof-relevant logical relations. In Proceedings of the 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’14), (San Diego, CA, January 20--21, 2014). ACM, New York, 619--632.
[6]
Sergey Goncharov and Lutz Schröder. 2013. A relatively complete generic Hoare logic for order-enriched effects. In Proceedings of the 28th Annual Symposium on Logic in Computer Science (LICS 2013). IEEE Computer Society, Washington, DC, 273--282.
[7]
Andrew D. Gordon and Gareth D. Rees. 1996. Bisimilarity for a first-order calculus of objects with subtyping. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’96). ACM, New York, 386--395.
[8]
Ichiro Hasuo. 2015. Generic weakest precondition semantics from monads enriched with order. Theoretical Computer Science 604 (2015), 2--29.
[9]
Matthew Hennessy and Robin Milner. 1985. Algebraic laws for nondeterminism and concurrency. Journal of the ACM (JACM) 32, 1 (1985), 137--161.
[10]
Martin Hofmann. 2015. Logical relations and nondeterminism. In Software, Services, and Systems. Lecture Notes in Computer Science, Rocco De Nicola and Rolf Hennicker (Eds.). Vol. 8950. Springer International Publishing, Cham, 62--74.
[11]
Douglas J. Howe. 1989. Equality in lazy computation systems. In Proceedings of the 4th Annual Symposium on Logic in Computer Science. IEEE Press, Piscataway, NJ, 198--203.
[12]
Douglas J. Howe. 1996. Proving congruence of bisimulation in functional programming languages. Information and Computation 124, 2 (1996), 103--112.
[13]
Bart Jacobs. 2016. Introduction to Coalgebra: Towards Mathematics of States and Observation. Cambridge University Press, Cambridge, UK.
[14]
Patricia Johann, Alex Simpson, and Janis Voigtländer. 2010. A generic operational metatheory for algebraic effects. In Proceedings of the 2010 25th Annual IEEE Symposium on Logic in Computer Science (LICS’10). IEEE Computer Society, Washington, DC, 209--218.
[15]
Shin-ya Katsumata. 2011. Relating computational effects by TT-lifting. In Automata, Languages and Programming, Luca Aceto, Monika Henzinger, and Jiří Sgall (Eds.). Springer Berlin, Berlin, 174--185.
[16]
Vasileios Koutavas, Paul Blain Levy, and Eijiro Sumii. 2011. From applicative to environmental bisimulation. Electronic Notes in Theoretical Computer Science 276 (2011), 215--235. (Twenty-seventh Conference on the Mathematical Foundations of Programming Semantics (MFPS XXVII)).
[17]
Ugo Dal Lago, Francesco Gavazzo, and Paul Blain Levy. 2017. Effectful applicative bisimilarity: Monads, relators, and Howe’s method. In Ptoceedings of the 32nd Annual ACM/IEEE Symposium on Logic in Computer Science, (LICS 2017), (Reykjavik, Iceland, June 20--23, 2017). IEEE Computer Society, Washington, DC, 1--12.
[18]
Søren Bøgh Lassen. 1998. Relational reasoning about contexts. In Higher Order Operational Techniques in Semantics, Andrew D. Gordon and Andrew M. Pitts (Eds.). Cambridge University Press, New York, 91--136. http://dl.acm.org/citation.cfm?id=309656.309665
[19]
Søren Bøgh Lassen. 1998. Relational Reasoning about Functions and Nondeterminism. Ph.D Dissertation. BRICS.
[20]
Paul Blain Levy. 2006. Call-by-push-value: Decomposing call-by-value and call-by-name. Higher-Order and Symbolic Computation 19, 4 (2006), 377--414.
[21]
Paul Blain Levy. 2011. Similarity quotients as final coalgebras. Lecture Notes in Computer Science, vol. 6604. Springer, Berlin, 27--41.
[22]
Paul Blain Levy, John Power, and Hayo Thielecke. 2003. Modelling environments in call-by-value programming languages. Information and Computation 185, 2 (2003), 182--210.
[23]
Aliaume Lopez and Alex Simpson. 2018. Basic operational preorders for algebraic effects in general, and for combined probability and nondeterminism in particular. In Proceedings of the 27th EACSL Annual Conference on Computer Science Logic (CSL 2018) (Leibniz International Proceedings in Informatics (LIPIcs)), Dan Ghica and Achim Jung (Eds.), Vol. 119. Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 29:1--29:17.
[24]
Kenji Maillard, Danel Ahman, Robert Atkey, Guido Mart�nez, Catalin Hritcu, Exequiel Rivas, and �ric Tanter. 2019. Dijkstra monads for all. In Proceedings of the 24th ACM SIGPLAN International Conference on Functional Programming (ICFP). ACM, New York. https://arxiv.org/abs/1903.01237.
[25]
Gregory Malecha, Greg Morrisett, and Ryan Wisnesky. 2011. Trace-based verification of imperative programs with I/O. J. Symb. Comput. 46, 2 (Feb. 2011), 95--118.
[26]
Robin Milner. 1982. A Calculus of Communicating Systems. Springer-Verlag New York, Inc., Secaucus, NJ.
[27]
Eugenio Moggi. 1991. Notions of computation and monads. Information and Computation 93, 1 (1991), 55--92.
[28]
Till Mossakowski, Lutz Schr�der, and Sergey Goncharov. 2010. A generic complete dynamic logic for reasoning about purity and effects. Formal Aspects of Computing 22, 3--4 (2010), 363--384.
[29]
Aleksandar Nanevski, J. Gregory Morrisett, and Lars Birkedal. 2008. Hoare type theory, polymorphism and separation. J. Funct. Program. 18 (2008), 865--911.
[30]
C.-H. Luke Ong. 1993. Non-determinism in a functional setting. In Symposium on Logic in Computer Science, Montreal, Ont., Canada. 8 (1993), 275--286.
[31]
David Park. 1981. Concurrency and automata on infinite sequences. Lecture Notes in Computer Science, vol. 154. Springer, Berlin, 561--572.
[32]
Willem Penninckx, Bart Jacobs, and Frank Piessens. 2015. Sound, modular and compositional verification of the input/output behavior of programs. In Programming Languages and Systems, Jan Vitek (Ed.). Springer Berlin, Berlin, 158--182.
[33]
Andrew Pitts. 1991. Evaluation logic. In Proceedings of 4th Higher Order Workshop. Springer London, London, 162--189.
[34]
Andrew M. Pitts. 2000. Parametric polymorphism and operational equivalence. Mathematical Structures in Computer Science 10, 3 (June 2000), 321--359.
[35]
A. M. Pitts. 2005. Typed operational reasoning. In Advanced Topics in Types and Programming Languages, B. C. Pierce (Ed.). The MIT Press, London, UK, Chapter 7, 245--289.
[36]
Gordon Plotkin. 1977. LCF considered as a programming language. Theoretical Computer Science 5, 3 (1977), 223--255.
[37]
Gordon Plotkin. 2009. Adequacy for infinitary algebraic effects. In Proceedings of the 3rd International Conference on Algebra and Coalgebra in Computer Science (CALCO’09). Springer-Verlag, Berlin, 1--2. http://dl.acm.org/citation.cfm?id=1812941.1812943
[38]
Gordon Plotkin and John Power. 2001. Adequacy for algebraic effects. In Foundations of Software Science and Computation Structures. Springer Berlin, Berlin, 1--24.
[39]
Gordon Plotkin and John Power. 2002. Notions of computation determine monads. In Proceedings of the 5th International Conference on Foundations of Software Science and Computation Structures. Springer-Verlag, London, UK, 342--356.
[40]
Gordon Plotkin and Matija Pretnar. 2008. A logic for algebraic effects. In Proceedings of Logic in Computer Science. IEEE Computer Society, Washington, DC, 118--129.
[41]
Gordon D. Plotkin and Matija Pretnar. 2013. Handling algebraic effects. Logical Methods in Computer Science 9, 4 (2013), 1--36.
[42]
Amir Pnueli. 1977. The temporal logic of programs. In Proceedings of the 18th Annual Symposium on the Foundations of Computer Science. IEEE Computer Society, Washington, DC, 46--57.
[43]
Davide Sangiorgi. 2011. Introduction to Bisimulation and Coinduction. Cambridge University Press, Cambridge, UK.
[44]
Davide Sangiorgi, Naoki Kobayashi, and Eijiro Sumii. 2011. Environmental bisimulations for higher-order languages. ACM Trans. Program. Lang. Syst. 33, 1, Article 5 (Jan. 2011), 69 pages.
[45]
Davide Sangiorgi and Jan Rutten (Eds.). 2011. Advanced Topics in Bisimulation and Coinduction. Cambridge University Press, Cambridge, UK.
[46]
Alex Simpson and Niels Voorneveld. 2018. Behavioural equivalence via modalities for algebraic effects. In Programming Languages and Systems. Springer International Publishing, Cham, 300--326.
[47]
Nikhil Swamy, Catalin Hritcu, Chantal Keller, Aseem Rastogi, Antoine Delignat-Lavaud, Simon Forest, Karthikeyan Bhargavan, C�dric Fournet, Pierre-Yves Strub, Markulf Kohlweiss, Jean-Karim Zinzindohou�, and Santiago Zanella-B�guelin. 2016. Dependent types and multi-monadic effects in F*. In Proceedings of the 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, New York, 256--270. https://www.fstar-lang.org/papers/mumon/.
[48]
Nikhil Swamy, Joel Weinberger, Cole Schlesinger, Juan Chen, and Benjamin Livshits. 2013. Verifying higher-order programs with the dijkstra monad. SIGPLAN Notes 48, 6 (June 2013), 387--398.
[49]
Albert Marchienus Thijs. 1996. Simulation and fixpoint semantics. Ph.D Dissertation. Rijksuniversiteit Groningen.
[50]
Rob van Glabbeek and Gordon Plotkin. 2010. On CSP and the Algebraic Theory of Effects. Springer London, London, 333--369.
[51]
Niels Voorneveld. 2019. Quantitative logics for equivalence of effectful programs. In Proceedings of the 35th Conference on Mathematical Foundations of Progamming Semantics, (MFPS XXXV).

Cited By

View all
  • (2024)Monadic Intersection Types, RelationallyProgramming Languages and Systems10.1007/978-3-031-57262-3_2(22-51)Online publication date: 6-Apr-2024
  • (2023)A frame stack semantics for sequential Core ErlangProceedings of the 35th Symposium on Implementation and Application of Functional Languages10.1145/3652561.3652566(1-13)Online publication date: 29-Aug-2023
  • (2023)Program equivalence in an untyped, call-by-value functional language with uncurried functionsJournal of Logical and Algebraic Methods in Programming10.1016/j.jlamp.2023.100857132(100857)Online publication date: Apr-2023
  • Show More Cited By

Index Terms

  1. Behavioural Equivalence via Modalities for Algebraic Effects

        Recommendations

        Comments

        Information & Contributors

        Information

        Published In

        cover image ACM Transactions on Programming Languages and Systems
        ACM Transactions on Programming Languages and Systems  Volume 42, Issue 1
        Special Issue on ESOP 2018
        March 2020
        215 pages
        ISSN:0164-0925
        EISSN:1558-4593
        DOI:10.1145/3373084
        Issue’s Table of Contents
        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        Published: 21 November 2019
        Accepted: 01 July 2019
        Revised: 01 July 2019
        Received: 01 May 2018
        Published in TOPLAS Volume 42, Issue 1

        Permissions

        Request permissions for this article.

        Check for updates

        Author Tags

        1. Howe’s method
        2. Program equivalence
        3. algebraic effects
        4. applicative bisimilarity
        5. behavioural logic
        6. call-by-value
        7. functional programming
        8. modalities

        Qualifiers

        • Research-article
        • Research
        • Refereed

        Funding Sources

        • Air Force Office of Scientific Research
        • Slovenian Research Agency
        • European Union's Horizon 2020 research and innovation programme
        • Marie Skłodowska-Curie

        Contributors

        Other Metrics

        Bibliometrics & Citations

        Bibliometrics

        Article Metrics

        • Downloads (Last 12 months)250
        • Downloads (Last 6 weeks)42
        Reflects downloads up to 22 Oct 2024

        Other Metrics

        Citations

        Cited By

        View all
        • (2024)Monadic Intersection Types, RelationallyProgramming Languages and Systems10.1007/978-3-031-57262-3_2(22-51)Online publication date: 6-Apr-2024
        • (2023)A frame stack semantics for sequential Core ErlangProceedings of the 35th Symposium on Implementation and Application of Functional Languages10.1145/3652561.3652566(1-13)Online publication date: 29-Aug-2023
        • (2023)Program equivalence in an untyped, call-by-value functional language with uncurried functionsJournal of Logical and Algebraic Methods in Programming10.1016/j.jlamp.2023.100857132(100857)Online publication date: Apr-2023
        • (2022)A relational theory of effects and coeffectsProceedings of the ACM on Programming Languages10.1145/34986926:POPL(1-28)Online publication date: 12-Jan-2022
        • (2022)Bounded complete domains and their logical formInformation and Computation10.1016/j.ic.2022.104958289(104958)Online publication date: Nov-2022
        • (2022)Runners for Interleaving Algebraic EffectsTheoretical Aspects of Computing – ICTAC 202210.1007/978-3-031-17715-6_26(407-424)Online publication date: 27-Sep-2022
        • (2022)Streams of Approximations, Equivalence of Recursive Effectful ProgramsMathematics of Program Construction10.1007/978-3-031-16912-0_8(198-221)Online publication date: 26-Sep-2022
        • (2021)Inductive and Coinductive Predicate Liftings for Effectful ProgramsElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.351.16351(260-277)Online publication date: 29-Dec-2021
        • (2020)From Equations to Distinctions: Two Interpretations of Effectful ComputationsElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.317.1317(1-17)Online publication date: 1-May-2020
        • (2020)Combining Algebraic Effect Descriptions Using the Tensor of Complete LatticesElectronic Notes in Theoretical Computer Science10.1016/j.entcs.2020.09.013352(257-281)Online publication date: Oct-2020
        • Show More Cited By

        View Options

        View options

        PDF

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader

        HTML Format

        View this article in HTML Format.

        HTML Format

        Get Access

        Login options

        Full Access

        Media

        Figures

        Other

        Tables

        Share

        Share

        Share this Publication link

        Share on social media