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

Hang with dafny verify on Std #5088

Closed
atomb opened this issue Feb 15, 2024 · 6 comments
Closed

Hang with dafny verify on Std #5088

atomb opened this issue Feb 15, 2024 · 6 comments
Labels
during 2: compilation of correct program Dafny rejects a valid program during compilation kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label

Comments

@atomb
Copy link
Member

atomb commented Feb 15, 2024

Dafny version

5cf477a

Code to produce this issue

function {:vcs_split_on_every_assert} ToNat(str: String) : (n: nat)
requires forall c <- str :: IsDigitChar(c)
{
if str == [] then 0
else
LemmaMulNonnegativeAuto();
var c := str[|str| - 1];
assert IsDigitChar(c);
ToNat(str[..|str| - 1]) * base + charToDigit[c]
}

Command to run and resulting output

(In Source/DafnyStandardLibraries/src/Std)

$ dafny verify dfyconfig.toml --boogie-filter "*Strings.ParametricConversion*ToNat*"

(hangs with 0% CPU use after a minute or so)

$ dafny /compile:0 /readsClausesOnMethods:1 /proc:"*Strings.ParametricConversion*ToNat*" `find . -name "*.dfy" | grep -v TargetSpecific`

Dafny program verifier finished with 7 verified, 0 errors
$

What happened?

Even with --cores 1, dafny verify hangs, but the old-style CLI works correctly.

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

Mac

@atomb atomb added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Feb 15, 2024
@atomb atomb changed the title Hang with dafny verify on Std.Strings.ParametricConversion.OfNat with proof dependencies enabled Hang with dafny verify on Std.Strings.ParametricConversion.OfNat Feb 15, 2024
@keyboardDrummer
Copy link
Member

keyboardDrummer commented Feb 15, 2024

I think I have a partial understanding of why this bug occurs. It occurs when using dafny verify with --boogie-filter and --isolate-assertions (or equivalent), and was introduced in #5031

Dafny is waiting for all the assertion batches to complete, but Boogie is skipping some of them, without telling Dafny, so Dafny keeps waiting.

If you set a verification time limit and wait for that to pass, does it return an internal error? If yes that would confirm the above.

I'm inclined to remove support for --boogie-filter from dafny verify since we have --filter-symbol now, which does the skipping on the Dafny level, and it's not easy to fix --boogie-filter here. PR: #5090

@keyboardDrummer keyboardDrummer added the during 2: compilation of correct program Dafny rejects a valid program during compilation label Feb 15, 2024
@atomb
Copy link
Member Author

atomb commented Feb 15, 2024

Yep, I think you're right. I do get an internal error when adding a time limit.

I like the ability to use wildcards to limit to everything in a given module, or even a subset of definitions in a module. Do you have any plans for a filtering option that allows that, using Dafny-centric names?

@atomb
Copy link
Member Author

atomb commented Feb 15, 2024

When running dafny verify dfyconfig.toml --filter-symbol "Strings.ParametricConversion", I still get a hang. Is filtering by module expected to work? And, if not, we should have an error message instead of a hang.

@atomb
Copy link
Member Author

atomb commented Feb 15, 2024

For context, this came about when trying to verify the standard libraries with --warn-{redundant,contradictory}-assumptions. The process was hanging, which it doesn't when using old-style options. I used --boogie-filter to try to identify which definition was leading to the hang, under the hypothesis that this might be occurring due to a Z3 crash.

I just double-checked, and can confirm that this hang is still happening with dafny verify (even with --cores 1), but not with old-style options (even with multiple cores).

@atomb atomb changed the title Hang with dafny verify on Std.Strings.ParametricConversion.OfNat Hang with dafny verify on Std Feb 15, 2024
@keyboardDrummer
Copy link
Member

keyboardDrummer commented Feb 16, 2024

When running dafny verify dfyconfig.toml --filter-symbol "Strings.ParametricConversion", I still get a hang. Is filtering by module expected to work? And, if not, we should have an error message instead of a hang.

Should work yes. Did you add a timelimit when doing this to check whether it's a bug instead of a verification taking long problem?

I like the ability to use wildcards to limit to everything in a given module, or even a subset of definitions in a module. Do you have any plans for a filtering option that allows that, using Dafny-centric names?

Can you not already do that with --filter-symbol ? It doesn't accept wildcards but it uses Contains, so there's an implicit wildcard to the left and right.

keyboardDrummer added a commit that referenced this issue Mar 14, 2024
Fix for #5088

### Description
Remove `--boogie-filter` option, because there's now a better
`--filter-symbol`

### How has this been tested?
Tests for the removed feature have been removed.

<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>
@keyboardDrummer
Copy link
Member

Closing because we've removed support for --boogie-filter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
during 2: compilation of correct program Dafny rejects a valid program during compilation kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
Projects
None yet
Development

No branches or pull requests

2 participants