Skip to content

Postconditiosn on FnOnce closures #698

Answered by xldenis
xldenis asked this question in Help
Discussion options

You must be logged in to vote

In short the answer is to add #[ensures(run.resolve())] to the specification of skip.

The full answer is a bit longer.

Unlike many traditional verification tools, Creusot doesn't really have a notion of 'post-state', it views Rust functions as affine functions which consume their arguments, meaning run no longer exists after the function call.
The only way to have inter-procedure mutations / side-effects is through &mut and thus through propecies.

If we write a function fn drop_mut(x :&mut u32) { } , we specify that x is unchanged by adding the postcondition ^x == *x.

Naturally we can ask ourselves how this can generalize to an arbitrary type, potentially containing mutable borrows (and t…

Replies: 1 comment

Comment options

xldenis
Feb 27, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by jhjourdan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant