-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathapplying-twice-qp-predicates.vpr
73 lines (59 loc) · 1.84 KB
/
applying-twice-qp-predicates.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
68
69
70
71
72
73
field f: Int
predicate Cell(x: Ref) {
acc(x.f)
}
function get(x: Ref): Int
requires acc(Cell(x), 1/2)
{
unfolding acc(Cell(x), 1/2) in x.f
}
// based on test7 in QPPredicates.vpr
method test14d(x: Ref)
requires forall y: Ref :: true ==> Cell(y)
{
package (forall y: Ref :: true ==> Cell(y)) --* (forall y: Ref :: true ==> Cell(y))
unfold Cell(x)
x.f := 0
fold Cell(x)
assert applying ((forall y: Ref :: true ==> Cell(y)) --* (forall y: Ref :: true ==> Cell(y))) in true
unfold Cell(x)
x.f := 1
fold Cell(x)
assert applying ((forall y: Ref :: true ==> Cell(y)) --* (forall y: Ref :: true ==> Cell(y))) in true
//:: ExpectedOutput(assert.failed:assertion.false)
assert false
}
// based on test9 in QPPredicates.vpr
method test14e(x: Ref)
requires forall y: Ref :: true ==> Cell(y)
{
package (forall y: Ref :: true ==> Cell(y)) --* Cell(x)
unfold Cell(x)
x.f := 0
fold Cell(x)
assert applying ((forall y: Ref :: true ==> Cell(y)) --* Cell(x)) in true
unfold Cell(x)
x.f := 1
fold Cell(x)
assert applying ((forall y: Ref :: true ==> Cell(y)) --* Cell(x)) in true
//:: ExpectedOutput(assert.failed:assertion.false)
assert false
}
// based on test11 in QPPredicates.vpr
method test14f(x: Ref, z: Ref)
requires Cell(x)
requires x != z
{
package (forall y: Ref :: y != x ==> Cell(y)) --* (forall y: Ref :: true ==> Cell(y))
inhale forall y: Ref :: y != x ==> Cell(y)
unfold Cell(z)
z.f := 0
fold Cell(z)
assert applying ((forall y: Ref :: y != x ==> Cell(y)) --* (forall y: Ref :: true ==> Cell(y))) in true
unfold Cell(z)
z.f := 1
fold Cell(z)
assert applying ((forall y: Ref :: y != x ==> Cell(y)) --* (forall y: Ref :: true ==> Cell(y))) in true
//:: ExpectedOutput(assert.failed:assertion.false)
assert false
}