I Got Plenty o’ Nuttin’

  • Conor McBrideEmail author
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9600)


Work to date on combining linear types and dependent types has deliberately and successfully avoided doing so. Entirely fit for their own purposes, such systems wisely insist that types depend only on the replicable sublanguage, thus sidestepping the issue of counting uses of limited-use data either within types or in ways which are only really needed to shut the typechecker up. As a result, the linear implication (‘lollipop’) stubbornly remains a non-dependent \(S \multimap T\). This paper defines and establishes the basic metatheory of a type theory supporting a ‘dependent lollipop’ \((x\!:\!S)\multimap T[x]\), where what the input used to be is in some way commemorated by the type of the output. For example, we might convert list to length-indexed vectors in place by a function with type \((l\!:\!\mathsf {List}\,X)\multimap \mathsf {Vector}\,X\,(\mathsf {length}\,l)\). Usage is tracked with resource annotations belonging to an arbitrary rig, or ‘riNg without Negation’. The key insight is to use the rig’s zero to mark information in contexts which is present for purposes of contemplation rather than consumption, like a meal we remember fondly but cannot eat twice. We need no runtime copies of l to form the above vector type. We can have plenty of nothing with no additional runtime resource, and nothing is plenty for the construction of dependent types.


Function Type Type Theory Dependent Type Application Rule Type Annotation 
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.



Writing was a substitute for sleep in a busy summer of talks in the Netherlands, Germany and England. I thank everyone who interacted with me in the daytimes at least for their forbearance, and some for very useful conversations and feedback, notably James McKinna and Shayan Najd. The ideas were incubated during my visit to Microsoft Research Cambridge in 2014: I’m grateful to Nick Benton for feedback and encouragement. My talk on this topic at SREPLS in Cambridge provoked a very helpful interaction with Andy Pitts, Dominic Orchard, Tomas Petricek, and Stephen Dolan—his semiring-sensitivity provoked the generality of the resource treatment here [10]. I apologize to and thank the referees of all versions of this paper. Sam Lindley and Craig McLaughlin also deserve credit for helping me get my act together.

