Skip to content

Commit

Permalink
Merge branch 'master' into meilers_fix_803
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoeilers authored Jun 17, 2024
2 parents 1f0ceea + 4a80657 commit 60b80c3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/scala/viper/silver/ast/utility/Expressions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ object Expressions {
case e: Exp => e
}

def containsPermissionIntrospection(e: Exp): Boolean = e.exists {
case _: CurrentPerm => true
case _: ForPerm => true
case _ => false
}

// note: dependency on program for looking up function preconditions
def proofObligations(e: Exp): (Program => Seq[Exp]) = (prog: Program) => {
e.reduceTree[Seq[Exp]] {
Expand Down
31 changes: 31 additions & 0 deletions src/test/resources/all/annotation/annotationProverArgs.vpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

// The errors marked in this file are expected only due to the proverArgs annotation, since the properties actually
// hold, but Z3 should not be able to prove that due to the non-linear arithmetic setting.
// We use UnexpectedOutput annotations to mark that they're not actual errors, and that Carbon (which currently does
// not support the proverArgs annotation) should not report them.

method m1(i: Int, i2: Int)
requires i >= 0
requires i2 >= 0
{
assert i * i2 >= 0
}

@proverArgs("smt.arith.nl=false")
method m2(i: Int, i2: Int)
requires i >= 0
requires i2 >= 0
{
//:: UnexpectedOutput(assert.failed:assertion.false, /silicon/issue/000/)
assert i * i2 >= 0
}

@proverArgs("smt.arith.nl=true")
method m3(i: Int, i2: Int)
requires i >= 0
requires i2 >= 0
{
assert i * i2 >= 0
}
25 changes: 25 additions & 0 deletions src/test/resources/all/issues/silicon/0851.vpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

field v: Int

field r: Ref

field l: Ref

function fun01(x: Ref, b1: Bool, b2: Bool): Int
requires acc(x.v, 1 / 3)
requires acc(x.v, (b1 ? 1 / 3 : none))
requires acc(x.v, (b2 ? 1 / 3 : none))
{
x.v
}

method test01(x: Ref, b1: Bool, b2: Bool)
requires acc(x.v, write)
{
x.v := 4
assert fun01(x, b2, b1) == 4
//:: ExpectedOutput(assert.failed:assertion.false)
assert false
}

0 comments on commit 60b80c3

Please sign in to comment.