Abstract
Types in higher-order logic (HOL) are naturally interpreted as nonempty sets. This intuition is reflected in the type definition rule for the HOL-based systems (including Isabelle/HOL), where a new type can be defined whenever a nonempty set is exhibited. However, in HOL this definition mechanism cannot be applied inside proof contexts. We propose a more expressive type definition rule that addresses the limitation and we prove its consistency. This higher expressive power opens the opportunity for a HOL tool that relativizes type-based statements to more flexible set-based variants in a principled way. We also address particularities of Isabelle/HOL and show how to perform the relativization in the presence of type classes.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Notes
Let us recall that HOL does not allow for dependent types.
Dependent type theory has its own pluses and minuses. Even if we came to the conclusion that the pluses prevail, we do not know how to combine dependent types with higher-order logic and the tools built around it. Hence the avoidance of the dependent types. Note that HOL-Omega does not include dependent types either.
There is always such \(\rho \) since we work with well-typed terms and moreover it is unique.
In order for this to work, we have silently assumed a connection between \(\mathsf {P}_{\beta \,\mathsf {list}\rightarrow \mathsf {bool}}\) and \(\mathsf {P}_{\alpha \,\mathsf {list}\rightarrow \mathsf {bool}}\), namely that \(\mathsf {P}\) is parametric w.r.t. injection. More precisely that for every binary relation \(R_{\alpha \rightarrow \beta \rightarrow \mathsf {bool}}\) defining an injection of \(\beta \) into \(\alpha \) and for every two lists \({ xs }_{\alpha \,\mathsf {list}}\) and \({ ys }_{\beta \,\mathsf {list}}\) whose elements are pairwise related by R, it holds that \(\mathsf {P}\;{ xs }\) if and only if \(\mathsf {P}\;{ ys }\)—see Sect. 7 for more on parametricity.
This is Wenzel’s approach [29] to represent axiomatic type classes by internalizing them as predicates on types, i.e., constants of type \(\forall \alpha .\;\mathsf {bool}\). As this particular type is not allowed in Isabelle, Wenzel uses instead \(\alpha \;\mathsf {itself} \rightarrow \mathsf {bool}\), where \(\alpha \;\mathsf {itself}\) is a singleton type.
Let us recall that \(\forall x.P\;x\) is a shorthand for and \(\forall x \in A.P\;x\) for , where \({{\mathsf {All}}}\) and \({{\mathsf {Ball}}}\) are the HOL constants for quantification. Thus the statement about isomorphism between the two quantifications means isomorphism between \({{\mathsf {All}}}\) and \({{\mathsf {Ball}}}\;A\).
Unless there is a type depending on \(*\).
The setup requires more than just the name of a relator. Besides making sure that the relator satisfies many natural properties such as monotonicity or compositionality, we use other concepts such as the knowledge that “lists whose elements are in A” can be expressed by \({{\mathsf {lists}}}\;A\). See the complete description of the required structure in the first author’s thesis [33, §4.7].
These rules are related to Reynolds’s relational parametricity [35] and Wadler’s free theorems [36]. The Transfer tool is a working implementation of Mitchell’s representation independence [37] and it demonstrates that transferring of properties across related types can be organized and largely automated using relational parametricity.
The type \(\forall \alpha _\varUpsilon .\sigma \) is not directly expressible in HOL but we can use Wenzel’s trick and write \(\alpha _\varUpsilon \,\mathsf {itself} \rightarrow \sigma \); see footnote 5 on page 13.
We assumed that the type class \(\varUpsilon \) does not have any associated operations. Lifting the description to the most general version of \(\varUpsilon \) is analogous to the approach in Sect. 6.4 and we omit it here.
In the worst case, we can always set S to be the range of \(f^\mathsf {on}\) and define g by choice.
References
Kunčar, O., Popescu, A.: From types to sets by local type definition in higher-order logic. In: Blanchette, J.C., Merz, S. (eds.) ITP 2016, LNCS, vol. 9807, pp. 200–218, Springer (2016)
Bove, A., Dybjer, P., Norell, U.: A brief overview of AGDA—a functional language with dependent types. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009, LNCS, vol. 5674, pp. 73–78, Springer (2009)
Bertot, Y., Castéran, P.: Interactive theorem proving and program development—Coq’Art: the calculus of inductive constructions. In: Texts in Theoretical Computer Science. An EATCS Series, Springer (2004)
Asperti, A., Ricciotti, W., Coen, C.S., Tassi, E.: The Matita interactive theorem prover. In: CADE-23, pp. 64–69 (2011)
Constable, R.L., Allen, S.F., Bromley, H.M., Cleaveland, W.R., Cremer, J.F., Harper, R.W., Howe, D.J., Knoblock, T.B., Mendler, N.P., Panangaden, P., Sasaki, J.T., Smith, S.F.: Implementing Mathematics with the Nuprl Proof Development System. Prentice-Hall Inc., Upper Saddle River (1986)
The HOL4 Theorem Prover. http://hol.sourceforge.net/
Harrison, J.: HOL Light: a tutorial introduction. In: Srivas, M.K., Camilleri, A.J. (eds.) FMCAD ’96, LNCS, vol. 1166, pp. 265–269, Springer (1996)
Adams, M.: Introducing HOL Zero—(extended abstract). In: Fukuda, K., van der Hoeven, J., Joswig, M., Takayama, N. (eds.) ICMS 2010, LNCS, vol. 6327, pp. 142–143, Springer, Berlin (2010)
Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL—a proof assistant for higher-order logic. part of the Isabelle2015 distribution (2015). https://isabelle.in.tum.de/dist/Isabelle2015/doc/tutorial.pdf
Kaufmann, M., Manolios, P., Moore, J.S.: Computer-Aided Reasoning: An Approach. Kluwer, Dordrecht (2000)
Bancerek, G., Byliński, C., Grabowski, A., Korniłowicz, A., Matuszewski, R., Naumowicz, A., Pąk, K., Urban, J.: Mizar: state-of-the-art and beyond. In: Kerber, M., Carette, J., Kaliszyk, C., Rabe, F., Sorge, V. (eds.) Intelligent Computer Mathematics, pp. 261–279. Springer, Berlin (2015)
Shankar, N., Owre, S., Rushby, J.M.: PVS Tutorial. Computer Science Laboratory, SRI International (1993)
Homeier, P.V.: The HOL-Omega logic. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009, LNCS, vol. 5674, pp. 244–259, Springer (2009)
Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: POPL ’89, ACM, pp. 60–76 (1989)
Nipkow, T., Snelting, G.: Type classes and overloading resolution via order-sorted unification. In: Hughes, J. (ed.) Functional Programming Languages and Computer Architecture, LNCS, vol. 523, pp. 1–14. Springer, Berlin (1991)
Wickerson, J.: Isabelle Users List (2013). https://lists.cam.ac.uk/mailman/htdig/cl-isabelle-users/2013-February/msg00222.html
Immler, F.: Generic Construction of Probability Spaces for Paths of Stochastic Processes. Master’s Thesis, Institut für Informatik, Technische Universität München (2012)
Aransay, J., Ballarin, C., Rubio, J.: A mechanized proof of the basic perturbation lemma. J. Autom. Reason. 40(4), 271–292 (2008)
Chan, H., Norrish, M.: Mechanisation of AKS algorithm: part 1—the main theorem. In: Urban, C., Zhang, X. (eds.) ITP 2015, LNCS, vol. 9236, pp. 117–136, Springer (2015)
Coble, A.R.: Formalized information-theoretic proofs of privacy using the HOL4 theorem-prover. In: Borisov, N., Goldberg, I. (eds.) PETS 2008, LNCS, vol. 5134, pp. 77–98, Springer (2008)
Hölzl, J., Heller, A.: Three chapters of measure theory in Isabelle/HOL. In: van Eekelen, M.C.J.D., Geuvers, H., Schmaltz, J., Wiedijk, F. (eds.) ITP 2011, LNCS, vol. 6898, pp. 135–151, Springer (2011)
Maggesi, M.: A formalisation of metric spaces in HOL light (2015). Presented at the Workshop Formal Mathematics for Mathematicians. CICM 2015 (published online). http://www.cicm-conference.org/2015/fm4m/FMM_2015_paper_3.pdf
Types to Sets in the Isabelle distribution. https://isabelle.in.tum.de/dist/library/HOL/HOL-Types_To_Sets/index.html
Gordon, M.J.C., Melham, T.F. (eds.): Introduction to HOL: A Theorem Proving Environment for Higher Order Logic. Cambridge University Press, Cambridge (1993)
Harrison, J.: HOL Done Right (1995). http://www.cl.cam.ac.uk/~jrh13/papers/holright.html
Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL—A Proof Assistant for Higher-Order Logic, LNCS, vol. 2283. Springer, Berlin (2002)
Kunčar, O., Popescu, A.: Comprehending Isabelle/HOL’s consistency. In: Yang, H. (ed.) ESOP 2017, LNCS, vol. 10201, pp. 724–749, Springer (2017)
Pitts, A.: Introduction to HOL: a theorem proving environment for higher order logic, chap. The HOL logic, In: Gordon and Melham [15], pp. 191–232 (1993)
Wenzel, M.: Type classes and overloading in higher-order logic. In: Gunter, E.L., Felty, A.P. (eds.) TPHOLs ’97, LNCS, vol. 1275, pp. 307–322, Springer (1997)
Haftmann, F., Wenzel, M.: Constructive type classes in Isabelle. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006, LNCS, vol. 4502, pp. 160–174, Springer (2006)
Krauss, A., Schropp, A.: A mechanized translation from higher-order logic to set theory. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010, LNCS, vol. 6172, pp. 323–338, Springer (2010)
Huffman, B., Kunčar, O.: Lifting and transfer: a modular design for quotients in Isabelle/HOL. In: Gonthier, G., Norrish, M. (eds.) CPP 2013, LNCS, vol. 8307, pp. 131–146, Springer (2013)
Kunčar, O.: Types, Abstraction and Parametric Polymorphism in Higher-Order Logic. Ph.D. Thesis, Fakultät für Informatik, Technische Universität München (2016). http://www21.in.tum.de/~kuncar/documents/kuncar-phdthesis.pdf
Traytel, D., Popescu, A., Blanchette, J.C.: Foundational, compositional (co)datatypes for higher-order logic: category theory applied to theorem proving. In: LICS 2012, IEEE, pp. 596–605 (2012)
Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP Congress, pp. 513–523 (1983)
Wadler, P.: Theorems for free! In: FPCA ’89, ACM, pp. 347–359 (1989)
Mitchell, J.C.: Representation independence and data abstraction. In: POPL ’86, ACM, pp. 263–276 (1986)
Harrison, J.: The HOL Light theory of Euclidean space. J. Autom. Reason. 50, 173–190 (2013)
Harrison, J.: A HOL theory of Euclidean space. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005, LNCS, vol. 3603. Springer, Oxford (2005)
Divasón, J., Joosten, S., Thiemann, R., Yamada, A.: A formalization of the Berlekamp–Zassenhaus factorization algorithm. In: CPP, pp. 17–29 (2017)
Kunčar, O., Popescu, A.: Safety and conservativity of definitions in HOL and Isabelle/HOL. Proc. ACM Program. Lang. 24, 1–24 (2017)
The HOL-Algebra Library. http://isabelle.in.tum.de/library/HOL/HOL-Algebra/
Ballarin, C.: Locales: a module system for mathematical theories. J. Autom. Reason. 52(2), 123–153 (2014)
Acknowledgements
We thank reviewers for useful comments and suggestions. The ITP 2016 reviewers helped us to improve the previous conference version of the paper. We thank Fabian Immler and Dmitriy Traytel for interesting discussions on Types to Terms and HOL dependent typing, respectively. We are indebted to Johannes Hölzl to introduce us to HOL-Algebra and to remind us that not every locale can be translated into a corresponding type class in Isabelle. We gratefully acknowledge support from DFG through grant NI 491/13-3 and from EPSRC through grant EP/N019547/1.
Author information
Authors and Affiliations
Corresponding author
Additional information
This is the extended, journal version of the conference paper [1], submitted to the JAR special issue dedicated to ITP 2016.
Rights and permissions
About this article
Cite this article
Kunčar, O., Popescu, A. From Types to Sets by Local Type Definition in Higher-Order Logic. J Autom Reasoning 62, 237–260 (2019). https://doi.org/10.1007/s10817-018-9464-6
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10817-018-9464-6