Help me to understand the concept of "freshness" in Dafny #6118
Unanswered
rsingha108
asked this question in
Q&A
Replies: 1 comment
-
|
Is it possible to not have the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the above dafny code, I have a class
Datawith two sequences,src_seqanddst_seqand the methodm2adds elements fromsrc_seqtodst_seq. When I try to call methodm1withinm2it gives an errorcall might violate context's modifies clause.I understand that
m1needs a guarantee that the elements added todst_seqare fresh. For that I addedcopy()methods in the classesElementandX. Also added a loop invariantfresh((set o <- d.dst_seq[..]) - old((set o <- d.dst_seq[..])))to methodm2which mitigates the error.Is there a better way to mitigate the verification error, without duplicating using
copy()methods?Beta Was this translation helpful? Give feedback.
All reactions