Haskell的细化类型

Ranjit Jhala
{"title":"Haskell的细化类型","authors":"Ranjit Jhala","doi":"10.1145/2541568.2541569","DOIUrl":null,"url":null,"abstract":"We present LiquidHaskell (http://goto.ucsd.edu/liquid), an automatic verifier for Haskell. LiquidHaskell uses Refinement types, a restricted form of dependent types where relationships between values are encoded by decorating types with logical predicates drawn from an efficiently SMT decidable theory (of arithmetic and uninterpreted functions.)\n In this talk, we will describe the key ingredients of LiquidHaskell.\n First, we will present a rapid overview of refinement types, including SMT solver based (decidable) subtyping, and inference. Decidability is achieved by eschewing the use of arbitrary terms inside types, and the use of indices to encode rich properties of data.\n Second, we will show how to recover some of the expressiveness lost by restricting the logic, with two new techniques: measures which encode structural properties of values and abstract refinements which enable generalization (i.e. quantification) over refinements.\n Third, we will discuss the curious interaction of laziness and refinement typing. In a nutshell, the technique of refinement typing can be viewed as a type-based generalization of Floyd-Hoare logics. Surprisingly, we demonstrate that under non-strict evaluation, these logics (and hence, classical refinement typing) is unsound, due to the presence of potentially divergent sub-computations. Fortunately, we show how soundness can be recovered with a termination analysis, itself, circularly bootstrapped off refinement typing.\n We have used LiquidHaskell to verify safety, functional correctness and termination properties of real-world Haskell libraries totalling mroe than 10,000 lines of code. Time permitting, we will present a demonstration of the tool and a few short case studies illustrating its use.","PeriodicalId":153056,"journal":{"name":"Programming Languages meets Program Verification","volume":"79 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2014-01-11","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"198","resultStr":"{\"title\":\"Refinement types for Haskell\",\"authors\":\"Ranjit Jhala\",\"doi\":\"10.1145/2541568.2541569\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"We present LiquidHaskell (http://goto.ucsd.edu/liquid), an automatic verifier for Haskell. LiquidHaskell uses Refinement types, a restricted form of dependent types where relationships between values are encoded by decorating types with logical predicates drawn from an efficiently SMT decidable theory (of arithmetic and uninterpreted functions.)\\n In this talk, we will describe the key ingredients of LiquidHaskell.\\n First, we will present a rapid overview of refinement types, including SMT solver based (decidable) subtyping, and inference. Decidability is achieved by eschewing the use of arbitrary terms inside types, and the use of indices to encode rich properties of data.\\n Second, we will show how to recover some of the expressiveness lost by restricting the logic, with two new techniques: measures which encode structural properties of values and abstract refinements which enable generalization (i.e. quantification) over refinements.\\n Third, we will discuss the curious interaction of laziness and refinement typing. In a nutshell, the technique of refinement typing can be viewed as a type-based generalization of Floyd-Hoare logics. Surprisingly, we demonstrate that under non-strict evaluation, these logics (and hence, classical refinement typing) is unsound, due to the presence of potentially divergent sub-computations. Fortunately, we show how soundness can be recovered with a termination analysis, itself, circularly bootstrapped off refinement typing.\\n We have used LiquidHaskell to verify safety, functional correctness and termination properties of real-world Haskell libraries totalling mroe than 10,000 lines of code. Time permitting, we will present a demonstration of the tool and a few short case studies illustrating its use.\",\"PeriodicalId\":153056,\"journal\":{\"name\":\"Programming Languages meets Program Verification\",\"volume\":\"79 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2014-01-11\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"198\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Programming Languages meets Program Verification\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/2541568.2541569\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Programming Languages meets Program Verification","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2541568.2541569","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 198

摘要

我们介绍了LiquidHaskell (http://goto.ucsd.edu/liquid),一个Haskell的自动验证器。LiquidHaskell使用细化类型,这是依赖类型的一种限制形式,其中值之间的关系是通过使用从有效的SMT可判定理论(算术和未解释函数)中提取的逻辑谓词修饰类型来编码的。在这次演讲中,我们将描述LiquidHaskell的关键成分。首先,我们将快速概述细化类型,包括基于SMT求解器的(可确定的)子类型和推理。通过避免在类型内部使用任意术语,以及使用索引对数据的丰富属性进行编码,可以实现可判定性。其次,我们将展示如何通过两种新技术来恢复由于限制逻辑而失去的一些表达性:对值的结构属性进行编码的度量和对精化进行泛化(即量化)的抽象精化。第三,我们将讨论惰性和细化类型之间奇怪的相互作用。简而言之,精化类型技术可以看作是Floyd-Hoare逻辑的基于类型的泛化。令人惊讶的是,我们证明了在非严格求值下,这些逻辑(因此,经典的细化类型)是不可靠的,因为存在潜在的发散子计算。幸运的是,我们展示了如何通过终止分析来恢复可靠性,终止分析本身循环地从精化类型中启动。我们已经使用LiquidHaskell来验证真实世界的Haskell库的安全性、功能正确性和终止属性,总共超过10,000行代码。在时间允许的情况下,我们将展示该工具的演示和一些简短的案例研究来说明它的使用。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Refinement types for Haskell
We present LiquidHaskell (http://goto.ucsd.edu/liquid), an automatic verifier for Haskell. LiquidHaskell uses Refinement types, a restricted form of dependent types where relationships between values are encoded by decorating types with logical predicates drawn from an efficiently SMT decidable theory (of arithmetic and uninterpreted functions.) In this talk, we will describe the key ingredients of LiquidHaskell. First, we will present a rapid overview of refinement types, including SMT solver based (decidable) subtyping, and inference. Decidability is achieved by eschewing the use of arbitrary terms inside types, and the use of indices to encode rich properties of data. Second, we will show how to recover some of the expressiveness lost by restricting the logic, with two new techniques: measures which encode structural properties of values and abstract refinements which enable generalization (i.e. quantification) over refinements. Third, we will discuss the curious interaction of laziness and refinement typing. In a nutshell, the technique of refinement typing can be viewed as a type-based generalization of Floyd-Hoare logics. Surprisingly, we demonstrate that under non-strict evaluation, these logics (and hence, classical refinement typing) is unsound, due to the presence of potentially divergent sub-computations. Fortunately, we show how soundness can be recovered with a termination analysis, itself, circularly bootstrapped off refinement typing. We have used LiquidHaskell to verify safety, functional correctness and termination properties of real-world Haskell libraries totalling mroe than 10,000 lines of code. Time permitting, we will present a demonstration of the tool and a few short case studies illustrating its use.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信