Gradualizing the Calculus of Inductive Constructions (CIC) involves dealing with subtle tensions between normalization, graduality, and conservativity with respect to CIC. Recently, GCIC has been proposed as a parametrized gradual type theory that admits three variants, each sacrificing one of these properties. For devising a gradual proof assistant based on CIC, normalization and conservativity with respect to CIC are key, but the tension with graduality needs to be addressed. Additionally, several challenges remain: (1) The presence of two wildcard terms at any type-the error and unknown terms-enables trivial proofs of any theorem, jeopardizing the use of a gradual type theory in a proof assistant; (2) Supporting general indexed inductive families, most prominently equality, is an open problem; (3) Theoretical accounts of gradual typing and graduality so far do not support handling type mismatches detected during reduction; (4) Precision and graduality are external notions not amenable to reasoning within a gradual type theory. All these issues manifest primally in CastCIC, the cast calculus used to define GCIC. In this work, we present an extension of CastCIC called GRIP. GRIP is a reasonably gradual type theory that addresses the issues above, featuring internal precision and general exception handling. GRIP features an impure (gradual) sort of types inhabited by errors and unknown terms, and a pure (non-gradual) sort of strict propositions for consistent reasoning about gradual terms. Internal precision supports reasoning about graduality within GRIP itself, for instance to characterize gradual exception-handling terms, and supports gradual subset types. We develop the metatheory of GRIP using a model formalized in Coq, and provide a prototype implementation of GRIP in Agda.
静态类型函数式语言的一个长期存在的缺点是类型检查不能排除模式匹配失败(运行时匹配异常)。细化类型区分不同的数据类型值;如果用细化注释的程序通过了类型检查,那么模式匹配失败就变得不可能了。不幸的是,细化是类型的单一属性,这加剧了向非平凡程序添加细化类型的难度。渐进式类型化探索了如何在静态类型化和动态类型化之间渐进地移动。我们开发了一个类型系统的逐步总和,结合细化与不精确。然后,我们开发了一个双向版本的类型系统,它排除了过度的不精确性,并给出了一个类型导向的翻译到一个目标语言显式转换。我们证明了静态子语言不能有匹配失败,一个良好类型的程序仍然是良好类型的,如果它的类型注释不太精确,并使注释不太精确的原因目标程序失败后。其中一些结果与Siek et al.(2015)给出的渐进分型标准相对应。
渐进类型语言允许程序员混合静态和动态类型代码,使他们能够在向代码添加类型注释时逐渐获得静态类型的好处。然而,这种类型的迁移过程通常是具有有限工具支持的手动工作。本文探讨了问题的\emph{automated type migration}:给定一个动态程序,推断额外的或改进的类型注释。现有的类型迁移算法优先考虑不同的目标,如最大限度地提高类型精度,保持与未迁移代码的兼容性,并保留原始程序的语义。我们认为,类型迁移问题涉及到根本的妥协:优化一个单一的目标往往是以牺牲他人。理想情况下,类型迁移工具将灵活地适应一系列用户优先级。我们提出了TypeWhich,一种新的方法来自动类型迁移的渐进类型的λ演算的一些扩展。与之前依赖于自定义求解器的工作不同,TypeWhich为现成的MaxSMT求解器产生约束。这使我们能够轻松地表达目标,例如最小化必要的语法转换器的数量,并约束迁移的类型以与未迁移的代码兼容。我们提出了GTLC类型的迁移算法的第一次全面评估,并比较TypeWhich的其他四个工具从文献中。我们的评估使用以前的基准,和一组新的“挑战问题”。此外,我们设计了一种新的评估方法,突出了渐进类型迁移的微妙之处。此外,我们应用TypeWhich的一套基准Grift,一个程序设计语言的基础上GTLC。TypeWhich能够在除了一个程序之外的所有程序上重建所有人类编写的注释。
本文提出了第一个机器检查证明的非干扰的语言与渐进的信息流控制,从而建立了坚实的基础,安全的程序设计语言,让程序员之间的选择运行时与编译时的执法。在这个过程中,我们发现了文献中的一个不干涉证明中的一个缺陷,并给出了一个主要引理的反例。本文研究的特定语言$λ_{\mathtt{SEC}}^\star$基于Azevedo de Amorim等人[2020]的GLIO语言。为了使设计更容易为其他研究人员,本文贡献了第一个传统的语义语言,也就是说,我们定义的编译从$λ_{\mathtt{SEC}}^\star$铸造演算和设计一个减少语义,后者包括责任跟踪。除了不干涉的证明,我们还机械化了类型安全、确定性和编译保留类型的证明。