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

Add incremental verification progress reporting in a Dafny-centric way #5150

Closed
atomb opened this issue Mar 5, 2024 · 2 comments · Fixed by #5218
Closed

Add incremental verification progress reporting in a Dafny-centric way #5150

atomb opened this issue Mar 5, 2024 · 2 comments · Fixed by #5218
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny

Comments

@atomb
Copy link
Member

atomb commented Mar 5, 2024

Summary

I propose adding a --progress flag to the verify command that prints out the status of each verification condition as it is initiated and completed.

This is one of the missing flags cited in #3468.

Background and Motivation

When performing a long-running verification from the command line, it's often useful to see how far along the process is, and identify when Dafny hits a verification condition that takes longer than you expect to verify. In the past, I've usually used the Boogie /trace option for this, but it's poorly-specified and not Dafny-centric. Having a more Dafny-oriented option for tracking progress would be better.

Proposed Feature

When the --progress option is specified, Dafny would print out when each verification run begins and ends, and provide time and resource count statistics for completed runs. I could imagine even having a dynamically updated output showing the status of all runs currently in progress (including runtime up to now), and how many of the total have been either scheduled or completed. Something similar to how cargo shows its build output could make sense. Example output, when running with 2 cores, might be something like:

PASSED   M.F (0.01s, 32498 RU)
PASSED   M.G (0.24s, 98347 RU)
RUNNING  M.Lemma1 (1.20s elapsed)
RUNNING  M.Lemma2 (4.53s elapsed)
[2 proved, 2 in progress, 4 remaining]

Lines like the first two would accumulate as it runs, whereas lines like the last three would be dynamically updated on a regular interval.

Alternatives

A simpler sequence of update lines, similar to /trace but in Dafny terms, without dynamic update, would be slightly simpler to implement.

It's currently possible to use /trace with Dafny, but when running with the new CLI it doesn't actually print out the results of each verification run, only all of the other output /trace provides, which isn't very useful.

@atomb atomb added the kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny label Mar 5, 2024
@keyboardDrummer
Copy link
Member

Thanks for writing this up! This is great.

Can you specify what would be the minimum required to replace the main use-case of /trace for you?

@atomb
Copy link
Member Author

atomb commented Mar 5, 2024

Thanks for writing this up! This is great.

Can you specify what would be the minimum required to replace the main use-case of /trace for you?

I think the static version of what I described, with a line printed when each run is started and another when it's finished, without dynamic update, would be the important thing. (And, I think, even if we had a dynamically updating version, we'd probably want to support the more static version for, e.g., saving to log files. So it probably makes sense to implement that first, and then perhaps make it fancier.)

@atomb atomb changed the title Add incremental progress reporting in a Dafny-centric way Add incremental verification progress reporting in a Dafny-centric way Mar 7, 2024
keyboardDrummer added a commit that referenced this issue Mar 22, 2024
Fixes #5150

### Description
Add a `--progress` option to Dafny, that displays output like the
following:

```
Verified 0/5 symbols. Waiting for Foo to verify.
Verified part 1/3 of Foo, located at line 4, using 8,7E+002 resources
Verified part 2/3 of Foo, located at line 6, using 3,1E+003 resources
Verified part 3/3 of Foo, located at line 7, using 2,8E+003 resources
Verified 1/5 symbols. Waiting for Faz to verify.
Verified part 1/2 of Faz, located at line 10, using 8,7E+002 resources
Verified part 2/2 of Faz, located at line 10, using 3,1E+003 resources
Verified 2/5 symbols. Waiting for Fopple to verify.
Verified part 1/2 of Fopple, located at line 12, using 8,7E+002 resources
Verified part 2/2 of Fopple, located at line 12, using 3,1E+003 resources
Verified 3/5 symbols. Waiting for Burp to verify.
Verified part 1/3 of Burp, located at line 14, using 8,7E+002 resources
Verified part 2/3 of Burp, located at line 16, using 3,1E+003 resources
Verified part 3/3 of Burp, located at line 17, using 2,8E+003 resources
Verified 4/5 symbols. Waiting for Blanc to verify.
Verified part 1/2 of Blanc, located at line 20, using 8,7E+002 resources
Verified part 2/2 of Blanc, located at line 20, using 3,1E+003 resources

Dafny program verifier finished with 12 verified, 0 errors
```

Note that when `--cores` is more than 1, which is the default, the
output will get more messy because "Verify x/y symbols" will be
interspersed with "Verified part a/b of X"

The locations of parts can be confusing, sometimes they point to the
header of the symbol being verified, such as when verifying
wellformedness of the symbol contract, or correctness when no
`--isolate-assertions` is used. When `--isolate-assertions` is used,
they may also point to lines containing assertions.

### How has this been tested?
Add a littish test, `progress.dfy`

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants