Linearity and dependency analyses are key to several applications in computer science, especially, in resource management and information flow control. What connects these analyses is that both of them need to model at least two different worlds with constrained mutual interaction. Though linearity and dependency analyses address similar problems, the analyses are carried out by employing different methods. For linearity analysis, type systems employ the comonadic exponential modality from Girard's linear logic. For dependency analysis, type systems employ the monadic modality from Moggi's computational metalanguage. Owing to this methodical difference, a unification of the two analyses, though theoretically and practically desirable, is not straightforward. Fortunately, with recent advances in graded-context type systems, it has been realized that linearity and dependency analyses can be viewed through the same lens. However, existing graded-context type systems fall short of a unification of linearity and dependency analyses. The problem with existing graded-context type systems is that though their linearity analysis is general, their dependency analysis is limited, primarily because the graded modality they employ is comonadic and not monadic. In this paper, we address this limitation by systematically extending existing graded-context type systems so that the graded modality is both comonadic and monadic. This extension enables us to unify linearity analysis with a general dependency analysis. We present a unified Linear Dependency Calculus, LDC, which analyses linearity and dependency using the same mechanism in an arbitrary Pure Type System. We show that LDC is a general linear and dependency calculus by subsuming into it the standard calculi for the individual analyses.
翻译:线性和依赖性分析对于计算机科学中的若干应用非常关键,特别是在资源管理和信息流控制方面。连接这些分析的关键是它们都需要建模至少两个不同的世界,并且具有相互制约的交互作用。尽管线性和依赖性分析解决了类似的问题,但通过采用不同的方法进行分析。针对线性分析,类型系统使用Girard的线性逻辑的共单同构指数模态。针对依赖性分析,类型系统使用Moggi的计算元语言的单同构模态。由于这种方法上的差异,尽管理论上和实践上都是可行的,但统一这两种分析并不是很简单。幸运的是,随着分级上下文类型系统的最新进展,已经意识到线性和依赖性分析可以通过同一视角来观察。但是,现有的分级上下文类型系统无法统一线性和依赖性分析。现有分级上下文类型系统的问题在于,尽管其线性分析是通用的,但其依赖性分析是有限的,主要是因为它们采用的分级模态是共单同构的而不是单同构的。在本文中,我们通过系统地扩展现有的分级上下文类型系统来解决这个限制,使得分级模态既是共单同构的,又是单同构的。这种扩展使我们能够通过相同的机制在任何纯类型系统中对线性和依赖性进行统一的分析。我们提出了一个统一的线性依赖计算,即LDC,在任意纯类型系统中使用相同的机制对线性和依赖性进行分析。我们证明了LDC是一个通用的线性和依赖性方案,可以将标准的单独计算合并进来。