Quantcast
Channel: Dafny: An Automatic Program Verifier for Functional Correctness
Viewing all articles
Browse latest Browse all 1106

Created Unassigned: Assign-such-that doesn't ensure typedness [52]

$
0
0
The ":|" declaration, when used to declare multiple variables simultaneously, doesn't ensure the typedness ("$Is(...)") of the variables.

var path:seq<int>,other:int :| true;
assume f(path);
assert exists path :: f(path); // fails

The Dafny line "var path:Path,other:int :| true;" becomes this Boogie code:

var path#7: Seq Box where $Is(path#7, TSeq(TInt)) && $IsAlloc(path#7, TSeq(TInt), $Heap);
...
havoc $rhs#0;
assume true;
havoc $rhs#1;
assume true;
path#7 := $rhs#0;
other#8 := $rhs#1;

Because "$rhs#0" got havoc'd and assigned to "path#7", rather than "path#7" getting havoc'd directly, the "where $Is..." for "path#7" apparently never kicked in. Saying "havoc path#7;
assume path#7 == $rhs#0;" rather than "path#7 := $rhs#0;" fixes the problem.



Viewing all articles
Browse latest Browse all 1106

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>