Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion of map values fails when same postcondition succeeds (or if preceded by Keys assertion) #5527

Open
kjx opened this issue Jun 5, 2024 · 2 comments
Labels
incompleteness Things that Dafny should be able to prove, but can't kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: verifier Translation from Dafny to Boogie (translator) priority: not yet Will reconsider working on this when we're looking for work

Comments

@kjx
Copy link

kjx commented Jun 5, 2024

Dafny version

4.6.0.0 nightly

Code to produce this issue

class Object {}

method ISSUE( rm : map<Object,Object>, a : Object, b : Object, context : set<Object>) returns (m : map<Object,Object>)
   requires a !in rm.Keys
   ensures  a in m.Keys
   ensures  m.Keys == rm.Keys + {a}
   ensures  m.Values == rm.Values + {b}
{  
        m := rm[a:=b];
        //assert m.Keys == rm.Keys + {a};
        assert m.Values == rm.Values + {b};
}

Steps to reproduce the issue

  • Dafny version: 4.6.0.0
  • Dafny VSCode extension version: 3.3.0

Expected behavior

  • vain hope that this verifies

Actual behavior

  • it DOES verify, just "not like this" (to quote Switch from the Matrix)
  • remove the Values assertion and the rest verifies - including the same assertion in the method spec
  • uncomment the Keys assertion and the rest verifies

Command to run and resulting output

Just run Dafny

What happened?

I'd kind of hope it verifies...

Note I lodged this by pressing the IDE button, not realising that would put it in the wrong place: dafny-lang/ide-vscode#478

What type of operating system are you experiencing the problem on?

Mac

@kjx kjx added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Jun 5, 2024
@kjx
Copy link
Author

kjx commented Jun 5, 2024

which is listed in the manual as desired behaviour - butI still think it's a BUG!
image

@fabiomadge
Copy link
Collaborator

I'd be interested to see the impact of always giving the necessary information. For now, I fixed the typos.

@fabiomadge fabiomadge added incompleteness Things that Dafny should be able to prove, but can't part: verifier Translation from Dafny to Boogie (translator) kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny and removed kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label labels Jun 5, 2024
@stefan-aws stefan-aws added priority: not yet Will reconsider working on this when we're looking for work and removed priority: unknown labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompleteness Things that Dafny should be able to prove, but can't kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: verifier Translation from Dafny to Boogie (translator) priority: not yet Will reconsider working on this when we're looking for work
Projects
None yet
Development

No branches or pull requests

3 participants