首页> 外文期刊>Formal Aspects of Computing >Invariant based programming: basic approach and teaching experiences
【24h】

Invariant based programming: basic approach and teaching experiences

机译:基于不变式的编程:基本方法和教学经验

获取原文
获取原文并翻译 | 示例

摘要

Program verification is usually done by adding specifications and invariants to the program and then proving that the verification conditions are all true. This makes program verification an alternative to or a complement to testing. We describe here another approach to program construction, which we refer to as invariant based programming, where we start by formulating the specifications and the internal loop invariants for the program, before we write the program code itself. The correctness of the code is then easy to check at the same time as one is constructing it. In this approach, program verification becomes a complement to coding rather than to testing. The purpose is to produce programs and software that are correct by construction. We present a new kind of diagrams, nested invariant diagrams, where program specifications and invariants (rather than the control) provide the main organizing structure. Nesting of invariants provide an extension hierarchy that allows us to express the invariants in a very compact manner. We have studied the feasibility of formulating specifications and loop invariants before the code itself has been written in a number of case studies. Our experience is that a systematic use of figures, in combination with a rough idea of the intended behavior of the algorithm, makes it rather straightforward to formulate the invariants needed for the program, to construct the code around these invariants and to check that the resulting program is indeed correct. We describe our experiences from using invariant based programming in practice, both from teaching programmers how to construct programs that they prove correct themselves, and from teaching invariant based programming for CS students in class.
机译:程序验证通常是通过向程序中添加规范和不变式,然后证明验证条件都是真实的来完成的。这使程序验证成为测试的替代或补充。我们在这里描述了另一种程序构建方法,我们称其为基于不变式的编程,在编写程序代码本身之前,我们首先为程序制定规格和内部循环不变式。这样,在构造代码的同时就很容易检查其正确性。在这种方法中,程序验证成为编码而不是测试的补充。目的是产生通过构造正确的程序和软件。我们提出了一种新的图,嵌套不变图,其中程序规范和不变式(而不是控件)提供了主要的组织结构。不变式的嵌套提供了扩展层次结构,使我们能够以非常紧凑的方式表达不变式。在许多案例研究中编写代码本身之前,我们已经研究了制定规格和循环不变式的可行性。我们的经验是,对图形的系统使用以及对算法预期行为的粗略理解,使得制定程序所需的不变式,围绕这些不变式构造代码并检查结果是否相当简单。程序确实是正确的。我们描述了在实践中使用基于不变式程序的经验,既教导程序员如何构造证明自己正确的程序,也为课堂上CS学生教授基于不变式程序的经验。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号