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

Function not equal to its body when using extern annotations #1411

Open
andreagilot-da opened this issue May 3, 2023 · 1 comment
Open

Comments

@andreagilot-da
Copy link

The following snippet does not verify although it is only asserting that foo is equal to its body:

  case class A(useless: BigInt) {
    @extern
    def map(f: (Unit) => (Unit, Unit)): A = this
  }

  def get(key: Unit): Option[Unit] = None[Unit]()

  def foo(m: A): A = {
    m.map {
      key =>
        val value = get(key) match {
          case None() => ()
          case Some(_) => ()
        }
        () -> value
    }
  }

  def fooEqualsItsBody(m: A): Unit = {
    assert(foo(m) == m.map {
      key =>
        val value = get(key) match {
          case None() => ()
          case Some(_) => ()
        }
        () -> value
    })
  }

The followings make the verification succeed:

  • Inlining value
  • Removing the @externannotation on map
  • Changing get so that it takes no argument instead of one
  • Making map return only one value instead of a pair
  • Removing the useless argument from A
  • Changing value by () or by get(key)
@mario-bucev
Copy link
Collaborator

May be another instance of epfl-lara/inox#139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants