skip to main content
research-article

Focusing and higher-order abstract syntax

Published:07 January 2008Publication History
Skip Abstract Section

Abstract

Focusing is a proof-search strategy, originating in linear logic, that elegantly eliminates inessential nondeterminism, with one byproduct being a correspondence between focusing proofs and programs with explicit evaluation order. Higher-order abstract syntax (HOAS) is a technique for representing higher-order programming language constructs (e.g., λ's) by higher-order terms at the"meta-level", thereby avoiding some of the bureaucratic headaches of first-order representations (e.g., capture-avoiding substitution).

This paper begins with a fresh, judgmental analysis of focusing for intuitionistic logic (with a full suite of propositional connectives), recasting the "derived rules" of focusing as iterated inductive definitions. This leads to a uniform presentation, allowing concise, modular proofs of the identity and cut principles. Then we show how this formulation of focusing induces, through the Curry-Howard isomorphism, a new kind of higher-order encoding of abstract syntax: functions are encoded by maps from patterns to expressions. Dually, values are encoded as patterns together with explicit substitutions. This gives us pattern-matching "for free", and lets us reason about a rich type system with minimal syntactic overhead. We describe how to translate the language and proof of type safety almost directly into Coq using HOAS, and finally, show how the system's modular design pays off in enabling a very simple extension with recursion and recursive types.

References

  1. M. Abadi, L. Cardelli, P.-L. Curien, and J.-J. Lévy. Explicit substitutions. Journal of Functional Programming, 1(4):375--416, 1991. Jean-Marc Andreoli. Focussing and proof construction. Annals of Pure and Applied Logic, 107(1):131--163, 2001.Google ScholarGoogle ScholarCross RefCross Ref
  2. Jean-Marc Andreoli. Logic programming with focusing proofs in linear logic. Journal of Logic and Computation, 2(3):297--347, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  3. Michael Brandt and Fritz Henglein. Coinductive axiomatization of recursive type equaility and subtyping. Fundamenta Informaticae, 20:1--24, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. W. Buchholz, S. Feferman, W. Pohlers, and W. Sieg. Iterated Inductive Definitions and Subsystems of Analysis: Recent Proof-Theoretical Studies. Springer-Verlag, 1981.Google ScholarGoogle ScholarCross RefCross Ref
  5. Serenella Cerrito and Delia Kesner. Pattern matching as cut elimination. Theoretical Computer Science, 323(1--3):71--127, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. The Coq Development Team. The Coq Proof Assistant Reference Manual Version 8.1. INRIA, 2006. http://coq.inria.fr/doc/main.html.Google ScholarGoogle Scholar
  7. Thierry Coquand. Pattern matching with dependent types. In Proceedings of the Workshop on Types for Proofs and Programs, pages 71--83, Båstad, Sweden, 1992.Google ScholarGoogle Scholar
  8. Thierry Coquand and Gérard Huet. The calculus of constructions. Information and Computation, 76(2/3):95--120, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Thierry Coquand and Christine Paulin-Mohring. Inductively defined types. In LNCS 389. Springer-Verlag, 1989.Google ScholarGoogle Scholar
  10. Pierre-Louis Curien and Hugo Herbelin. The duality of computation. In ICFP '00: Proceedings of the SIGPLAN International Conference on Functional Programming, pages 233--243. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Nicolaas G. de Bruijn. A lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the church-rosser theorem. Indagationes Mathematicae, 34:381--392, 1972.Google ScholarGoogle ScholarCross RefCross Ref
  12. Joëlle Despeyroux, Amy Felty, and André Hirschowitz. Higher-order abstract syntax in Coq. In M. Dezani-Ciancaglini and G. Plotkin, editors, Proceedings of the International Conference on Typed Lambda Calculi and Applications, volume 902 of LNCS, pages 124--138, Edinburgh, Scotland, 1995. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Michael Dummett. The Logical Basis of Metaphysics. The William James Lectures, 1976. Harvard University Press, Cambridge, Massachusetts, 1991. ISBN 0-674-53785-8.Google ScholarGoogle Scholar
  14. Roy Dyckhoff and Stephane Lengrand. LJQ: A strongly focused calculus for intuitionistic logic. In Proceedings of the Second Conference on Computability in Europe, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Cormac Flanagan, Amr Sabry, Bruce Duba, and Matthias Felleisen. The essence of compiling with continuations. In PLDI '93: Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Gerhard Gentzen. Untersuchungen über das logische Schließen. Mathematische Zeitschrift, 39:176--210, 405--431, 1935. English translation in M. E. Szabo, editor, The Collected Papers of Gerhard Gentzen, pages 68--131, North-Holland, 1969.Google ScholarGoogle ScholarCross RefCross Ref
  17. Jean-Yves Girard. Locus solum: From the rules of logic to the logic of rules. Mathematical Structures in Computer Science, 11(3):301--506, 2001. Jean-Yves Girard. On the unity of logic. Annals of pure and applied logic, 59(3):201--217, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Hugo Herbelin. A lambda-calculus structure isomorphic to Gentzen-style sequent calculus structure. In CSL '94: Proceedings of the 8th International Workshop on Computer Science Logic, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Jacob M. Howe. Proof search issues in some non-classical logics. PhD thesis, University of St Andrews, December 1998. URL http://www.cs.kent.ac.uk/pubs/1998/946. Available as University of St Andrews Research Report CS/99/1.Google ScholarGoogle Scholar
  20. Steven C. Kleene. Introduction to Metamathematics. Van Nostrand, New York, 1952.Google ScholarGoogle Scholar
  21. Olivier Laurent. Etude de la polarisation en logique. Thése de doctorat, Université Aix-Marseille II, March 2002.Google ScholarGoogle Scholar
  22. Olivier Laurent. Classical isomorphisms of types. Mathematical Structures in Computer Science, 15(5):969--1004, October 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Per Martin-Löf. Hauptsatz for the intuitionistic theory of iterated inductive definitions. In J. E. Fenstad, editor, Proceedings of the Second Scandinavian Logic Symposium, pages 179--216, Amsterdam, 1971. North Holland.Google ScholarGoogle ScholarCross RefCross Ref
  24. Per Martin-Löf. On the meanings of the logical constants and the justifications of the logical laws. Nordic Journal of Philosophical Logic, 1(1):11--60, 1996. URL http://www.hf.uio.no/filosofi/njpl/vol1no1/meaning/meaning.html.Google ScholarGoogle Scholar
  25. Dale Miller and Chuck Liang. Focusing and polarization in intuitionistic logic. In CSL '07: Proceedings of the 21st International Workshop on Computer Science Logic. 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Eugenio Moggi. Notions of computation and monads. Information and Compution, 93(1):55--92, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Aleksandar Nanevski, Frank Pfenning, and Brigitte Pientka. Contextual modal type theory. Transactions on Computational Logic, 2007. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Frank Pfenning and Rowan Davies. A judgmental reconstruction of modal logic. Mathematical Structures in Computer Science, 11(4):511--540, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Frank Pfenning and Conal Elliott. Higher-order abstract syntax. In PLDI '88: Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation, pages 199--208, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Brigitte Pientka. A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions. In POPL '08: Proceedings of the SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. John C. Reynolds. Definitional interpreters for higher-order programming languages. In ACM '72: Proceedings of the ACM annual conference, pages 717--740, 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Carsten Schürmann, Joëlle Despeyroux, and Frank Pfenning. Primitive recursion for higher-order abstract syntax. Theoretical Computer Science, 266:1--57, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Peter Selinger. Control categories and duality: on the categorical semantics of the lambda-mu calculus. Mathematical Structures in Computer Science, 11(2):207--260, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Anne S. Troelstra and Helmut Schwichtenberg. Basic Proof Theory, volume Cambridge Tracts in Theoretical Computer Science 43. Cambridge University Press, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Twelf 2007. The Twelf Project, 2007. http://twelf.plparty.org/.Google ScholarGoogle Scholar
  36. Philip Wadler. Call-by-value is dual to call-by-name. In ICFP '03: Proceedings of the SIGPLAN International Conference on Functional Programming, pages 189--201, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Philip Wadler. A taste of linear logic. In MFCS: Symposium on Mathematical Foundations of Computer Science, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Noam Zeilberger. On the unity of duality. Annals of Pure and Applied Logic, 2007. To appear in a special issue on "Classical Logic and Computation".Google ScholarGoogle Scholar

Index Terms

  1. Focusing and higher-order abstract syntax

          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

          • Published in

            cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 43, Issue 1
            POPL '08
            January 2008
            420 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/1328897
            Issue’s Table of Contents
            • cover image ACM Conferences
              POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
              January 2008
              448 pages
              ISBN:9781595936899
              DOI:10.1145/1328438

            Copyright © 2008 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 7 January 2008

            Check for updates

            Qualifiers

            • research-article

          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!