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

Support <lo> to <hi> as a quantifier variable domain, or as a sequence display #2583

Open
robin-aws opened this issue Aug 12, 2022 · 3 comments
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny misc: language proposals Proposals for change to the language that go beyon simple enhancement requests part: language definition Relating to the Dafny language definition itself

Comments

@robin-aws
Copy link
Member

Another follow-up idea from the change to add the x <- C quantified variable domain syntax: dafny-lang/rfcs#10 (comment)

Because we decided to require a quantified variable domain for ordered quantifications, and therefore seq i | 0 <= i < n :: f(i) | P(i) is not allowed, we still need the often-maligned seq(n, f) "sequence construction" syntax: #1332.

One way to replace the old syntax is to support range expressions like 0 to 5 as at least quantified variable domains, or (my preference) as fully independent syntax for a sequence value. The runtime representation would be a distinct RangeSequence<T> case, rather than explicitly allocating the range of values. This would be relatively cheap to implement once the sequence type has a single implementation in Dafny source code rather than N implementations in each runtime (after #2390).

(marking this as a breaking change not only because deprecated and removing sequence constructions would be breaking, but also in case the parsing change turns out to be breaking - I've been burnt before :)

@robin-aws robin-aws added breaking-change Any change that will cause existing Dafny codebases to break (excluding verification instability) 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 misc: language proposals Proposals for change to the language that go beyon simple enhancement requests labels Aug 12, 2022
@davidcok
Copy link
Collaborator

Why not use i <- 0 .. 10 ?

@MikaelMayer
Copy link
Member

Why not use i <- 0 .. 10 ?

Why not indeed, since it's consistent with sequence extraction.

@robin-aws
Copy link
Member Author

I experimented with a parser change to support this and it did not break any existing test cases, so I'm comfortable removing the breaking-change label.

@robin-aws robin-aws removed the breaking-change Any change that will cause existing Dafny codebases to break (excluding verification instability) label Sep 6, 2022
@robin-aws robin-aws added this to the Dafny 4.0 milestone Sep 6, 2022
@robin-aws robin-aws removed this from the Dafny 4.0 milestone Feb 7, 2023
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 misc: language proposals Proposals for change to the language that go beyon simple enhancement requests part: language definition Relating to the Dafny language definition itself
Projects
None yet
Development

No branches or pull requests

3 participants