Skip to content

Unable to assert quantification over map comprehension #5775

@ssomayyajula

Description

@ssomayyajula

Dafny version

latest

Code to produce this issue

type Msg = int

datatype Type =
| Send(next: map<Msg, Type>)
| Recv(next: map<Msg, Type>)
| End() {
  predicate CanSend(msg: Msg) {
    match this
    case Send(next) => msg in next
    case Recv(next) => forall msg <- next :: next[msg].CanSend(msg)
    case End()      => false
  }
}

method Main() {
  var x := Recv(map[1 := Send(map[2 := End()])]);
  // by clause verifies, but not the assert itself
  assert x.CanSend(2) by {
    forall msg <- x.next ensures x.next[msg].CanSend(2) { }
  }
}

Command to run and resulting output

dafny verify ...

What happened?

This should verify...right?

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

Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    incompletenessThings that Dafny should be able to prove, but can'tkind: bugCrashes, unsoundness, incorrect output, etc. If possible, add a `part:` labelpart: verifierTranslation from Dafny to Boogie (translator)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions