@@ -15,7 +15,7 @@ field acq: Bool
15
15
predicate AcqConjunct(x: Ref, idx: Int)
16
16
17
17
domain parallelHeaps {
18
- function heap (x: Ref) : Int
18
+ function heap_lookup (x: Ref) : Int
19
19
function is_ghost(x:Ref) : Bool
20
20
}
21
21
@@ -28,25 +28,25 @@ domain reads {
28
28
29
29
30
30
method read(data: Ref, count: Ref, ghost: Ref) returns (v: Int)
31
- requires heap (data) == 0 && (heap (count) == 0 && (heap (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard))))))))
32
- ensures heap (data) == 0 && (heap (count) == 0 && (heap (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard)))))))) && (data.val == v && [true, perm(data.val) == none])
31
+ requires heap_lookup (data) == 0 && (heap_lookup (count) == 0 && (heap_lookup (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard))))))))
32
+ ensures heap_lookup (data) == 0 && (heap_lookup (count) == 0 && (heap_lookup (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard)))))))) && (data.val == v && [true, perm(data.val) == none])
33
33
{
34
34
v := data.val
35
35
}
36
36
37
37
method read_erroneous(data: Ref, count: Ref, ghost: Ref) returns (v: Int)
38
- requires heap (data) == 0 && (heap (count) == 0 && (heap (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard))))))))
38
+ requires heap_lookup (data) == 0 && (heap_lookup (count) == 0 && (heap_lookup (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard))))))))
39
39
//:: ExpectedOutput(postcondition.violated:assertion.false)
40
- ensures heap (data) == 0 && (heap (count) == 0 && (heap (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard)))))))) && (data.val == v && [true, perm(data.val) == none] && false)
40
+ ensures heap_lookup (data) == 0 && (heap_lookup (count) == 0 && (heap_lookup (ghost) == 0 && (is_ghost(ghost) && (acc(data.val, rd()) && (acc(ghost.val, rd()) && (acc(count.acq, wildcard) && count.acq == false && acc(AcqConjunct(count, 0), wildcard) && (acc(count.rel, wildcard) && count.rel == 0 && acc(count.init, wildcard)))))))) && (data.val == v && [true, perm(data.val) == none] && false)
41
41
{
42
42
v := data.val
43
43
}
44
44
45
45
method read2(data: Ref, count: Ref, ghost: Ref) returns (v: Int)
46
46
requires
47
- heap (data) == 0 &&
48
- heap (count) == 0 &&
49
- heap (ghost) == 0 &&
47
+ heap_lookup (data) == 0 &&
48
+ heap_lookup (count) == 0 &&
49
+ heap_lookup (ghost) == 0 &&
50
50
is_ghost(ghost) &&
51
51
acc(data.val, rd()) &&
52
52
acc(ghost.val, rd()) &&
@@ -58,9 +58,9 @@ method read2(data: Ref, count: Ref, ghost: Ref) returns (v: Int)
58
58
acc(count.init, wildcard)
59
59
60
60
ensures
61
- heap (data) == 0 &&
62
- heap (count) == 0 &&
63
- heap (ghost) == 0 &&
61
+ heap_lookup (data) == 0 &&
62
+ heap_lookup (count) == 0 &&
63
+ heap_lookup (ghost) == 0 &&
64
64
is_ghost(ghost) &&
65
65
acc(data.val, rd()) &&
66
66
acc(ghost.val, rd()) &&
@@ -78,9 +78,9 @@ method read2(data: Ref, count: Ref, ghost: Ref) returns (v: Int)
78
78
79
79
method read2_erroneous(data: Ref, count: Ref, ghost: Ref) returns (v: Int)
80
80
requires
81
- heap (data) == 0 &&
82
- heap (count) == 0 &&
83
- heap (ghost) == 0 &&
81
+ heap_lookup (data) == 0 &&
82
+ heap_lookup (count) == 0 &&
83
+ heap_lookup (ghost) == 0 &&
84
84
is_ghost(ghost) &&
85
85
acc(data.val, rd()) &&
86
86
acc(ghost.val, rd()) &&
@@ -93,9 +93,9 @@ method read2_erroneous(data: Ref, count: Ref, ghost: Ref) returns (v: Int)
93
93
94
94
ensures
95
95
//:: ExpectedOutput(postcondition.violated:assertion.false)
96
- heap (data) == 0 &&
97
- heap (count) == 0 &&
98
- heap (ghost) == 0 &&
96
+ heap_lookup (data) == 0 &&
97
+ heap_lookup (count) == 0 &&
98
+ heap_lookup (ghost) == 0 &&
99
99
is_ghost(ghost) &&
100
100
acc(data.val, rd()) &&
101
101
acc(ghost.val, rd()) &&
0 commit comments