Comprehensive Parametric Polymorphism: Categorical Models and Type Theory

  • Neil Ghani
  • Fredrik Nordvall ForsbergEmail author
  • Alex Simpson
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9634)


This paper combines reflexive-graph-category structure for relational parametricity with fibrational models of impredicative polymorphism. To achieve this, we modify the definition of fibrational model of impredicative polymorphism by adding one further ingredient to the structure: comprehension in the sense of Lawvere. Our main result is that such comprehensive models, once further endowed with reflexive-graph-category structure, enjoy the expected consequences of parametricity. This is proved using a type-theoretic presentation of the category-theoretic structure, within which the desired consequences of parametricity are derived. The formalisation requires new techniques because equality relations are not available, and standard arguments that exploit equality need to be reworked.


Relational Parametricity Type Theory Term Variable Identity Relation Relational Context 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



We thank Bob Atkey, Claudio Hermida, Rasmus Møgelberg and the anonymous reviewers for helpful discussions and comments. This research was supported by EPSRC grants GR/A11731/01, EP/E016146/1, EP/K023837/1 and EP/M016951/1.


  1. 1.
    Abadi, M., Cardelli, L., Curien, P.-L.: Formal parametric polymorphism. Theor. Comput. Sci. 121(1&2), 9–58 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Atkey, R., Ghani, N., Johann, P.: A relationally parametric model of dependent type theory. In: Jagannathan, S., Sewell, P. (eds.), POPL, pp. 503–515. ACM (2014)Google Scholar
  3. 3.
    Barendregt, H.: Introduction to generalized type systems. J. Funct. Program. 1(2), 125–154 (1991)MathSciNetzbMATHGoogle Scholar
  4. 4.
    Bernardy, J.-P., Coquand, T., Moulin, G.: A presheaf model of parametric type theory. In: Ghica, D.R. (ed.), MFPS, ENTCS, pp. 17–33. Elsevier (2015)Google Scholar
  5. 5.
    Bernardy, J.-P., Jansson, P., Paterson, R.: Proofs for free. J. Funct. Program. 22, 107–152 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Møgelberg, E.: Categorical models for Abadi and Plotkin’s logic for parametricity. Math. Struct. Comput. Sci. 15, 709–772 (2005)CrossRefzbMATHGoogle Scholar
  7. 7.
    Dunphy, B.: Parametricity as a notion of uniformity in reflexive graphs. Ph.D. thesis, University of Illinois (2002)Google Scholar
  8. 8.
    Dunphy, B., Reddy, U.: Parametric limits. In: LICS, pp. 242–251 (2004)Google Scholar
  9. 9.
    Ghani, N., Johann, P., Nordvall Forsberg, F., Orsanigo, F., Revell, T.: Bifibrational functorial semantics of parametric polymorphism. In: Ghica, D.R. (ed.) MFPS, ENTCS, pp. 67–83. Elsevier (2015)Google Scholar
  10. 10.
    Ghani, N., Nordvall Forsberg, F., Orsanigo, F.: Parametric polymorphism — universally. In: de Paiva, V., de Queiroz, R., Moss, L.S., Leivant, D., de Oliveira, A. (eds.) WoLLIC 2015. LNCS, vol. 9160, pp. 81–92. Springer, Heidelberg (2015)Google Scholar
  11. 11.
    Girard, J.-Y.: Interprétation fonctionelle et élimination des coupures dans l’arithmétique d’ordre supérieur. Ph.D. thesis, University of Paris VII (1972)Google Scholar
  12. 12.
    Hermida, C.: Fibrational relational polymorphism (2006).
  13. 13.
    Hermida, C., Reddy, U., Robinson, E.: Logical relations and parametricity – a Reynolds programme for category theory and programming languages. ENTCS 303, 149–180 (2014)MathSciNetzbMATHGoogle Scholar
  14. 14.
    Jacobs, B.: Comprehension categories and the semantics of type dependency. Theor. Comput. Sci. 107(2), 169–207 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Jacobs, B.: Categorical Logic and Type Theory. Elsevier, Amsterdam (1999)zbMATHGoogle Scholar
  16. 16.
    Kinoshita, Y., O’Hearn, P.W., Power, J., Takeyama, M., Tennent, R.D.: An axiomatic approach to binary logical relations with applications to data refinement. In: Abadi, M., Ito, T. (eds.) Theoretical Aspects of Computer Software. LNCS, vol. 1281, pp. 191–212. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  17. 17.
    Krishnaswami, N.R., Dreyer, D.: Internalizing relational parametricity in the extensional calculus of constructions. In: Ronchi, S., Rocca, D. (eds.) CSL, pp. 432–451 (2013)Google Scholar
  18. 18.
    Lawvere, F.W.: Equality in hyperdoctrines and comprehension schema as an adjoint functor. Appl. Categorical Algebra 17, 1–14 (1970)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Ma, Q., Reynolds, J.C.: Types, abstraction, and parametric polymorphism, part 2. In: Brookes, S., Main, M., Melton, A., Mislove, M., Schmidt, D. (eds.) Mathematical Foundations of Programming Semantics. LNCS, vol. 598, pp. 1–40. Springer, Heidelberg (1991)CrossRefGoogle Scholar
  20. 20.
    O’Hearn, P.W., Tennent, R.D.: Parametricity and local variables. J. ACM 42(3), 658–709 (1995)MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    Plotkin, G., Abadi, M.: A logic for parametric polymorphism. In: Bezem, M., Groote, J.F. (eds.) Typed Lambda Calculi and Applications. LNCS, vol. 664, pp. 361–375. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  22. 22.
    Reynolds, J.: Towards a theory of type structure. In: Robinet, B. (ed.) Programming Symposium. LNCS, vol. 19, pp. 408–425. Springer, Heidelberg (1974)CrossRefGoogle Scholar
  23. 23.
    Reynolds, J.: Types, abstraction and parametric polymorphism. In: Mason, R.E.A. (ed.), Information Processing, pp. 513–523 (1983)Google Scholar
  24. 24.
    Robinson, E.P., Rosolini, G.: Reflexive graphs and parametric polymorphism. In: LICS, pp. 364–371. IEEE Computer Society (1994)Google Scholar
  25. 25.
    Seely, R.A.G.: Categorical semantics for higher order polymorphic lambda calculus. J. Symbolic Logic 52, 969–989 (1987)MathSciNetCrossRefzbMATHGoogle Scholar
  26. 26.
    Strachey, C.: Fundamental concepts in programming languages. High. Order Symbolic Comput. 13(1–2), 11–49 (2000)CrossRefzbMATHGoogle Scholar
  27. 27.
    Wadler, P.: Theorems for free! In: Stoy, J.E. (ed.) FPCA, pp. 347–359. ACM (1989)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2016

Authors and Affiliations

  • Neil Ghani
    • 1
  • Fredrik Nordvall Forsberg
    • 1
    Email author
  • Alex Simpson
    • 2
  1. 1.Department of Computer and Information SciencesUniversity of StrathclydeGlasgowUK
  2. 2.Faculty of Mathematics and PhysicsUniversity of LjubljanaLjubljanaSlovenia

Personalised recommendations