Finite sets in homotopy type theory

We study different formalizations of finite sets in homotopy type theory to obtain a general definition that exhibits both the computational facilities and the proof principles expected from finite sets. We use higher inductive types to define the type K(A) of "finite sets over type A" à la Kuratowski without assuming that K(A) has decidable equality. We show how to define basic functions and prove basic properties after which we give two applications of our definition. On the foundational side, we use K to define the notions of "Kuratowski-finite type" and "Kuratowski-finite subobject", which we contrast with established notions, e.g. Bishop-finite types and enumerated types. We argue that Kuratowski-finiteness is the most general and flexible one of those and we define the usual operations on finite types and subobjects. From the computational perspective, we show how to use K(A) for an abstract interface for well-known finite set implementations such as tree- and list-like data structures. This implies that a function defined on a concrete finite sets implementation can be obtained from a function defined on the abstract finite sets K(A) and that correctness properties are inherited. Hence, HoTT is the ideal setting for data refinement. Beside this, we define bounded quantification, which lifts a decidable property on A to one on K(A).

[1]  Andreas Blass An Induction Principle and Pigeonhole Principles for K-Finite Sets , 1995, J. Symb. Log..

[2]  Ulrik Buchholtz,et al.  Homotopy Type Theory in Lean , 2017, ITP.

[3]  Tarmo Uustalu,et al.  A Proof Pearl with the Fan Theorem and Bar Induction - Walking through Infinite Trees with Mixed Induction and Coinduction , 2011, APLAS.

[4]  Stéphane Lescuyer,et al.  Formalizing and Implementing a Reflexive Tactic for Automated Deduction in Coq. (Formalisation et developpement d'une tactique reflexive pour la demonstration automatique en coq) , 2011 .

[5]  Bas Spitters,et al.  Sets in homotopy type theory † , 2013, Mathematical Structures in Computer Science.

[6]  Tarmo Uustalu,et al.  On streams that are finitely red , 2012, Log. Methods Comput. Sci..

[7]  Robbert Krebbers,et al.  A Typed C11 Semantics for Interactive Theorem Proving , 2015, CPP.

[8]  Matthieu Sozeau,et al.  First-Class Type Classes , 2008, TPHOLs.

[9]  Tarmo Uustalu,et al.  Variations on Noetherianness , 2016, MSFP.

[10]  Thorsten Altenkirch,et al.  Quotient inductive-inductive types , 2018, FoSSaCS.

[11]  Tarmo Uustalu,et al.  Finiteness and rational sequences, constructively , 2017, J. Funct. Program..

[12]  Thorsten Altenkirch,et al.  Normalisation by Evaluation for Dependent Types , 2016, FSCD.

[13]  P. Johnstone Sketches of an Elephant: A Topos Theory Compendium Volume 1 , 2002 .

[14]  M. Hofmann,et al.  The groupoid interpretation of type theory , 1998 .

[15]  Robert Harper,et al.  Canonicity for 2-dimensional type theory , 2012, POPL '12.

[16]  Martin Hofmann,et al.  The groupoid model refutes uniqueness of identity proofs , 1994, Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science.

[17]  Thierry Coquand,et al.  A Model of Type Theory in Cubical Sets , 2013, TYPES.

[18]  Daniel R. Licata,et al.  π n (S n ) in Homotopy Type Theory , 2013, CPP.

[19]  Brent A. Yorgey Combinatorial species and labelled structures , 2014 .

[20]  Daniel R. Licata,et al.  Calculating the Fundamental Group of the Circle in Homotopy Type Theory , 2013, 2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science.

[21]  Bezem,et al.  Ramsey's theorem and the pigeonhole principle in intuitionistic mathematics , 1993 .

[22]  Dominique Devriese,et al.  Pattern matching without K , 2014, ICFP.

[23]  Thierry Coquand,et al.  A Strongly Normalizing Computation Rule for Univalence in Higher-Order Minimal Logic , 2016, ArXiv.

[24]  Andrej Bauer,et al.  The HoTT library: a formalization of homotopy type theory in Coq , 2016, CPP.

[25]  Thierry Coquand,et al.  Cubical Type Theory: A Constructive Interpretation of the Univalence Axiom , 2015, TYPES.

[26]  Errett Bishop Constructive analysis / Errett Bishop, Douglas Bridges , 1985 .

[27]  Gaëtan Gilbert Formalising real numbers in homotopy type theory , 2017, CPP.

[28]  Gert Smolka,et al.  Hereditarily Finite Sets in Constructive Type Theory , 2016, ITP.

[29]  Tarmo Uustalu,et al.  Dependently typed programming with finite sets , 2015, WGP@ICFP.

[30]  Bas Spitters,et al.  Type classes for efficient exact real arithmetic in Coq , 2011, Log. Methods Comput. Sci..

[31]  Stéphane Lescuyer First-Class Containers in Coq , 2011, Stud. Inform. Univ..

[32]  Robert Harper,et al.  Homotopical patch theory , 2016, J. Funct. Program..

[33]  Herman Geuvers,et al.  Higher Inductive Types in Programming , 2017, J. Univers. Comput. Sci..

[34]  Wouter Swierstra,et al.  Data types à la carte , 2008, Journal of Functional Programming.

[35]  Kristina Sojakova,et al.  Higher Inductive Types as Homotopy-Initial Algebras , 2014, POPL.

[36]  Michael Shulman,et al.  The Seifert-van Kampen Theorem in Homotopy Type Theory , 2016, CSL.

[37]  Steven Awodey,et al.  Inductive Types in Homotopy Type Theory , 2012, 2012 27th Annual IEEE Symposium on Logic in Computer Science.

[38]  Tarmo Uustalu,et al.  The Delay Monad and Restriction Categories , 2017, ICTAC.

[39]  P. Johnstone,et al.  REVIEWS-Sketches of an elephant: A topos theory compendium , 2003 .

[40]  Giovanni Sambin,et al.  Twenty-five years of constructive type theory. , 1998 .

[41]  Nicolai Kraus Constructions with Non-Recursive Higher Inductive Types , 2016, 2016 31st Annual ACM/IEEE Symposium on Logic in Computer Science (LICS).

[42]  Daniel R. Licata,et al.  Eilenberg-MacLane spaces in homotopy type theory , 2014, CSL-LICS.

[43]  Thorsten Altenkirch,et al.  Type theory in type theory using quotient inductive types , 2016, POPL.

[44]  Erik Parmann Investigating Streamless Sets , 2014, TYPES.

[45]  Floris van Doorn Constructing the propositional truncation using non-recursive HITs , 2016, CPP.

[46]  P. Lumsdaine,et al.  Semantics of higher inductive types , 2017, Mathematical Proceedings of the Cambridge Philosophical Society.

[47]  Ioana Pasca,et al.  Canonical Big Operators , 2008, TPHOLs.

[48]  Peter Dybjer,et al.  Finitary Higher Inductive Types in the Groupoid Model , 2018, MFPS.

[49]  Thorsten Altenkirch,et al.  Partiality, Revisited: The Partiality Monad as a Quotient Inductive-Inductive Type , 2017, FoSSaCS.