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

predicate subtypes of functions not propagating predicates #5245

Open
erniecohen opened this issue Mar 23, 2024 · 3 comments
Open

predicate subtypes of functions not propagating predicates #5245

erniecohen opened this issue Mar 23, 2024 · 3 comments
Labels
has-workaround: yes There is a known workaround incompleteness Things that Dafny should be able to prove, but can't

Comments

@erniecohen
Copy link

Failing code

type F = f:()->bool | f() witness () => true 
method test() { assert forall f:F :: f();}

Steps to reproduce the issue

  • Dafny version: 4.5.0.0
  • Dafny VSCode extension version: 3.2.2

Expected behavior

should verify

Actual behavior

assertion fails

@MikaelMayer
Copy link
Member

As a workaround until we figure it out, I've found that switching back to first-order logic for definitions often helps.

function apply(f: () -> bool): bool { f() }
type F = f:()->bool | apply(f) witness () => true 
method test2() { assert forall f:F :: f();}

@MikaelMayer MikaelMayer transferred this issue from dafny-lang/ide-vscode Mar 25, 2024
@MikaelMayer MikaelMayer added incompleteness Things that Dafny should be able to prove, but can't has-workaround: yes There is a known workaround labels Mar 25, 2024
@racko
Copy link
Contributor

racko commented Mar 25, 2024

Interesting. Here's something very similar but for requires clauses: #2137, #5106

Probably not directly related, but maybe somebody finds the references helpful anyhow.

@racko
Copy link
Contributor

racko commented Mar 25, 2024

As a workaround until we figure it out, I've found that switching back to first-order logic for definitions often helps.

function apply(f: () -> bool): bool { f() }
type F = f:()->bool | apply(f) witness () => true 
method test2() { assert forall f:F :: f();}

@MikaelMayer, could you explain what you are doing there? I only see that you are introducing an indirection (apply), but I don't see how this is "switching back to first-order logic" or why it helps the verifier 😥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-workaround: yes There is a known workaround incompleteness Things that Dafny should be able to prove, but can't
Projects
None yet
Development

No branches or pull requests

3 participants