Hostname: page-component-7c8c6479df-r7xzm Total loading time: 0 Render date: 2024-03-28T09:38:04.376Z Has data issue: false hasContentIssue false

Efficiency of lambda-encodings in total type theory

Published online by Cambridge University Press:  10 March 2016

AARON STUMP
Affiliation:
Computer Science, The University of Iowa, Iowa City, Iowa, USA (e-mail: astump@acm.org)
PENG FU
Affiliation:
Computer Science, The University of Dundee, Dundee, Scotland (e-mail: pfu@dundee.ac.uk)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

This paper proposes a new typed lambda-encoding for inductive types which, for Peano numerals, has the expected time complexities for basic operations like addition and multiplication, has a constant-time predecessor function, and requires only quadratic space to encode a numeral. This improves on the exponential space required by the Parigot encoding. Like the Parigot encoding, the new encoding is typable in System F-omega plus positive-recursive type definitions, a total type theory. The new encoding is compared with previous ones through a significant case study: mergesort using Braun trees. The practical runtime efficiency of the new encoding, and the Church and Parigot encodings, are compared by two translations, one to Racket and one to Haskell, on a small suite of benchmarks.

Type
Articles
Copyright
Copyright © Cambridge University Press 2016 

References

Abel, A. & Matthes, R. (2004) Fixed points of type constructors and primitive recursion. In Proceedings of 18th International Workshop Computer Science Logic (CSL), Marcinkowski, J. & Tarlecki, A. (eds), pp. 190–204.CrossRefGoogle Scholar
Barendregt, H. (1985) The Lambda Calculus: Its Syntax and Semantics. North-Holland.Google Scholar
Böhm, C. & Berarducci, A. (1985) Automatic synthesis of typed λ-programs on term algebras. Theor. Comput. Sci. 39 (0), 135154.CrossRefGoogle Scholar
Church, A. (1941) The Calculi of Lambda Conversion. Annals of Mathematics Studies, no. 6, Princeton University Press.Google Scholar
Curry, H., Hindley, R. & Seldin, J. (1972) Combinatory Logic. vol. 2. North-Holland.Google Scholar
Felleisen, M., Findler, R. B. & Flatt, M. (2009) Semantics Engineering with PLT Redex. MIT Press.Google Scholar
Flatt, M. & PLT. (2010) Reference: Racket. Technical Report PLT-TR-2010-1. PLT Design Inc. http://racket-lang.org/tr1/.Google Scholar
Fu, P. & Stump, A. (2014) Self types for dependently typed lambda encodings. In Proceedings of 25th International Conference on Rewriting Techniques and Applications (RTA) joint with the 12th International Conference on Typed Lambda Calculi and Applications (TLCA), Dowek, G. (ed), Lecture Notes in Computer Science, vol. 8560, Springer, pp. 224–239.CrossRefGoogle Scholar
Hinze, R. (2005) Church numerals, twice! J. Funct. Program. 15 (1), 113.CrossRefGoogle Scholar
Jones, S. L. P. (1987) The Implementation of Functional Programming Languages. Prentice-Hall.Google Scholar
Koopman, P., Plasmeijer, R & Jansen, J. M. (2014) Church encoding of data types considered harmful for implementations. In Proceedings of 26th Symposium on Implementation and Application of Functional Languages (IFL), Plasmeijer, R. & Tobin-Hochstadt, S. (eds), Presented version.CrossRefGoogle Scholar
Mogensen, T. (2001) An investigation of compact and efficient number representations in the pure lambda calculus. In Perspectives of System Informatics, Bjørner, D., Broy, M. & Zamulin, A. (eds), Lecture Notes in Computer Science, vol. 2244, Springer.Google Scholar
Norrell, U. & the Agda Development Team. (2014) The Agda Wiki.Google Scholar
Okasaki, C. (1997) Three Algorithms on Braun Trees. J. Funct. Program. 7 (6), 661666.CrossRefGoogle Scholar
Parigot, M. (1988) Programming with proofs: A second order type theory. In European Symposium On Programming (ESOP), Ganzinger, H. (ed), Lecture Notes in Computer Science, vol. 300.Google Scholar
Parigot, M. (1989) On the representation of data in lambda-calculus. In Proceedings of 3rd Workshop on Computer Science Logic (CSL), Börger, E., Büning, H. & Richter, M. (eds), Lecture Notes in Computer Science, vol. 440, Springer, pp. 309321.Google Scholar
The Coq development team. (2014) The Coq proof assistant reference manual. LogiCal Project. Version 8.4.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.