Abstract
Subtypes are useful and ubiquitous, allowing important properties of data to be captured directly in types. However, the standard encoding of subtypes gives no control over when the reduction of subtyping proofs takes place, which can significantly impact the performance of type-checking. In this article, we show how operations on a subtype can be represented in a more efficient manner that exhibits no reduction behaviour. We present the general form of the technique in Cubical Agda by exploiting its support by higher-inductive types, and demonstrate the practical use of the technique with a number of examples.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Altenkirch, T., Ghani, N., Hancock, P., McBride, C., Morris, P.: Indexed containers. J. Funct. Program. 25 (2015)
Cockx, J., Devriese, D., Piessens, F.: Pattern matching without K. In: Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, pp. 257–268 (2014)
Cohen, C., Coquand, T., Huber, S., Mörtberg, A.: Cubical type theory: a constructive interpretation of the univalence axiom. arXiv preprint arXiv:1611.02108 (2016)
Dybjer, P., Setzer, A.: Induction-recursion and initial algebras. Ann. Pure Appl. Log. 124(1–3) (2003)
Gilbert, G., Cockx, J., Sozeau, M., Tabareau, N.: Definitional proof-irrelevance without K. Proc. ACM Program. Lang. 3(POPL) (Jan 2019). https://doi.org/10.1145/3290316
Hancock, P., McBride, C., Ghani, N., Malatesta, L., Altenkirch, T.: Small induction recursion. In: Hasegawa, M. (ed.) TLCA 2013. LNCS, vol. 7941, pp. 156–172. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-38946-7_13
Hewer, B.: Subtyping Cubical Agda Library (2022). https://tinyurl.com/f8pezwxd
Kraus, N.: Ph.D. thesis, University of Nottingham (2015)
Malatesta, L., Altenkirch, T., Ghani, N., Hancock, P., McBride, C.: Small induction recursion, indexed containers and dependent polynomials are equivalent (2012)
Morris, P., Altenkirch, T.: Indexed containers. In: IEEE Symposium in Logic in Computer Science (2009)
Shulman, M.: Higher inductive-recursive univalence and type-directed definitions, June 2014. https://homotopytypetheory.org/2014/06/08/hiru-tdd/
Program, T.U.F.: Homotopy type theory: univalent foundations of mathematics. Technical report, Institute for Advanced Study (2013)
Vezzosi, A., Mörtberg, A., Abel, A.: Cubical Agda: a dependently typed programming language with univalence and higher inductive types. J. Funct. Program. 31 (2021)
Acknowledgements
We would like to thank Nicolai Kraus for many interesting discussions, and the anonymous reviewers for their useful comments and suggestions. This work was funded by the EPSRC grant EP/P00587X/1, Mind the Gap: Unified Reasoning About Program Correctness and Efficiency.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Hewer, B., Hutton, G. (2022). Subtyping Without Reduction. In: Komendantskaya, E. (eds) Mathematics of Program Construction. MPC 2022. Lecture Notes in Computer Science, vol 13544. Springer, Cham. https://doi.org/10.1007/978-3-031-16912-0_2
Download citation
DOI: https://doi.org/10.1007/978-3-031-16912-0_2
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-16911-3
Online ISBN: 978-3-031-16912-0
eBook Packages: Computer ScienceComputer Science (R0)