Hostname: page-component-78c5997874-94fs2 Total loading time: 0 Render date: 2024-11-10T10:58:00.022Z Has data issue: false hasContentIssue false

Parameterized cast calculi and reusable meta-theory for gradually typed lambda calculi

Published online by Cambridge University Press:  11 November 2021

JEREMY G. SIEK
Affiliation:
Indiana University, Bloomington, IN47405, USA (e-mails: [email protected],[email protected])
TIANYU CHEN
Affiliation:
Indiana University, Bloomington, IN47405, USA (e-mails: [email protected],[email protected])
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.

The research on gradual typing has led to many variations on the Gradually Typed Lambda Calculus (GTLC) of Siek & Taha (2006) and its underlying cast calculus. For example, Wadler and Findler (2009) added blame tracking, Siek et al. (2009) investigated alternate cast evaluation strategies, and Herman et al. (2010) replaced casts with coercions for space efficiency. The meta-theory for the GTLC has also expanded beyond type safety to include blame safety (Tobin-Hochstadt & Felleisen, 2006), space consumption (Herman et al., 2010), and the gradual guarantees (Siek et al., 2015). These results have been proven for some variations of the GTLC but not others. Furthermore, researchers continue to develop variations on the GTLC, but establishing all of the meta-theory for new variations is time-consuming. This article identifies abstractions that capture similarities between many cast calculi in the form of two parameterized cast calculi, one for the purposes of language specification and the other to guide space-efficient implementations. The article then develops reusable meta-theory for these two calculi, proving type safety, blame safety, the gradual guarantees, and space consumption. Finally, the article instantiates this meta-theory for eight cast calculi including five from the literature and three new calculi. All of these definitions and theorems, including the two parameterized calculi, the reusable meta-theory, and the eight instantiations, are mechanized in Agda making extensive use of module parameters and dependent records to define the abstractions.

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution, and reproduction in any medium, provided the original work is properly cited.
Copyright
© The Author(s), 2021. Published by Cambridge University Press

References

