What are the relationships among imports, includes, and verification in Dafny?

霸气de小男生 提交于 2021-01-28 08:51:36

问题


I know one Dafny source file can be included in another, leading to textual concatenation of the files prior to verification. But I don't have a clear mental model of the relationships between includes, imports, and which files are verified when. Perhaps an expert can elaborate. Thanks.


回答1:


This is at least partially documented in the Dafny Reference Manual in various sections.

Section 2.0 discusses include:

Included files also obey the Dafny grammar. Dafny parses and processes the transitive closure of the original source files and all the included files, but will not invoke the verifier on these unless they have been listed explicitly on the command line.

(emphasis mine)

Section 3.1 discusses import, which is a feature of Dafny's module system. You can only use import inside of a module, to make available the definitions in another module. Note that the Dafny module system is independent of how files are stored on disk, unlike some other languages. So if the module you are importing is defined in another file, you may have to include that file if you haven't already.

import has no direct influence on whether the imported module is verified or not. Modules in other files will not be verified unless their file is listed on the command line. Modules in the current file are always verified (whether or not they are imported by anyone).



来源:https://stackoverflow.com/questions/48491332/what-are-the-relationships-among-imports-includes-and-verification-in-dafny

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!