skip to main content
10.1145/2784731.2784757acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Which simple types have a unique inhabitant?

Published: 29 August 2015 Publication History

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

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
August 2015
436 pages
ISBN:9781450336697
DOI:10.1145/2784731
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 9
    ICFP '15
    September 2015
    436 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858949
    • Editor:
    • Andy Gill
    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].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 29 August 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Unique inhabitants
  2. canonicity
  3. code inference
  4. focusing
  5. proof search
  6. saturation
  7. simply-typed lambda-calculus
  8. sums

Qualifiers

  • Research-article

Conference

ICFP'15
Sponsor:

Acceptance Rates

Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)8
  • Downloads (Last 6 weeks)3
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Semi-Substructural Logics with AdditivesElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.402.8402(63-80)Online publication date: 23-Apr-2024
  • (2024)Focusing Gentzen’s LK Proof SystemPeter Schroeder-Heister on Proof-Theoretic Semantics10.1007/978-3-031-50981-0_9(275-313)Online publication date: 13-Feb-2024
  • (2023)Maximally Multi-focused Proofs for Skew Non-Commutative MILLLogic, Language, Information, and Computation10.1007/978-3-031-39784-4_24(377-393)Online publication date: 11-Jul-2023
  • (2022)Proof Theory of Skew Non-Commutative MILLElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.358.9358(118-135)Online publication date: 14-Apr-2022
  • (2020)Computation focusingProceedings of the ACM on Programming Languages10.1145/34089774:ICFP(1-27)Online publication date: 3-Aug-2020
  • (2019)Synthesizing symmetric lensesProceedings of the ACM on Programming Languages10.1145/33416993:ICFP(1-28)Online publication date: 26-Jul-2019
  • (2018)Synthesizing quotient lensesProceedings of the ACM on Programming Languages10.1145/32367752:ICFP(1-29)Online publication date: 30-Jul-2018
  • (2018)A tutorial on computational classical logic and the sequent calculusJournal of Functional Programming10.1017/S095679681800002328Online publication date: 1-Feb-2018
  • (2017)Program synthesis using abstraction refinementProceedings of the ACM on Programming Languages10.1145/31581512:POPL(1-30)Online publication date: 27-Dec-2017
  • (2017)Synthesizing bijective lensesProceedings of the ACM on Programming Languages10.1145/31580892:POPL(1-30)Online publication date: 27-Dec-2017
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media