-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathmultipleErrors.vpr
More file actions
38 lines (32 loc) · 944 Bytes
/
Copy pathmultipleErrors.vpr
File metadata and controls
38 lines (32 loc) · 944 Bytes
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
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
// failure filtering by Silicon should not filter out one of the failures but correctly return both errors
import <decreases/int.vpr>
function factorialPure(n: Int): Int
decreases // wrong termination measure
requires n >= 0
{
//:: ExpectedOutput(termination.failed:tuple.false)
n == 0 ? 1 : 1 * factorialPure(n-1)
}
field next: Ref
field value: Int
predicate list(self: Ref) {
acc(self.next) && acc(self.value) && (self.next != null ==> list(self.next))
}
method length(x: Ref) returns (l: Int)
decreases // wrong termination measure
requires list(x)
ensures list(x)
{
unfold list(x)
if (x.next == null) {
l := 1
} else {
var tmp: Int
//:: ExpectedOutput(termination.failed:tuple.false)
tmp := length(x.next)
l := 1 + tmp
}
fold list(x)
}