-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy path0338.vpr
67 lines (53 loc) · 1.43 KB
/
0338.vpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
function otherFunc(s: Seq[Int], i: Int): Bool
requires |s| > 1
{
true
}
method foo(x: Ref, y: Ref, s: Seq[Int], i: Int)
{
package (|s| > 3 ? (i > 1 && i < |s| - 2 && otherFunc(s, i)) : (i > 1 && i < |s| - 2)) --* true {
}
//:: ExpectedOutput(assert.failed:assertion.false)
assert |s| > 0
}
field f: Int
predicate p(x:Ref) {acc(x.f)}
method tst(x: Ref)
requires acc(x.f, 1/2) && x.f == 3
{
package acc(x.f, 1/2) && x.f == 2 --* p(x)
{
fold p(x)
assert x.f == 3
}
//:: ExpectedOutput(assert.failed:assertion.false)
assert false
}
field data: Int
method bar(x: Ref)
requires acc(x.data)
{
package acc(x.data) --* false {
assert acc(x.data) && acc(x.data)
//:: UnexpectedOutput(assert.failed:assertion.false, /carbon/issue/470/)
assert false
}
//:: ExpectedOutput(assert.failed:assertion.false)
assert false
}
field fx: Int
field fy: Int
method unsound(a: Ref)
requires acc(a.fx) && acc(a.fy)
ensures false
{
package acc(a.fx) --* (acc(a.fx) && acc(a.fy))
package acc(a.fx) --* (acc(a.fx) && acc(a.fy)) {
assert acc(a.fx, 2/1)
assert false // necessary to trigger unsoundness
}
//:: ExpectedOutput(assert.failed:insufficient.permission)
assert acc(a.fx) // shouldn't hold as we should have zero permissions
}