skip to main content

A computational interpretation of compact closed categories: reversible programming with negative and fractional types

Published:04 January 2021Publication History
Skip Abstract Section

Abstract

Compact closed categories include objects representing higher-order functions and are well-established as models of linear logic, concurrency, and quantum computing. We show that it is possible to construct such compact closed categories for conventional sum and product types by defining a dual to sum types, a negative type, and a dual to product types, a fractional type. Inspired by the categorical semantics, we define a sound operational semantics for negative and fractional types in which a negative type represents a computational effect that ``reverses execution flow'' and a fractional type represents a computational effect that ``garbage collects'' particular values or throws exceptions.

Specifically, we extend a first-order reversible language of type isomorphisms with negative and fractional types, specify an operational semantics for each extension, and prove that each extension forms a compact closed category. We furthermore show that both operational semantics can be merged using the standard combination of backtracking and exceptions resulting in a smooth interoperability of negative and fractional types. We illustrate the expressiveness of this combination by writing a reversible SAT solver that uses backtracking search along freshly allocated and de-allocated locations. The operational semantics, most of its meta-theoretic properties, and all examples are formalized in a supplementary Agda package.

References

  1. Samson Abramsky. 2005. A structural approach to reversible computatTheoior. nC. omput. Sci. 347 ( December 2005 ), 441-464. Issue 3.Google ScholarGoogle Scholar
  2. S. Abramsky and B. Coecke. 2004. A categorical semantics of quantum protocoPlrso. cIenedings of the 19th Annual IEEE Symposium on Logic in Computer Science, 200441. 5-425.Google ScholarGoogle Scholar
  3. Samson Abramsky, Simon Gay, and Rajagopal Nagarajan. 1996. Interaction Categories and the Foundations of Typed Concurrent Programming. InProceedings of the NATO Advanced Study Institute on Deductive Program De (Msiganrktoberdorf, Germany). Springer-Verlag, Berlin, Heidelberg, 35-113.Google ScholarGoogle Scholar
  4. S. Abramsky, E. Haghverdi, and P. Scot. 2002. Geometry of interaction and linear combinatory algeMbaraths. ematical Structures in Computer Scienc1e2, 5 ( 2002 ).Google ScholarGoogle Scholar
  5. Samson Abramsky and Radha Jagadeesan. 1994. New foundations for the geometry of interInacf.tCionm.put. 111 (May 1994 ), 53-119. Issue 1.Google ScholarGoogle Scholar
  6. Bogdan Aman, Gabriel Ciobanu, Robert Glück, Robin Kaarsgaard, Jarkko Kari, Martin Kutrib, Ivan Lanese, Claudio Antares Mezzina, Łukasz Mikulski, Rajagopal Nagarajan, Iain Phillips, G. Michele Pinna, Luca Prigioniero, Irek Ulidowski, and Germán Vidal. 2020. Foundations of Reversible Computati.onSpringer International Publishing, Cham, 1-4h0.ttps: //doi.org/10.1007/978-3-030-47361-7_1Google ScholarGoogle Scholar
  7. Zena M. Ariola, Hugo Herbelin, and Amr Sabry. 2009. A type-theoretic foundation of delimited continHuiaghteiorns. Order Symbol. Comput. 22 ( September 2009 ), 233-273. Issue 3.Google ScholarGoogle Scholar
  8. Jean Bénabou. 1963. Catégories avec multiplicatCi o.nR. de l' Académie des Sciences de Paris256, 9 ( 1963 ), 1887-1890.Google ScholarGoogle Scholar
  9. Jean Bénabou. 1964. Algèbre élémentaire dans les catégories avec multipliCca. Rt.ioAnc.ad. Sci. Paris258, 9 ( 1964 ), 771-774.Google ScholarGoogle Scholar
  10. C. H. Bennet. 1973. Logical reversibility of computatioIBnM. J. Res. Dev. 17 (November 1973 ), 525-532. Issue 6.Google ScholarGoogle Scholar
  11. Charles H. Bennet. 1989. Time/Space Trade-Ofs for Reversible Computation. SIAM J. Comput.18, 4 ( 1989 ), 766-776. https://doi.org/10.1137/0218053 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. Blass. 1995. Seven trees in oneJo. urnal of Pure and Applied Algebra103, 1-21 ( 1995 ).Google ScholarGoogle Scholar
  13. William J. Bowman, Roshan P. James, and Amr Sabry. 2011. Dagger Traced Symmetric Monoidal Categories and Reversible Programming. InRC 2011.Google ScholarGoogle Scholar
  14. Jacques Carete and Amr Sabry. 2016. Computing with Semirings and Weak Rig Groupoids. EInSOP (Lecture Notes in Computer Science, Vol. 9632.)Springer, 123-148.Google ScholarGoogle ScholarCross RefCross Ref
  15. Siu Man Chan. 2013P.ebble Games and Complexit y.Ph.D. Dissertation. EECS Department, University of California, Berkeley. http://www2.eecs.berkeley.edu/Pubs/TechRpts/2013/EECS-2013-145.htmlGoogle ScholarGoogle Scholar
  16. Chao-Hong Chen, Vikraman Choudhury, Jacques Carete, and Amr Sabry. 2020. Fractional TypeRs.eIvnersible Computatio, n Ivan Lanese and Mariusz Rawski (Eds.). Springer International Publishing, Cham, 169-186.Google ScholarGoogle Scholar
  17. Stephen Clark, Bob Coecke, and Mehrnoosh Sadrzadeh. 2008. A Compositional Distributional Model of MPreoacneeind-g. ings of the Second Symposium on Quantum Interaction (QI-2008 () 2008 ), 133-140.Google ScholarGoogle Scholar
  18. Tristan Crolard. 2001. Subtractive lo gTheiocr. etical Computer Science 254, 1-2 ( 2001 ), 151-185. https://doi.org/10.1016/ S0304-3975 ( 99 ) 00124-3 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Tristan Crolard. 2004. A Formulae-as-Types Interpretation of Subtractive JLoougrinca. l of Logic and Computatio1n4, 4 ( 2004 ), 529-570.Google ScholarGoogle Scholar
  20. Pierre-Louis Curien and Hugo Herbelin. 2000. The Duality of Computation.PIrnoceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP. 'A0s0s)ociation for Computing Machinery, New York, NY, USA, 233-243. https://doi.org/10.1145/351240.351262 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Andrzej Filinski. 1989. Declarative Continuations: an Investigation of Duality in Programming Language Semantics. In Category Theory and Computer Science.Google ScholarGoogle Scholar
  22. Andrzej Filinski. 1992. Linear ContinuationsP.rIonceedings of the 19th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages(Albuquerque, New Mexico, USA() POPL '92). Association for Computing Machinery, New York, NY, USA, 27-38. https://doi.org/10.1145/143165.143174 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Marcelo Fiore. 2004. Isomorphisms of Generic Recursive Polynomial Types. PrInoceedings of the 31st ACM SIGPLANSIGACT Symposium on Principles of Programming Language(sVenice, Italy()POPL '04). Association for Computing Machinery, New York, NY, USA, 77-88. https://doi.org/10.1145/964001.964008 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Marcelo Fiore. 2015. An Axiomatics and a Combinatorial Model of Creation/Annihilation Operatoras. rX(2i0v1:155). 06. 06402[math.CT].Google ScholarGoogle Scholar
  25. M. P. Fiore, R. Di Cosmo, and V. Balat. 2006. Remarks on Isomorphisms in Typed Calculi with Empty and Sum Types. Annals of Pure and Applied Logic141, 1-2 ( 2006 ), 35-50.Google ScholarGoogle Scholar
  26. E. Fredkin and T. Tofoli. 1982. Conservative logiIcn. ternational Journal of Theoretical Physics21, 3 ( 1982 ), 219-253.Google ScholarGoogle Scholar
  27. J.Y. Girard. 1989. Geometry of interaction 1: Interpretation of SystSteumdFie.s in Logic and the Foundations of Mathematics 127 ( 1989 ), 221-260.Google ScholarGoogle Scholar
  28. Robert Glück and Robin Kaarsgaard. 2018. A Categorical Foundation for Structured Reversible Flowchart Languages. Electronic Notes in Theoretical Computer Scienc3e36 ( 2018 ), 155-171. https://doi.org/10.1016/j.entcs. 2018. 03. 02The1 hTirty-third Conference on the Mathematical Foundations of Programming Semantics (MFPS XXXIII).Google ScholarGoogle Scholar
  29. Alexander S. Green, Peter LeFanu Lumsdaine, Neil J. Ross, Peter Selinger, and Benoît Valiron. 2013. Quipper: A Scalable uQantum Programming Language. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (Seatle, Washington, USA)( PLDI '13). ACM, New York, NY, USA, 333-342.Google ScholarGoogle Scholar
  30. Chris Heunen, Robin Kaarsgaard, and Marti Karvonen. 2018. Reversible Efects as Inverse ArrowEsl. ectronic Notes in hTeoretical Computer Science 341 ( 2018 ), 179-199. https://doi.org/10.1016/j.entcs. 2018. 11. 00P9roceedings of the ThirtyFourth Conference on the Mathematical Foundations of Programming Semantics (MFPS XXXIV).Google ScholarGoogle Scholar
  31. Chris Heunen and Marti Karvonen. 2015. Reversible Monadic ComputinEgle. ctronic Notes in Theoretical Computer Science 319 ( 2015 ), 217-237. https://doi.org/10.1016/j.entcs. 2015. 12. 01The431st Conference on the Mathematical Foundations of Programming Semantics (MFPS XXXI).Google ScholarGoogle Scholar
  32. Christiaan Heunen and Jamie Vicary. 201C9a. tegories for quantum theory: an introduct.iOoxnford University Press, United Kingdom.Google ScholarGoogle Scholar
  33. Furio Honsell and Marina Lenisa. 2004. “ Wave-Style” Geometry of Interaction Models in Rel Are Graph-Like LambdaModels. InTypes for Proofs and Program ,sStefano Berardi, Mario Coppo, and Ferruccio Damiani (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 242-258.Google ScholarGoogle Scholar
  34. Jason Z.S. Hu and Jacques Carete. 2020. Proof-relevant Category Theory in Agda. (2020h).ttps://arxiv.org/abs/ 2005.0705.9Google ScholarGoogle Scholar
  35. Roshan P. James and Amr Sabry. 2012a. Information Efects. IPnroceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Language(sPhiladelphia, PA, USA() POPL '12). Association for Computing Machinery, New York, NY, USA, 73-84. https://doi.org/10.1145/2103656.2103667 Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Roshan P. James and Amr Sabry. 2012b. The Two Dualities of Computation : Negative and Fractional Typ. esTechnical Report. Indiana University.Google ScholarGoogle Scholar
  37. Roshan P James and Amr Sabry. 2014. Theseus: A high level language for reversible computingW. Ionrk-in-progress report in the Conference on Reversible Computat.ionGoogle ScholarGoogle Scholar
  38. Roshan P James, Zachary Sparks, Jacques Carete, and Amr Sabry. 2013. Fractional types. ( 2013 ).Google ScholarGoogle Scholar
  39. A. Joyal, R. Street, and D. Verity. 1996. Traced monoidal categorieMsa. tInhematical Proceedings of the Cambridge Philosophical Societ.yCambridge Univ Press.Google ScholarGoogle Scholar
  40. Robin Kaarsgaard and Niccolò Veltri. 2019. En Garde! Unguarded Iteration for Reversible Computation in the Delay Monad. Lecture Notes in Computer Scien(c2e019), 366-384. https://doi.org/10.1007/978-3-030-33636-3_13 Google ScholarGoogle ScholarCross RefCross Ref
  41. J. Kastl. 1979. Inverse CategorieSst.udien zur Algebra und ihre Anwendungen7 ( 1979 ), 51-60.Google ScholarGoogle Scholar
  42. G.M. Kelly and M.L. Laplaza. 1980. Coherence for compact closed categJooruiersn. al of Pure and Applied Algebra19 ( 1980 ), 193-213. https://doi.org/10.1016/ 0022-4049 ( 80 ) 90101-2 Google ScholarGoogle ScholarCross RefCross Ref
  43. G Maxwell Kelly. 1972. Many-variable functorial calculuCs. oIh. eIrnence in categorie.sSpringer, 66-105.Google ScholarGoogle Scholar
  44. Miguel L. Laplaza. 1972. Coherence for distributivityC.oIhnerence in Categorie,sG.M. Kelly, M. Laplaza, G. Lewis, and Saunders Mac Lane (Eds.). Lecture Notes in Mathematics, Vol. 281. Springer Verlag, Berlin, 29-65.Google ScholarGoogle Scholar
  45. D. Loeb. 1992. Sets with a negative number of elemenAtdsv.ances in Mathematic9s1, 1 ( 1992 ), 64-74.Google ScholarGoogle Scholar
  46. Ian Mackie. 1995. The Geometry of Interaction Machine. IPnroceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages(San Francisco, California, US(AP)OPL '95). Association for Computing Machinery, New York, NY, USA, 198-208. https://doi.org/10.1145/199448.199483 Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Ian Mackie. 2011. Reversible Higher-order ComputationsW.Ionrkshop on Reversible Computati o.nGoogle ScholarGoogle Scholar
  48. Saunders MacLane. 1963. Natural associativity and commutatRiivcietyIn.stitute Pamphlet-Rice University Stud4ie9s, 4 ( 1963 ).Google ScholarGoogle Scholar
  49. Jonathan Oppenheim, Robert W Spekkens, and Andreas Winter. 2005. A classical analogue of negative infoarmXiavtion. preprint quant-ph/0511247 ( 2005 ).Google ScholarGoogle Scholar
  50. P. Panangaden and É.O. Paquete. 2011. A Categorical Presentation of Quantum Computation with Anyo. nSspringer Berlin Heidelberg, Berlin, Heidelberg, 983-1025.Google ScholarGoogle Scholar
  51. R Penrose. 1971. Applications of negative dimensional tensoCros. mInbinatorial Mathematics and its Applicati.oAncsademic Press.Google ScholarGoogle Scholar
  52. James Propp. 2002. Euler measure as generalized cardinality. (200a2r)X.iv:math/0203289[math.CO].Google ScholarGoogle Scholar
  53. Cecylia Rauszer. 1974a. A formalization of the propositional calculus of H-SBtuldoigaicL. ogica33 ( 1974 ), 23-34. Issue 1.Google ScholarGoogle Scholar
  54. C. Rauszer. 1974b. Semi-boolean algebras and their applications to intuitionistic logic with dualFoupnedraamtoenrst. a Mathematicae83 ( 1974 ), 219-249.Google ScholarGoogle Scholar
  55. C. Rauszer. 1980. An algebraic and Kripke-style approach to a certain extension of intuitionisticDliossgeirct. atIniones Mathmatica.eVol. 167. Institut Mathématique de l' Académie Polonaise des Sciences.Google ScholarGoogle Scholar
  56. Udday S. Reddy. 1991. Acceptors as values: Functional programming in classical linear logic. (Dec. 1991 ). Manuscript.Google ScholarGoogle Scholar
  57. Lídia del Rio, Johan Åberg, Renato Renner, Oscar Dahlsten, and Vlatko Vedral. 2011. The thermodynamic meaning of negative entropyN. ature474, 7349 ( 2011 ), 61-63. https://doi.org/10.1038/nature10123 Google ScholarGoogle ScholarCross RefCross Ref
  58. Amr Sabry, Benoît Valiron, and Juliana Kaizer Vizzoto. 2018. From Symmetric Patern-Matching to Quantum Control. In Foundations of Software Science and Computation Struct,uCrehsristel Baier and Ugo Dal Lago (Eds.). Springer International Publishing, Cham, 348-364.Google ScholarGoogle Scholar
  59. Stephen H. Schanuel. 1991. Negative sets have Euler characteristic and dimenCsiaotneg. oInry Theory, Aurelio Carboni, Maria Cristina Pedicchio, and Guiseppe Rosolini (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 379-385.Google ScholarGoogle Scholar
  60. Peter Selinger. 2001. Control categories and duality: on the categorical semantics of the lambda-mMuatchaelmcualtuicsa.l. Structures in Comp. Sc1i.1 (April 2001 ), 207-260. Issue 2.Google ScholarGoogle Scholar
  61. Peter Selinger. 2011. A Survey of Graphical Languages for Monoidal CategorNiews. SIntructures for Physic, sBob Coecke (Ed.). Lecture Notes in Physics, Vol. 813. Springer Berlin / Heidelberg, 289-355.Google ScholarGoogle Scholar
  62. Zachary Sparks and Amr Sabry. 2014. Superstructural Reversible Logic3.rdInInternational Workshop on Linear.ityGoogle ScholarGoogle Scholar
  63. Michael Kirkedal Thomsen, Robin Kaarsgaard, and Mathias Soeken. 2015. Ricercar: A Language for Describing and Rewriting Reversible Circuits with Ancillae and Its Permutation SemaRnetviecrss.iIbnle Computatio,nJean Krivine and Jean-Bernard Stefani (Eds.). Springer International Publishing, Cham, 200-215.Google ScholarGoogle Scholar
  64. Tommaso Tofoli. 1980. Reversible Computing. InProceedings of the 7th Colloquium on Automata, Languages and Programming. Springer-Verlag, 632-644.Google ScholarGoogle Scholar
  65. Philip Wadler. 2003. Call-by-value is dual to call-by-naImCeF.PIn'03: Proceedings of the eighth ACM SIGPLAN international conference on Functional programmi(nUgppsala, Sweden). ACM, New York, NY, USA, 189-201.https://doi.org/10.1145/ 944705.944723 Google ScholarGoogle ScholarDigital LibraryDigital Library
  66. Philip Wadler. 2005. Call-by-Value Is Dual to Call-by-Name-ReloadTeedrm.InRewriting and Applicatio n,sJürgen Giesl (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 185-203.Google ScholarGoogle Scholar
  67. Tetsuo Yokoyama, Holger Bock Axelsen, and Robert Glück. 2016. Fundamentals of reversible flowchart lanThegou-ages. retical Computer Scienc6e11 ( 2016 ), 87-115. https://doi.org/10.1016/j.tcs. 2015. 07.046 Google ScholarGoogle ScholarDigital LibraryDigital Library
  68. Tetsuo Yokoyama and Robert Glück. 2007. A reversible programming language and its invertible self-interPpErePtMer. In (Nice, France). ACM, 144-153.Google ScholarGoogle Scholar

Index Terms

  1. A computational interpretation of compact closed categories: reversible programming with negative and fractional types

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!