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

map display vs map update #5351

Open
kjx opened this issue Apr 23, 2024 · 3 comments
Open

map display vs map update #5351

kjx opened this issue Apr 23, 2024 · 3 comments
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language definition Relating to the Dafny language definition itself

Comments

@kjx
Copy link

kjx commented Apr 23, 2024

Failing code

const w := map[20 := true][3 := false][20 := false]

const x := x[20 := true][3 := false][20 := false]

const y := map[20 := true, 3 := false, 20 := false]

const z := y[20 := true, 3 := false, 20 := false] //Syntax error

Steps to reproduce the issue

  • Copy & Paste code above
  • Dafny version: 4.6.0.0
  • Dafny VSCode extension version: 3.3.0

Expected behavior

declarations w & x use chained map update syntax
declarations y and z use "sequence of maplet" syntax

given we have two syntaxen for doing essentially the same thing, both should work in each context.
(especially as dafny has multiple assignments in general)

Actual behavior

"sequence of maplet" syntax may only be used in "map displays" (aka map literals).
chained updates can be used anywhere

@kjx kjx changed the title map display vs map updateVerification issue map display vs map update Apr 23, 2024
@keyboardDrummer keyboardDrummer transferred this issue from dafny-lang/ide-vscode Apr 23, 2024
@keyboardDrummer keyboardDrummer added kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language definition Relating to the Dafny language definition itself labels Apr 23, 2024
@keyboardDrummer
Copy link
Member

keyboardDrummer commented Apr 23, 2024

Suggestion seems good. I'm not sure when we'll work on this.

@kjx
Copy link
Author

kjx commented Apr 23, 2024 via email

@RustanLeino
Copy link
Collaborator

A good suggestion to implement.

In the "sequence of maplets" versions, I would also like to see a proof obligation that there are no conflicting maplets. For example, ...[20 := true, 20 := false || true] would be allowed, but ...[20 := true, 20 := false] would not be. Dafny typically checks such properties, but for dubious reasons, the "sequence of maplets" form is current really a sequential list of updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language definition Relating to the Dafny language definition itself
Projects
None yet
Development

No branches or pull requests

3 participants