The inspiration, however, comes from Phil. The clarity of the connection he draws between classical linear logic and session types [31] is what attracted me to this problem. One day he, Simon Gay and I bashed rules at my whiteboard, trying to figure out a dependent version of that ‘Propositions As Sessions’ story. The need to distinguish ‘contemplation’ from ‘consumption’ emerged that afternoon: it has not yet delivered a full higher-order theory of ‘dependent session types’, but in my mind, it showed me the penny I had to make drop.


  1. 1.
    Abel, A.: Normalization by Evaluation: Dependent Types and Impredicativity, Habilitationsschrift (2013)Google Scholar
  2. 2.
    Abel, A., Coquand, T., Dybjer, P.: Normalization by evaluation for Martin-Löf Type theory with typed equality judgements. In: Proceedings of the 22nd IEEE Symposium on Logic in Computer Science (LICS 2007), 10–12 July 2007, Wroclaw, Poland, pp. 3–12. IEEE Computer Society (2007)Google Scholar
  3. 3.
    Adams, R.: Pure type systems with judgemental equality. J. Funct. Program. 16(2), 219–246 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Asperti, A., Ricciotti, W., Coen, C.S., Tassi, E.: A bi-directional refinement algorithm for the calculus of (co)inductive constructions. Logical Meth. Comput. Sci. 8(1), 1–49 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Bernardy, J.-P., Jansson, P., Paterson, R.: Proofs for free - parametricity for dependent types. J. Funct. Program. 22(2), 107–152 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Brady, E.: Idris, a general-purpose dependently typed programming language: design and implementation. J. Funct. Program. 23(5), 552–593 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Caires, L., Pfenning, F.: Session types as intuitionistic linear propositions. In: Gastin, P., Laroussinie, F. (eds.) CONCUR 2010. LNCS, vol. 6269, pp. 222–236. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  8. 8.
    Cervesato, I., Pfenning, F.: A linear logical framework. Inf. Comput. 179(1), 19–75 (2002)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    de Vries, E., Plasmeijer, R., Abrahamson, D.M.: Uniqueness typing simplified. In: Chitil, O., Horváth, Z., Zsók, V. (eds.) IFL 2007. LNCS, vol. 5083, pp. 201–218. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  10. 10.
    Dolan, S.: Fun with semirings: a functional pearl on the abuse of linear algebra. In: Morrisett, G., Uustalu, T. (eds.) ACM SIGPLAN International Conference on Functional Programming, ICFP 2013, 25–27 September, pp. 101–110. ACM, Boston (2013)Google Scholar
  11. 11.
    Domínguez, F., Pardo, A.: Program fusion with paramorphisms. In: Proceedings of the International Conference on Mathematically Structured Functional Programming, MSFP 2006, pp. 6–6. British Computer Society, Swinton (2006)Google Scholar
  12. 12.
    Gaboardi, M., Haeberlen, A., Hsu, J., Narayan, A., Pierce, B.C.: Linear dependent types for differential privacy. In: Giacobazzi, R., Cousot, R. (eds.) The 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2013, 23–25 January, pp. 357–370. ACM, Rome (2013)Google Scholar
  13. 13.
    Gay, S.J., Vasconcelos, V.T.: Linear type theory for asynchronous session types. J. Funct. Program. 20(1), 19–50 (2010)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Gentzen, G.: Untersuchungen über das logische schließen. Math. Z. 29(2–3), 176–210 (1935). 405–431MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Girard, J.-Y.: Linear logic. Theor. Comput. Sci. 50, 1–102 (1987)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Krishnaswami, N.R., Pradic, P., Benton, N.: Integrating linear and dependent types. In: Rajamani, S.K., Walker, D. (eds.) Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, 15-17 January 2015, pp. 17–30. ACM, Mumbai (2015)Google Scholar
  17. 17.
    Luo, Z.: ECC, an extended calculus of constructions. In: Proceedings of the Fourth Annual Symposium on Logic in Computer Science (LICS 1989), 5–8 June 1989, pp. 386–395. IEEE Computer Society, Pacific Grove (1989)Google Scholar
  18. 18.
    Martin-Löf, P.: An Intuitionistic theory of types: predicative part. In: Rose, H.E., Shepherdson, J.C. (eds.) Logic Colloquium 1973. North-Holland Publishing Company, Amsterdam (1975)Google Scholar
  19. 19.
    McKinna, J., Pollack, R.: Some lambda calculus and type theory formalized. J. Autom. Reasoning 23(3–4), 373–409 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Miquel, A.: The implicit calculus of constructions. In: Abramsky, S. (ed.) TLCA 2001. LNCS, vol. 2044, pp. 344–359. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  21. 21.
    Petricek, T., Orchard, D.A., Mycroft, A.: Coeffects: a calculus of context-dependent computation. In: Jeuring, J., Chakravarty, M.M.T. (eds.) Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, 1–3 September 2014, pp. 123–135. ACM, Gothenburg (2014)Google Scholar
  22. 22.
    Pierce, B.C., Turner, D.N.: Local type inference. ACM Trans. Program. Lang. Syst. 22(1), 1–44 (2000)CrossRefGoogle Scholar
  23. 23.
    Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP Congress, pp. 513–523 (1983)Google Scholar
  24. 24.
    Shi, R., Xi, H.: A linear type system for multicore programming in ATS. Sci. Comput. Program. 78(8), 1176–1192 (2013)CrossRefGoogle Scholar
  25. 25.
    Swamy, N., Chen, J., Fournet, C., Strub, P.-Y., Bhargavan, K., Yang, J.: Secure distributed programming with value-dependent types. J. Funct. Program. 23(4), 402–451 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  26. 26.
    Takahashi, M.: Parallel reductions in \(\lambda \)-calculus (revised version). Inf. Comput. 118(1), 120–127 (1995)CrossRefGoogle Scholar
  27. 27.
    Toninho, B., Caires, L., Pfenning, F.: Dependent session types via intuitionistic linear type theory. In: Schneider-Kamp, P., Hanus, M. (eds.) Proceedings of the 13th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, 20–22 July 2011, pp. 161–172. ACM, Odense (2011)Google Scholar
  28. 28.
    Vákár, M.: Syntax and Semantics of Linear Dependent Types. CoRR, abs/1405.0033 (2014)Google Scholar
  29. 29.
    Wadler, P.: Theorems for free! In: FPCA, pp. 347–359 (1989)Google Scholar
  30. 30.
    Wadler, P.: Is there a use for linear logic? In: Consel, C., Danvy, O. (eds.) Proceedings of the Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM 1991, Yale University, New Haven, Connecticut, USA, 17-19 June 1991, pp. 255–273. ACM (1991)Google Scholar
  31. 31.
    Wadler, P.: Propositions as sessions. In: Thiemann, P., Findler, R.B. (eds) ACM SIGPLAN International Conference on Functional Programming, ICFP 2012, 9–15 September 2012, pp. 273–286. ACM, Copenhagen (2012)Google Scholar
  32. 32.
    Watkins, K., Cervesato, I., Pfenning, F., Walker, D.W.: A concurrent logical framework: the propositional fragment. In: Berardi, S., Coppo, M., Damiani, F. (eds.) TYPES 2003. LNCS, vol. 3085, pp. 355–377. Springer, Heidelberg (2004)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  1. 1.Mathematically Structured ProgrammingUniversity of StrathclydeGlasgowScotland, UK

Personalised recommendations