我想证明使用Dafny的以下程序的正确性/不正确性。dafny可以显示一个失败断言的反例吗?
datatype List<T> = Nil | Cons(T, List)
function tail(l:List):List
{
match l
case Nil => Nil
case Cons(x,xs) => xs
}
method check(l:List)
{
assert(expr(l)!=2);
}
function expr(l : List):int
{
if(l == Nil) then 0
else if(tail(l)==Nil) then 1
else if(tail(tail(l)) == Nil) then 2
else 3
}
Dafny成功地证明断言是不正确的。 但是它没有给出断言失败的例子。戴夫尼可以自己举这样一个例子吗?
我在Dafny的网页上看到类似的指标。我没有进入视觉工作室。命令行版本的Dafny显示类似的东西吗? – ankitrokdeonsns
据我所知目前还不支持。在Dafny codeplex页面上再次提问你的问题可能是值得的。 – lexicalscope