Open jad-hamza opened 4 years ago
This is due to lack of function extensionality. The following code does not work, but if you comment out @inline
, it does.
import stainless.lang._
import stainless.collection._
import stainless.annotation._
object AssertedLemma {
@extern
def p(x: BigInt, y: BigInt, z: BigInt): Boolean = {
(??? : Boolean)
}
@inline
def check(l: List[(BigInt, (BigInt, BigInt))]): Boolean = {
l.forall { (xyz: (BigInt, (BigInt, BigInt))) =>
xyz match {
case (x, yz) => p(x, yz._1, yz._2)
}
}
}
@extern
def lemma(l: List[(BigInt, (BigInt, BigInt))]): Unit = {
}.ensuring(_ => check(l))
def test(l: List[(BigInt, (BigInt, BigInt))]) = {
lemma(l)
assert(check(l))
}
}
This sounds like a bug in Inox function normalization, I'll have to take a look.
The assertion in
test
doesn't go through (timeout), while it should thanks to the postcondition oflemma
.