The importance of subtyping to enable a wider range of well-typed programs is undeniable. However, the interaction between subtyping, recursion, and polymorphism is not completely understood yet. In this work, we explore subtyping in a system of nested, recursive, and polymorphic types with a coinductive interpretation, and we prove that this problem is undecidable. Our results will be broadly applicable, but to keep our study grounded in a concrete setting, we work with an extension of session types with explicit polymorphism, parametric type constructors, and nested types. We prove that subtyping is undecidable even for the fragment with only internal choices and nested unary recursive type constructors. Despite this negative result, we present a subtyping algorithm for our system and prove its soundness. We minimize the impact of the inescapable incompleteness by enabling the programmer to seed the algorithm with subtyping declarations (that are validated by the algorithm). We have implemented the proposed algorithm in Rast and it showed to be efficient in various example programs.
翻译:不可否认的是, 亚丁型对于更广大的精密类型程序的重要性。 然而, 亚丁型、 循环和多元形态之间的交互作用还没有得到完全理解。 在这项工作中, 我们探索在嵌套、 循环和多形态型的系统中进行亚丁型, 并带有一种硬币解释, 我们证明这个问题是不可分的。 我们的结果将广泛适用, 但是为了在混凝土环境中继续我们的研究, 我们用明确的多元形态、 参数类型构建器和嵌套类型来扩展会话类型。 我们证明, 亚丁型即使在碎片上也是不可分化的, 只有内部选择和嵌套的非循环型构建器。 尽管这种负面的结果, 我们为我们的系统提出了一个亚丁型算法, 并证明它的健全性。 我们通过让程序员能够以亚丁型声明( 经算法验证的) 来种子算法。 我们在Rast 中应用了拟议的算法, 它在各种程序中显示出效率 。