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

Termination axioms not instantiated for all necessary sorts #526

Closed
mschwerhoff opened this issue Dec 13, 2020 · 1 comment
Closed

Termination axioms not instantiated for all necessary sorts #526

mschwerhoff opened this issue Dec 13, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@mschwerhoff
Copy link
Contributor

Silicon fails to verify the following program:

import <decreases/set.vpr>

method test() {
  var c: Set[Ref]

  while (c != Set[Ref]())
    decreases c
  {
    var n: Ref
    assume n in c
    c := c setminus Set(n)
  }
}

The program above is basically transformed into:

domain WellFoundedOrder[T] {
  function decreasing(arg1: T, arg2: T): Bool
  function bounded(arg1: T): Bool
}

domain SetWellFoundedOrder[S] {
  axiom set_ax_dec {
    forall set1: Set[S], set2: Set[S] ::
        { decreasing(set1, set2) }
      |set1| < |set2| ==> decreasing(set1, set2)
  }

  axiom set_ax_bound {
    forall set1: Set[S] :: { bounded(set1) } bounded(set1)
  }
}

method mark() {
  var c: Set[Ref]

  // decreases c
  while (c != Set[Ref]()) {
    var old_W1_T0: Set[Ref]
    old_W1_T0 := c

    var n: Ref
    inhale n in c
    c := c setminus Set(n)

    if (true && c != Set[Ref]()) {
      assert decreasing(c, old_W1_T0) && bounded(old_W1_T0) // FAILS
      // assert |c| < |old_W1_T0| // HOLDS
    }
  }
}

Inspecting the SMT encoding reveals that the axioms from domain SetWellFoundedOrder are instantiated for S being int, but not Ref. That looks like a problem caused by the code for computing necessary domain instantiations.

@marcoeilers
Copy link
Contributor

Fixed in viperproject/silver#742.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants