Theories as Types

  • Dennis MüllerEmail author
  • Florian RabeEmail author
  • Michael KohlhaseEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10900)


Theories are an essential structuring principle that enable modularity, encapsulation, and reuse in formal libraries and programs (called classes there). Similar effects can be achieved by dependent record types. While the former form a separate language layer, the latter are a normal part of the type theory. This overlap in functionality can render different systems non-interoperable and lead to duplication of work.

We present a type-theoretic calculus and implementation of a variant of record types that for a wide class of formal languages naturally corresponds to theories. Moreover, we can now elegantly obtain a contravariant functor that reflects the theory level into the object level: for each theory we obtain the type of its models and for every theory morphism a function between the corresponding types. In particular this allows shallow – and thus structure-preserving – encodings of mathematical knowledge and program specifications while allowing the use of object-level features on models, e.g. equality and quantification.



The work reported here has been kicked off by discussions with Jacques Carette and William Farmer who have experimented with theory internalizations into record types in the scope of their MathScheme system. We acknowledge financial support from the OpenDreamKit Horizon 2020 European Research Infrastructures project (#676541).


  1. [Bra13]
    Brady, E.: Idris, a general-purpose dependently typed programming language: design and implementation. J. Funct. Program. 23(5), 552–593 (2013)MathSciNetCrossRefGoogle Scholar
  2. [Con+86]
    Constable, R., et al.: Implementing Mathematics with the Nuprl Development System. Prentice-Hall, Upper Saddle River (1986)Google Scholar
  3. [Deh+16]
    Dehaye, P.-O., et al.: Interoperability in the OpenDreamKit project: the math-in-the-middle approach. In: Kohlhase, M., Johansson, M., Miller, B., de Moura, L., Tompa, F. (eds.) CICM 2016. LNCS (LNAI), vol. 9791, pp. 117–131. Springer, Cham (2016). Scholar
  4. [FGT92]
    Farmer, W., Guttman, J., Thayer, F.: Little theories. In: Kapur, D. (ed.) Conference on Automated Deduction, pp. 467–581 (1992)CrossRefGoogle Scholar
  5. [Gog+93]
    Goguen, J., Winkler, T., Meseguer, J., Futatsugi, K., Jouannaud, J.: Introducing OBJ. In: Goguen, J., Coleman, D., Gallimore, R. (eds.) Applications of Algebraic Specification Using OBJ. Cambridge (1993)Google Scholar
  6. [Har+12]
    Hardin, T., et al.: The FoCaLiZe Essential (2012).
  7. [Har96]
    Harrison, J.: HOL light: a tutorial introduction. In: Srivas, M., Camilleri, A. (eds.) FMCAD 1996. LNCS, vol. 1166, pp. 265–269. Springer, Heidelberg (1996). Scholar
  8. [Koh+17]
    Kohlhase, M., Koprucki, T., Müller, D., Tabelow, K.: Mathematical models as research data via flexiformal theory graphs. In: Geuvers, H., England, M., Hasan, O., Rabe, F., Teschke, O. (eds.) CICM 2017. LNCS (LNAI), vol. 10383, pp. 224–238. Springer, Cham (2017). Scholar
  9. [LFX]
    MathHub MMT/LFX Git Repository. Accessed 15 May 2015
  10. [Luo09]
    Luo, Z.: Manifest fields and module mechanisms in intensional type theory. In: Berardi, S., Damiani, F., de’Liguoro, U. (eds.) TYPES 2008. LNCS, vol. 5497, pp. 237–255. Springer, Heidelberg (2009). Scholar
  11. [Mat]
  12. [Mit]
    MitM/SMGLoM. Accessed 01 Feb 2018
  13. [MRK]
    Müller, D., Rabe, F., Kohlhase, M.: Theories as Types.
  14. [ORS92]
    Owre, S., Rushby, J.M., Shankar, N.: PVS: a prototype verification system. In: Kapur, D. (ed.) CADE 1992. LNCS, vol. 607, pp. 748–752. Springer, Heidelberg (1992). Scholar
  15. [Rab14]
    Rabe, F.: How to identify, translate, and combine logics? J. Log. Comput. (2014).
  16. [Rab17]
    Rabe, F.: A modular type reconstruction algorithm. ACM Trans. Comput. Log. (2017). Accepted pending minor revision:
  17. [RK13]
    Rabe, F., Kohlhase, M.: A scalable module system. Inf. Comput. 230(1), 1–54 (2013)MathSciNetCrossRefGoogle Scholar
  18. [SW11]
    Spitters, B., van der Weegen, E.: Type classes for mathematics in type theory. CoRR abs/1102.1323 (2011). arXiv:1102.1323MathSciNetCrossRefGoogle Scholar
  19. [TB85]
    Trybulec, A., Blair, H.: Computer assisted reasoning with MIZAR. In: Joshi, A. (ed.) Proceedings of the 9th International Joint Conference on Artificial Intelligence, pp. 26–28. Morgan Kaufmann (1985)Google Scholar
  20. [Wen09]
    Wenzel, M.: The Isabelle/Isar Reference Manual, 3 December 2009.
  21. [Coq15]
    Coq Development Team: The Coq Proof Assistant: Reference Manual. Technical report, INRIA (2015)Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Computer ScienceFAU Erlangen-NürnbergErlangenGermany
  2. 2.LRIUniversité Paris SudOrsayFrance

Personalised recommendations