Ahmed, A., Findler, R. B., Siek, J. G. & Wadler, P. (January 2011) Blame for all. In Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Ahmed, A., Jamner, D., Siek, J. G. & Wadler, P. (September 2017) Theorems for free for free: Parametricity, with and without types. In International Conference on Functional Programming, ICFP.CrossRefGoogle Scholar
Allende, E., Fabry, J. & Tanter, E. (2013) Cast insertion strategies for gradually-typed objects. In Proceedings of the 9th Symposium on Dynamic Languages, DLS ’13, New York, NY, USA: ACM, pp. 27–36.CrossRefGoogle Scholar
Aydemir, B. E., Bohannon, A., Fairbairn, M., Foster, J. N., Pierce, B. C., Sewell, P., Vytiniotis, D., Weirich, G. W. S. & Zdancewic, S. (May 2005) Mechanized Metatheory for the Masses: The POPLmark Challenge.CrossRefGoogle Scholar
Bañados Schwerter, F., Clark, A. M., Jafery, K. A. & Garcia, R. (January 2021) Abstracting gradual typing moving forward: Precise and space-efficient. Proc. ACM Program. Lang. 50 (POPL). doi: 10.1145/3434342.CrossRefGoogle Scholar
Bierman, G., Abadi, M. & Torgersen, M. (2014) Understanding TypeScript. In ECOOP 2014 – Object-Oriented Programming, Jones, R. (ed), vol. 8586. Lecture Notes in Computer Science. Springer Berlin Heidelberg, pp. 257–281.CrossRefGoogle Scholar
Bove, A., Dybjer, P. & Norell, U. (2009) A brief overview of agda — A functional language with dependent types. In Proceedings of the 22nd International Conference on Theorem Proving in Higher Order Logics, TPHOLs ’09, Berlin, Heidelberg: Springer-Verlag, pp. 73–78.CrossRefGoogle Scholar
Bracha, G. (2004) Pluggable type systems. In OOPSLA’04 Workshop on Revival of Dynamic Languages.Google Scholar
Bracha, G. & Griswold, D. (1993) Strongtalk: typechecking Smalltalk in a production environment. In OOPSLA ’93: Proceedings of the Eighth Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, New York, NY, USA: ACM Press, pp. 215–230. ISBN 0-89791-587-9.CrossRefGoogle Scholar
Castagna, G. & Lanvin, V. (2017) Gradual typing with union and intersection types. In International Conference on Functional Programming.CrossRefGoogle Scholar
Castagna, G., Lanvin, V., Petrucciani, T. & Siek, J. G. (2019) Gradual typing: A new perspective. Proc. ACM Program. Lang. 30 (POPL), 0 16:1–16:32. ISSN 2475-1421. doi: 10.1145/3290329.CrossRefGoogle Scholar
Chaudhuri, A. Flow: A static type checker for Javascript. Available at: http://flowtype.org/ Google Scholar
Chung, B., Li, P., Nardelli, F. Z. & Vitek, J. (2018) KafKa: Gradual typing for objects. In 32nd European Conference on Object-Oriented Programming (ECOOP 2018), Millstein, T. (ed), vol. 109. Leibniz International Proceedings in Informatics (LIPIcs), Dagstuhl, Germany, Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, pp. 12:1–12:24. ISBN 978-3-95977-079-8. doi: 10.4230/LIPIcs.ECOOP.2018.12. Available at: http://drops.dagstuhl.de/opus/volltexte/2018/9217.Google Scholar
Eremondi, J., Tanter, E. & Garcia, R. (July 2019) Approximate normalization for gradual dependent types. Proc. ACM Program. Lang. 30 (ICFP). doi: 10.1145/3341692.CrossRefGoogle Scholar
Felleisen, M. & Friedman, D. P. (1986) Control operators, the SECD-machine and the lambda-calculus, pp. 193–217.Google Scholar
Flanagan, C. (January 2006) Hybrid type checking. In POPL 2006: The 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Charleston, South Carolina, pp. 245256.CrossRefGoogle Scholar
Garcia, R. (2013) Calculating threesomes, with blame. In ICFP ’13: Proceedings of the International Conference on Functional Programming.CrossRefGoogle Scholar
Garcia, R. & Cimini, M. (2015) Principal type schemes for gradual programs. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’15. ACM, pp. 303–315.CrossRefGoogle Scholar
Garcia, R., Clark, A. M. & Tanter, E. (2016) Abstracting gradual typing. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, New York, NY, USA: ACM, pp. 429442. ISBN 978-1-4503-3549-2. doi: 10.1145/2837614.2837670.CrossRefGoogle Scholar
Garca-Pérez, A., Nogueira, P. & Sergey, I. (2014) Deriving interpretations of the gradually-typed lambda calculus. In Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation, PEPM ’14, New York, NY, USA: ACM, pp. 157–168. ISBN 978-1-4503-2619-3. doi: 10.1145/2543728.2543742.CrossRefGoogle Scholar
Greenman, B. (November 2020) Deep and Shallow Types. PhD thesis, Northeastern University.Google Scholar
Greenman, B. & Felleisen, M. (2018) A spectrum of type soundness and performance. Proc. ACM Program. Lang. 20 (ICFP), 0 71:1–71:32. ISSN 2475-1421. doi: 10.1145/3236766.CrossRefGoogle Scholar
Greenman, B. & Migeed, Z. (2018) On the cost of type-tag soundness. In Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM ’18, New York, NY, USA: ACM, pp. 30–39. ISBN 978-1-4503-5587-2. doi: 10.1145/3162066.CrossRefGoogle Scholar
Gronski, J., Knowles, K., Tomb, A., Freund, S. N. & Flanagan, C. (2006) Sage: Hybrid checking for flexible specifications. In Scheme and Functional Programming Workshop, pp. 93104.Google Scholar
Henglein, F. (1994). Dynamic typing: Syntax and proof theory. Sci. Comput. Program. 220 (3), 0 197230.CrossRefGoogle Scholar
Herman, D., Tomb, A. & Flanagan, C. (2007) Space-efficient gradual typing. In Trends in Functional Prog. (TFP), p. XXVIII.Google Scholar
Herman, D., Tomb, A. & Flanagan, C. (2010) Space-efficient gradual typing. Higher-Order Symb. Comput. 230 (2), 0 167–189.Google Scholar
Howard, W. A. (1980). The Formulae-as-Types Notion of Construction. Academic Press.Google Scholar
Kuhlenschmidt, A., Almahallawi, D. & Siek, J. G. (2019) Toward efficient gradual typing for structural types via coercions. In Conference on Programming Language Design and Implementation, PLDI. ACM.CrossRefGoogle Scholar
Lennon-Bertrand, M., Maillard, K., Tabareau, N. & Tanter, É. (2020) Gradualizing the Calculus of Inductive Constructions.Google Scholar
Lu, K.-C. (April 2020) Equivalence of Cast Representations in Gradual Typing. Master’s thesis, Indiana University.Google Scholar
Lu, K.-C., Siek, J. G. & Kuhlenschmidt, A. (2020). Hypercoercions and a framework for equivalence of cast calculi. In Workshop on Gradual Typing.Google Scholar
Maidl, A. M., Mascarenhas, F. & Ierusalimschy, R. (2014) Typed lua: An optional type system for lua. In Proceedings of the Workshop on Dynamic Languages and Applications, Dyla’14, New York, NY, USA: ACM, pp. 3:1–3:10.CrossRefGoogle Scholar
Matthews, J. & Findler, R. B. (January 2007) Operational semantics for multi-language programs. In The 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Muehlboeck, F. & Tate, R. (2017). Sound gradual typing is nominally alive and well. Proc. ACM Program. Lang. 10 (OOPSLA), 0 56:1–56:30. ISSN 2475-1421. doi: 10.1145/3133880.CrossRefGoogle Scholar
New, M. S., Jamner, D. & Ahmed, A. (2019) Graduality and parametricity: Together again for the first time. Proc. ACM Program. Lang. 40 (POPL), doi: 10.1145/3371114.CrossRefGoogle Scholar
Nipkow, T., Paulson, L. C. & Wenzel, M. (November 2007) Isabelle/HOL — A Proof Assistant for Higher-Order Logic, vol. 2283. LNCS. Springer.Google Scholar
Siek, J. G. & Garcia, R. (2012) Interpretations of the gradually-typed lambda calculus. In Scheme and Functional Programming Workshop.CrossRefGoogle Scholar
Siek, J. G. & Taha, W. (2006a) Gradual typing for functional languages. In Scheme and Functional Programming Workshop, pp. 8192.Google Scholar
Siek, J. G. & Taha, W. (December 2006b). Gradual Typing for Objects: Isabelle Formaliztaion. Technical Report CU-CS-1021-06, Boulder, CO: University of Colorado.Google Scholar
Siek, J. G. & Taha, W. (2006c). Gradual Typing: Isabelle/Isar Formalization. Technical Report TR06-874, Houston, Texas: Rice University.Google Scholar
Siek, J. G. & Taha, W. (August 2007) Gradual typing for objects. In European Conference on Object-Oriented Programming, vol. 4609. LNCS, pp. 2–27.Google Scholar
Siek, J. G. & Vachharajani, M. (2008) Gradual typing and unification-based inference. In DLS.CrossRefGoogle Scholar
Siek, J. G. & Vitousek, M. M. (2013) Monotonic references for gradual typing. CoRR, abs/1312.0694.Google Scholar
Siek, J. G. & Wadler, P. (January 2010) Threesomes, with and without blame. In Symposium on Principles of Programming Languages, POPL, pp. 365–376.CrossRefGoogle Scholar
Siek, J. G., Garcia, R. & Taha, W. (March 2009) Exploring the design space of higher-order casts. In European Symposium on Programming, ESOP, pp. 1731.Google Scholar
Siek, J. G., Thiemann, P. & Wadler, P. (June 2015a) Blame and coercion: Together again for the first time. In Conference on Programming Language Design and Implementation, PLDI.CrossRefGoogle Scholar
Siek, J. G., Vitousek, M. M., Cimini, M. & Boyland, J. T. (May 2015b) Refined criteria for gradual typing. In SNAPL: Summit on Advances in Programming Languages, LIPIcs: Leibniz International Proceedings in Informatics.Google Scholar
Siek, J. G., Vitousek, M. M., Cimini, M., Tobin-Hochstadt, S. & Garcia, R. (April 2015c) Monotonic references for efficient gradual typing. In European Symposium on Programming, ESOP.CrossRefGoogle Scholar
Takikawa, A. (April 2016) The Design, Implementation, and Evaluation of a Gradual Type System for Dynamic Class Composition. PhD thesis, Northeastern University.Google Scholar
Takikawa, A., Strickland, T. S., Dimoulas, C., Tobin-Hochstadt, S. & Felleisen, M. (2012) Gradual typing for first-class classes. In Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA ’12, pp. 793–810.CrossRefGoogle Scholar
Takikawa, A., Feltey, D., Greenman, B., New, M., Vitek, J. & Felleisen, M. (January 2016) Is sound gradual typing dead? In Principles of Programming Languages, POPL. ACM.CrossRefGoogle Scholar
The Coq Dev. Team. (April 2004) The Coq Proof Assistant Reference Manual – Version V8.0. Available at: http://coq.inria.fr.Google Scholar
Tobin-Hochstadt, S. & Felleisen, M. (2006) Interlanguage migration: From scripts to programs. In Dynamic Languages Symposium.CrossRefGoogle Scholar
Tobin-Hochstadt, S. & Felleisen, M. (January 2008) The design and implementation of Typed Scheme. In Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Toro, M. & Tanter, É. (2020) Abstracting gradual references. Sci. Comput. Program. 197, 0 102496. ISSN 0167-6423. doi: https://doi.org/10.1016/j.scico.2020.102496. Available at: http://www.sciencedirect.com/science/article/pii/S0167642320301052.CrossRefGoogle Scholar
Toro, M., Labrada, E. & Tanter, E. (2019) Gradual parametricity, revisited. Proc. ACM Program. Lang. 30 (POPL), 0 17:1–17:30. ISSN 2475-1421. doi: 10.1145/3290330.CrossRefGoogle Scholar
Verlaguet, J. & Menghrajani, A. Hack: A new programming langauge for HHVM. Available at: https://code.facebook.com/posts/264544830379293/hack-a-new-programming-language-for-hhvm/ Google Scholar
Vitek, J. (2016) Gradual types for real-world objects. In Script To Program Evolution Workshop, STOP.Google Scholar
Vitousek, M. & Siek, J. (2016a) From optional to gradual typing via transient checks. In Script To Program Evolution Workshop, STOP.Google Scholar
Vitousek, M., Swords, C. & Siek, J. G. (2017) Big types in little runtime. In Symposium on Principles of Programming Languages, POPL.Google Scholar
Vitousek, M. M. & Siek, J. G. (October 206b) Gradual Typing in An Open World. Technical Report TR729, Indiana University.Google Scholar
Vitousek, M. M., Siek, J. G. & Chaudhuri, A. (2019) Optimizing and evaluating transient gradual typing. In Proceedings of the 15th ACM SIGPLAN International Symposium on Dynamic Languages, DLS 2019, New York, NY, USA: Association for Computing Machinery, pp. 2841. ISBN 9781450369961. doi: 10.1145/3359619.3359742.CrossRefGoogle Scholar
Wadler, P. & Findler, R. B. (2007) Well-typed programs can’t be blamed. In Workshop on Scheme and Functional Programming, pp. 15–26.Google Scholar
Wadler, P. & Findler, R. B. (March 2009) Well-typed programs can’t be blamed. In European Symposium on Programming, ESOP, pp. 1–16.CrossRefGoogle Scholar
Wadler, P. & Kokke, W. (2019) Programming Language Foundations in Agda. Available at http://plfa.inf.ed.ac.uk/ CrossRefGoogle Scholar
Xie, N., Bi, X. & Oliveira, B. C. d. S. (2018) Consistent subtyping for all. In Programming Languages and Systems, Ahmed, A. (ed), pp. 330, Cham: Springer International Publishing. ISBN 978-3-319-89884-1.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.