Refinement type checkers are a powerful way to reason about functional programs. For example, one can prove properties of a slow, specification implementation, porting the proofs to an optimized implementation that behaves the same. Without functional extensionality, proofs must relate functions that are fully applied. When data itself has a higher-order representation, fully applied proofs face serious impediments! When working with first-order data, fully applied proofs lead to noisome duplication when using higher-order functions. While dependent type theories are typically consistent with functional extensionality axioms, refinement type systems with semantic subtyping treat naive phrasings of functional extensionality inconsistently, leading to unsoundness. We demonstrate this unsoundness and develop a new approach to equality in Liquid Haskell: we define a propositional equality in a library we call PEq. Using PEq avoids the unsoundness while still proving useful equalities at higher types; we demonstrate its use in several case studies. We validate PEq by building a small model and developing its metatheory. Additionally, we prove metaproperties of PEq inside Liquid Haskell itself using an unnamed folklore technique, which we dub `classy induction'.
翻译:精细类型校验器是解释功能性程序的一个有力方法。 例如, 能够证明缓慢、 规格执行的特性, 将证明移植到行为相同的优化执行的特性。 没有功能扩展性, 证明必须涉及到完全应用的功能。 当数据本身具有更高级的表示方式时, 完全应用的证明会面临严重障碍 。 当使用一阶数据时, 充分应用的证明会导致在使用更高级功能时出现恶性重复 。 虽然依赖性类型理论通常与功能扩展性轴轴一致, 改进类型系统, 精细的语义下亚型系统处理功能扩展性天性天性表达式处理方法前后不一致, 导致不健全 。 我们展示了这种不健全性, 并开发了在液 Haskell 中实现平等的新方法 : 我们定义了在我们称为 PEq 的图书馆中的主张平等。 使用 PEqq 来避免不健全之处, 同时证明在更高类型上仍然有用的平等性 ; 我们在若干案例研究中展示了它的用途 。 我们通过建立小型模型和开发其非元理论来验证PEq 。 此外, 我们验证了“ ”, 我们用了“ Hashqliglishemal ” 。