skip to main content
research-article

Which simple types have a unique inhabitant?

Published:29 August 2015Publication History
Skip Abstract Section

Abstract

We study the question of whether a given type has a unique inhabitant modulo program equivalence. In the setting of simply-typed lambda-calculus with sums, equipped with the strong --equivalence, we show that uniqueness is decidable. We present a saturating focused logic that introduces irreducible cuts on positive types ``as soon as possible''. Backward search in this logic gives an effective algorithm that returns either zero, one or two distinct inhabitants for any given type. Preliminary application studies show that such a feature can be useful in strongly-typed programs, inferring the code of highly-polymorphic library functions, or ``glue code'' inside more complex terms.

References

  1. Arbob Ahmad, Daniel R. Licata, and Robert Harper. Deciding coproduct equality with focusing. Online draft, 2010.Google ScholarGoogle Scholar
  2. Thorsten Altenkirch, Peter Dybjer, Martin Hofmann, and Philip J. Scott. Normalization by evaluation for typed lambda calculus with coproducts. In LICS, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Jean-Marc Andreoli. Logic Programming with Focusing Proof in Linear Logic. Journal of Logic and Computation, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  4. Takahito Aoto. Uniqueness of normal proofs in implicational intuitionistic logic. Journal of Logic, Language and Information, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Takahito Aoto and Hiroakira Ono. Non-Uniqueness of Normal Proofs for Minimal Formulas in Implication-Conjunction Fragment of BCK. Bulletin of the Section of Logic, 1994.Google ScholarGoogle Scholar
  6. Maria-Virginia Aponte and Roberto Di Cosmo. Type isomorphisms for module signatures. In PLILP, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Ali Babaev and Sergei Soloviev. A coherence theorem for canonical morphisms in cartesian closed categories. Journal of Soviet Mathematics, 1982.Google ScholarGoogle ScholarCross RefCross Ref
  8. Vincent Balat, Roberto Di Cosmo, and Marcelo Fiore. Extensional normalisation and type-directed partial evaluation for typed lambda calculus with sums. In POPL, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Pierre Bourreau and Sylvain Salvati. Game semantics and uniqueness of type inhabitance in the simply-typed λ-calculus. In TLCA, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Taus Brock-Nannestad and Carsten Schürmann. Focused natural deduction. In LPAR-17, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Sabine Broda and Lu´ıs Damas. On long normal inhabitants of a type. J. Log. Comput., 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Kaustuv Chaudhuri and Frank Pfenning. Focusing the inverse method for linear logic. In CSL, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Kaustuv Chaudhuri, Dale Miller, and Alexis Saurin. Canonical sequent proofs via multi-focusing. In IFIP TCS, 2008.Google ScholarGoogle ScholarCross RefCross Ref
  14. Kaustuv Chaudhuri, Stefan Hetzl, and Dale Miller. A Systematic Approach to Canonicity in the Classical Sequent Calculus. In CSL, 2012.Google ScholarGoogle Scholar
  15. Pierre-Louis Curien and Guillaume Munch-Maccagnoni. The duality of computation under focus. In IFIP TCS, 2010.Google ScholarGoogle ScholarCross RefCross Ref
  16. Anatoli Degtyarev and Andrei Voronkov. Introduction to the inverse method. In Handbook of Automated Reasoning. 2001.Google ScholarGoogle ScholarCross RefCross Ref
  17. Kosta Dosen. Identity of proofs based on normalization and generality. Bulletin of Symbolic Logic, 2003.Google ScholarGoogle Scholar
  18. Gilles Dowek and Ying Jiang. On the expressive power of schemes. Inf. Comput., 2011.Google ScholarGoogle ScholarCross RefCross Ref
  19. Boris Düdder, Moritz Martens, and Jakob Rehof. Staged composition synthesis. In ESOP, 2014.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Roy Dyckhoff. Contraction-free sequent calculi for intuitionistic logic. J. Symb. Log., 1992.Google ScholarGoogle Scholar
  21. Roy Dyckhoff. Intuitionistic decision procedures since gentzen, 2013. Talk notes. Didier Galmiche and Daniel Méry. A connection-based characterization of bi-intuitionistic validity. J. Autom. Reasoning, 2013.Google ScholarGoogle Scholar
  22. Neil Ghani. Beta-eta equality for coproducts. In TLCA, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Tihomir Gvero, Viktor Kuncak, Ivan Kuraj, and Ruzica Piskac. Complete completion using types and weights. In PLDI, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Hugo Herbelin. A lambda-calculus structure isomorphic to gentzen-style sequent calculus structure. In CSL, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Danko Ilik. Axioms and decidability for type isomorphism in the presence of sums. CoRR, 2014. URL http://arxiv.org/abs/1401.2567.Google ScholarGoogle Scholar
  26. Edward Kmett. Lens, 2012. URL https://github.com/ekmett/lens. Edward Kmett. Lens wiki – types, 2013. URL https://github.com/ ekmett/lens/wiki/Types. Neelakantan R. Krishnaswami. Focusing on pattern matching. In POPL, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Chuck Liang and Dale Miller. Focusing and polarization in intuitionistic logic. CoRR, 2007. URL http://arxiv.org/abs/0708.2252.Google ScholarGoogle Scholar
  28. Sam Lindley. Extensional rewriting with sums. In TLCA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Pablo L´opez, Frank Pfenning, Jeff Polakow, and Kevin Watkins. Monadic concurrent linear logic programming. In PPDP, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Sean McLaughlin and Frank Pfenning. Imogen: Focusing the polarized inverse method for intuitionistic propositional logic. In LPAR, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Dale Miller and Alexis Saurin. From proofs to focused proofs: A modular proof of focalization in linear logic. In CSL, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Grigori Mints. Closed categories and the theory of proofs. Journal of Soviet Mathematics, 1981.Google ScholarGoogle ScholarCross RefCross Ref
  33. Bruno C. d. S. Oliveira, Adriaan Moors, and Martin Odersky. Type classes as objects and implicits. In OOPSLA, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Bruno C. d. S. Oliveira, Tom Schrijvers, Wontae Choi, Wonchan Lee, Kwangkeun Yi, and Philip Wadler. The implicit calculus: A new foundation for generic programming. 2014.Google ScholarGoogle Scholar
  35. Peter-Michael Osera and Steve Zdancewic. Type-and-example-directed program synthesis. In PLDI, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Jens Otten and Christoph Kreitz. A uniform proof procedure for classical and non-classical logics. In KI Advances in Artificial Intelligence, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Daniel Perelman, Sumit Gulwani, Thomas Ball, and Dan Grossman. Typedirected completion of partial expressions. In PLDI, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Gabriel Scherer. Mining opportunities for unique inhabitants in dependent programs, 2013.Google ScholarGoogle Scholar
  39. Gabriel Scherer. 2-or-more approximation for intuitionistic logic. 2014.Google ScholarGoogle Scholar
  40. Gabriel Scherer and Didier Rémy, 2015. URL http://gallium.inria. fr/~scherer/research/unique_inhabitants/. Colin Stirling. Proof systems for retracts in simply typed lambda calculus. In Automata, Languages, and Programming - ICALP, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Peter J. Stuckey and Martin Sulzmann. A theory of overloading. In ICFP, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Nikolay Vorob’ev. A new algorithm of derivability in a constructive calculus of statements. In Problems of the constructive direction in mathematics, 1958.Google ScholarGoogle Scholar
  43. Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad-hoc. In POPL, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Lincoln A. Wallen. Automated proof search in non-classical logics: Efficient matrix proof methods for modal and intuitionistic logic, 1987.Google ScholarGoogle Scholar
  45. Joe B. Wells and Boris Yakobowski. Graph-based proof counting and enumeration with applications for program fragment synthesis. In LOPSTR, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Marek Zaoinc. Fixpoint technique for counting terms in typed lambdacalculus. Technical report, State University of New York, 1995.Google ScholarGoogle Scholar
  47. Noam Zeilberger. Focusing and higher-order abstract syntax. In POPL, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Which simple types have a unique inhabitant?

      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!