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.
- Arbob Ahmad, Daniel R. Licata, and Robert Harper. Deciding coproduct equality with focusing. Online draft, 2010.Google Scholar
- Thorsten Altenkirch, Peter Dybjer, Martin Hofmann, and Philip J. Scott. Normalization by evaluation for typed lambda calculus with coproducts. In LICS, 2001. Google Scholar
Digital Library
- Jean-Marc Andreoli. Logic Programming with Focusing Proof in Linear Logic. Journal of Logic and Computation, 1992.Google Scholar
Cross Ref
- Takahito Aoto. Uniqueness of normal proofs in implicational intuitionistic logic. Journal of Logic, Language and Information, 1999. Google Scholar
Digital Library
- 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 Scholar
- Maria-Virginia Aponte and Roberto Di Cosmo. Type isomorphisms for module signatures. In PLILP, 1996. Google Scholar
Digital Library
- Ali Babaev and Sergei Soloviev. A coherence theorem for canonical morphisms in cartesian closed categories. Journal of Soviet Mathematics, 1982.Google Scholar
Cross Ref
- 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 Scholar
Digital Library
- Pierre Bourreau and Sylvain Salvati. Game semantics and uniqueness of type inhabitance in the simply-typed λ-calculus. In TLCA, 2011. Google Scholar
Digital Library
- Taus Brock-Nannestad and Carsten Schürmann. Focused natural deduction. In LPAR-17, 2010. Google Scholar
Digital Library
- Sabine Broda and Lu´ıs Damas. On long normal inhabitants of a type. J. Log. Comput., 2005. Google Scholar
Digital Library
- Kaustuv Chaudhuri and Frank Pfenning. Focusing the inverse method for linear logic. In CSL, 2005. Google Scholar
Digital Library
- Kaustuv Chaudhuri, Dale Miller, and Alexis Saurin. Canonical sequent proofs via multi-focusing. In IFIP TCS, 2008.Google Scholar
Cross Ref
- Kaustuv Chaudhuri, Stefan Hetzl, and Dale Miller. A Systematic Approach to Canonicity in the Classical Sequent Calculus. In CSL, 2012.Google Scholar
- Pierre-Louis Curien and Guillaume Munch-Maccagnoni. The duality of computation under focus. In IFIP TCS, 2010.Google Scholar
Cross Ref
- Anatoli Degtyarev and Andrei Voronkov. Introduction to the inverse method. In Handbook of Automated Reasoning. 2001.Google Scholar
Cross Ref
- Kosta Dosen. Identity of proofs based on normalization and generality. Bulletin of Symbolic Logic, 2003.Google Scholar
- Gilles Dowek and Ying Jiang. On the expressive power of schemes. Inf. Comput., 2011.Google Scholar
Cross Ref
- Boris Düdder, Moritz Martens, and Jakob Rehof. Staged composition synthesis. In ESOP, 2014.Google Scholar
Digital Library
- Roy Dyckhoff. Contraction-free sequent calculi for intuitionistic logic. J. Symb. Log., 1992.Google Scholar
- 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 Scholar
- Neil Ghani. Beta-eta equality for coproducts. In TLCA, 1995. Google Scholar
Digital Library
- Tihomir Gvero, Viktor Kuncak, Ivan Kuraj, and Ruzica Piskac. Complete completion using types and weights. In PLDI, 2013. Google Scholar
Digital Library
- Hugo Herbelin. A lambda-calculus structure isomorphic to gentzen-style sequent calculus structure. In CSL, 1993. Google Scholar
Digital Library
- Danko Ilik. Axioms and decidability for type isomorphism in the presence of sums. CoRR, 2014. URL http://arxiv.org/abs/1401.2567.Google Scholar
- 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 Scholar
Digital Library
- Chuck Liang and Dale Miller. Focusing and polarization in intuitionistic logic. CoRR, 2007. URL http://arxiv.org/abs/0708.2252.Google Scholar
- Sam Lindley. Extensional rewriting with sums. In TLCA, 2007. Google Scholar
Digital Library
- Pablo L´opez, Frank Pfenning, Jeff Polakow, and Kevin Watkins. Monadic concurrent linear logic programming. In PPDP, 2005. Google Scholar
Digital Library
- Sean McLaughlin and Frank Pfenning. Imogen: Focusing the polarized inverse method for intuitionistic propositional logic. In LPAR, 2008. Google Scholar
Digital Library
- Dale Miller and Alexis Saurin. From proofs to focused proofs: A modular proof of focalization in linear logic. In CSL, 2007. Google Scholar
Digital Library
- Grigori Mints. Closed categories and the theory of proofs. Journal of Soviet Mathematics, 1981.Google Scholar
Cross Ref
- Bruno C. d. S. Oliveira, Adriaan Moors, and Martin Odersky. Type classes as objects and implicits. In OOPSLA, 2010. Google Scholar
Digital Library
- 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 Scholar
- Peter-Michael Osera and Steve Zdancewic. Type-and-example-directed program synthesis. In PLDI, 2015. Google Scholar
Digital Library
- Jens Otten and Christoph Kreitz. A uniform proof procedure for classical and non-classical logics. In KI Advances in Artificial Intelligence, 1996. Google Scholar
Digital Library
- Daniel Perelman, Sumit Gulwani, Thomas Ball, and Dan Grossman. Typedirected completion of partial expressions. In PLDI, 2012. Google Scholar
Digital Library
- Gabriel Scherer. Mining opportunities for unique inhabitants in dependent programs, 2013.Google Scholar
- Gabriel Scherer. 2-or-more approximation for intuitionistic logic. 2014.Google Scholar
- 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 Scholar
Digital Library
- Peter J. Stuckey and Martin Sulzmann. A theory of overloading. In ICFP, 2002. Google Scholar
Digital Library
- Nikolay Vorob’ev. A new algorithm of derivability in a constructive calculus of statements. In Problems of the constructive direction in mathematics, 1958.Google Scholar
- Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad-hoc. In POPL, 1989. Google Scholar
Digital Library
- Lincoln A. Wallen. Automated proof search in non-classical logics: Efficient matrix proof methods for modal and intuitionistic logic, 1987.Google Scholar
- Joe B. Wells and Boris Yakobowski. Graph-based proof counting and enumeration with applications for program fragment synthesis. In LOPSTR, 2004. Google Scholar
Digital Library
- Marek Zaoinc. Fixpoint technique for counting terms in typed lambdacalculus. Technical report, State University of New York, 1995.Google Scholar
- Noam Zeilberger. Focusing and higher-order abstract syntax. In POPL, 2008. Google Scholar
Digital Library
Index Terms
Which simple types have a unique inhabitant?
Recommendations
Structural Focalization
Focusing, introduced by Jean-Marc Andreoli in the context of classical linear logic [Andreoli 1992], defines a normal form for sequent calculus derivations that cuts down on the number of possible derivations by eagerly applying invertible rules and ...
Which simple types have a unique inhabitant?
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional ProgrammingWe 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 ...
Deciding equivalence with sums and the empty type
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesThe logical technique of focusing can be applied to the λ-calculus; in a simple type system with atomic types and negative type formers (functions, products, the unit type), its normal forms coincide with βη-normal forms. Introducing a saturation phase ...






Comments