Skip to content

"....must be allocated in the two-state function's previous state" #1902

Answered by robin-aws
MikaelMayer asked this question in Q&A
Discussion options

You must be logged in to vote

I've hit this a bunch myself, especially while working on dafny-lang/libraries#37 which involves repeating a common post-condition many times. :P

Currently, all parameters to a two-state definition must be allocated before the previous state. This is so expressions using old(...) are always well-formed, as otherwise you can attempt to read heap state that didn't actually exist in the previous state of the heap.

You have more flexibility when making assertions in, for example, the body of a method, since you will only hit an error if you actually attempt to apply old(...) to an expression that refers to objects that were not already allocated on entry to the method. But a twostate abstract…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MikaelMayer
Comment options

@robin-aws
Comment options

@MikaelMayer
Comment options

Answer selected by robin-aws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants