{"title":"Extending the Quantitative Pattern-Matching Paradigm","authors":"Sandra Alves, Delia Kesner, Miguel Ramos","doi":"arxiv-2408.11007","DOIUrl":null,"url":null,"abstract":"We show how (well-established) type systems based on non-idempotent\nintersection types can be extended to characterize termination properties of\nfunctional programming languages with pattern matching features. To model such\nprogramming languages, we use a (weak and closed) $\\lambda$-calculus\nintegrating a pattern matching mechanism on algebraic data types (ADTs).\nRemarkably, we also show that this language not only encodes Plotkin's CBV and\nCBN $\\lambda$-calculus as well as other subsuming frameworks, such as the\nbang-calculus, but can also be used to interpret the semantics of effectful\nlanguages with exceptions. After a thorough study of the untyped language, we\nintroduce a type system based on intersection types, and we show through purely\nlogical methods that the set of terminating terms of the language corresponds\nexactly to that of well-typed terms. Moreover, by considering non-idempotent\nintersection types, this characterization turns out to be quantitative, i.e.\nthe size of the type derivation of a term t gives an upper bound for the number\nof evaluation steps from t to its normal form.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2024-08-20","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2408.11007","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
We show how (well-established) type systems based on non-idempotent
intersection types can be extended to characterize termination properties of
functional programming languages with pattern matching features. To model such
programming languages, we use a (weak and closed) $\lambda$-calculus
integrating a pattern matching mechanism on algebraic data types (ADTs).
Remarkably, we also show that this language not only encodes Plotkin's CBV and
CBN $\lambda$-calculus as well as other subsuming frameworks, such as the
bang-calculus, but can also be used to interpret the semantics of effectful
languages with exceptions. After a thorough study of the untyped language, we
introduce a type system based on intersection types, and we show through purely
logical methods that the set of terminating terms of the language corresponds
exactly to that of well-typed terms. Moreover, by considering non-idempotent
intersection types, this characterization turns out to be quantitative, i.e.
the size of the type derivation of a term t gives an upper bound for the number
of evaluation steps from t to its normal form.
我们展示了如何将基于非幂交集类型的(成熟的)类型系统扩展到表征具有模式匹配特征的函数式编程语言的终止属性。值得注意的是,我们还展示了这种语言不仅编码了普洛特金的CBV和CBN $\lambda$-calculus 以及其他子包含框架,比如砰算,而且还可以用来解释具有异常的效果语言的语义。在对无类型语言进行深入研究之后,我们引入了基于交集类型的类型系统,并通过纯逻辑方法证明了该语言的终止项集与类型良好的终止项集完全对应。此外,通过考虑非幂等交集类型,我们发现这种表征是定量的,即术语 t 的类型推导的大小给出了从 t 到其正常形式的求值步骤数的上限。