Skip to content

When there are two or more array input parameters in a method #2158

Answered by MikaelMayer
dreamqin68 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @dreamqin68 ,
This is a very nice demonstration of how Dafny can prevent aliasing errors, thanks !
(1) What you did is correct, you either have to add a != b as a precondition, or wrap the assignment in a if a != b { ... } construct.
(2) I tried to replace b[0] := element; by a[0] := element; but it correctly indicates assignment might update an array element not in the enclosing context's modifies clause. Can you please detail your example?

Replies: 1 comment 3 replies

Comment options

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

@MikaelMayer
Comment options

@dreamqin68
Comment options

Answer selected by dreamqin68
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