当前位置: X-MOL 学术 › Fundam. Inform. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Combining Static and Dynamic Contract Checking for Curry
Fundamenta Informaticae ( IF 1.166 ) Pub Date : 2020-03-31 , DOI: 10.3233/fi-2020-1925
Michael Hanus 1
Affiliation  

Static type systems are usually not sufficient to express all requirements on function calls. Hence, contracts with pre- and postconditions can be used to express more complex constraints on operations. Contracts can be checked at run time to ensure that operations are only invoked with reasonablearguments and return intended results. Although such dynamic contract checking provides more reliable program execution, it requires execution time and could lead to program crashes that might be detected with more advanced methods at compile time. To improve this situation for declarative languages, we present an approach to combine static and dynamic contract checking for the functional logic language Curry. Based on a formal model of contract checking for functional logic programming, we propose an automatic method to verify contracts at compile time. If a contract is successfully verified, it can be omitted from dynamic checking. This method decreases execution time without degrading reliable program execution. In the best case, when all contracts are statically verified, it provides trust in the software since crashes due to contract violations cannot occur during program execution.

中文翻译:

结合静态和动态合同检查咖喱

静态类型系统通常不足以表达对函数调用的所有要求。因此,具有前置条件和后置条件的合同可用于表达对操作的更复杂约束。可以在运行时检查合同,以确保仅以合理的参数调用操作并返回预期结果。尽管这种动态合同检查提供了更可靠的程序执行,但它需要执行时间,并且可能导致程序崩溃,而这些崩溃可能在编译时由更高级的方法检测到。为了改善声明性语言的这种情况,我们提出了一种将静态和动态协定检查结合起来用于功能逻辑语言Curry的方法。基于用于功能逻辑编程的合同检查的正式模型,我们提出了一种在编译时验证合同的自动方法。如果合同已成功验证,则可以从动态检查中将其省略。此方法减少了执行时间,而不会降低可靠的程序执行速度。最好的情况是,当所有合同都经过静态验证时,它会提供对软件的信任,因为在程序执行期间不会因合同违规而导致崩溃。
更新日期:2020-03-31
down
wechat
bug