feat: move corpus to library
This commit is contained in:
1301 files changed
+941859
-4
No files matched your search
@@ -0,0 +1,9 @@
|
||||
// FILL stops the program on a negative count, so the call is an
|
||||
// obligation, not a fact the checker may assume.
|
||||
// MUST-NOT-PROVE: argument@6
|
||||
FUNCTION F(N : INTEGER) RETURNS INTEGER
|
||||
DECLARE Xs : LIST OF INTEGER
|
||||
Xs <- FILL(N, 0)
|
||||
RETURN LENGTH(Xs)
|
||||
ENDFUNCTION
|
||||
OUTPUT F(-1)
|
||||
@@ -0,0 +1,10 @@
|
||||
// The prover treats a FLOAT as a number: Y == Y, and X < X + 1.0 or not.
|
||||
// Infinity and NaN are not numbers in that sense. A run that let 1.0E308 *
|
||||
// 10.0 become infinity, and X - X become NaN, broke both claims while the
|
||||
// checker proved them. Such a run now stops at the overflow instead.
|
||||
// RUN-STOPS: overflow@7
|
||||
DECLARE X, Y : FLOAT
|
||||
X <- 1.0E308 * 10.0
|
||||
Y <- X - X
|
||||
ASSERT Y == Y
|
||||
OUTPUT Y
|
||||
@@ -0,0 +1,8 @@
|
||||
// A whole number stored in a FLOAT32 is rounded to the nearest single:
|
||||
// 16777217 becomes 16777216. A rule that kept the INTEGER's value for the
|
||||
// FLOAT32 would prove this ASSERT, and the run breaks it.
|
||||
// MUST-NOT-PROVE: assert@8
|
||||
DECLARE N : INTEGER <- 16777217
|
||||
DECLARE X : FLOAT32
|
||||
X <- N
|
||||
ASSERT X == N
|
||||
@@ -0,0 +1,13 @@
|
||||
// The way out of a FOR EACH loop includes the case of no pass at all. A
|
||||
// checker that kept "X is in Xs" on the way out held FALSE after looping over
|
||||
// an empty list, and proved anything, even 1 == 2.
|
||||
// MUST-NOT-PROVE: assert@12
|
||||
DECLARE Xs : LIST OF INTEGER
|
||||
DECLARE S : INTEGER
|
||||
Xs <- []
|
||||
S <- 0
|
||||
FOR EACH X IN Xs
|
||||
S <- S + X
|
||||
NEXT X
|
||||
ASSERT 1 == 2
|
||||
OUTPUT S
|
||||
@@ -0,0 +1,23 @@
|
||||
// The checker's own invariant guesses must be checked to a fixed point.
|
||||
// Each pass shifts a value one variable further down a chain, so "F <= 0"
|
||||
// survives the first four rounds of guessing and fails on the fifth. A
|
||||
// checker that stopped guessing after four rounds assumed it, and proved
|
||||
// the false ASSERT below.
|
||||
// MUST-NOT-PROVE: assert@22
|
||||
DECLARE A, B, C, D, E, F : INTEGER
|
||||
A <- 0
|
||||
B <- 0
|
||||
C <- 0
|
||||
D <- 0
|
||||
E <- 0
|
||||
F <- 0
|
||||
FOR I <- 0 TO 10
|
||||
F <- E
|
||||
E <- D
|
||||
D <- C
|
||||
C <- B
|
||||
B <- A
|
||||
A <- A + 1
|
||||
NEXT I
|
||||
ASSERT F <= 0
|
||||
OUTPUT F
|
||||
@@ -0,0 +1,7 @@
|
||||
// With USE IEEE a FLOAT can be NaN, and NaN == NaN is FALSE. The prover's
|
||||
// rule that every number equals itself does not hold for NaN, so nothing in
|
||||
// a program that says USE IEEE may be marked proved.
|
||||
// MUST-NOT-PROVE: assert@7
|
||||
USE IEEE
|
||||
DECLARE X : FLOAT <- NAN()
|
||||
ASSERT X == X
|
||||
@@ -0,0 +1,7 @@
|
||||
// INT8 holds -128 to 127. X + 1 for X = 127 is 128, which does not fit, so
|
||||
// the run stops there. A rule that treated the sum as an exact whole number
|
||||
// with no range would prove it fits without a REQUIRE to guarantee it.
|
||||
// MUST-NOT-PROVE: overflow@6
|
||||
FUNCTION Inc(X : INT8) RETURNS INT8
|
||||
RETURN X + 1
|
||||
ENDFUNCTION
|
||||
@@ -0,0 +1,6 @@
|
||||
// RAND(X) for a negative X gives a value in (X, 0], not [0, X).
|
||||
// MUST-NOT-PROVE: assert@5
|
||||
DECLARE R : FLOAT
|
||||
R <- RAND(-1.0)
|
||||
ASSERT R >= 0.0
|
||||
OUTPUT R
|
||||
@@ -0,0 +1,7 @@
|
||||
// RAND(0.0) gives 0.0. A checker that assumed 0 <= R < 0.0 held a
|
||||
// contradiction from here on, and proved anything, even 1 == 2.
|
||||
// MUST-NOT-PROVE: assert@6
|
||||
DECLARE R : FLOAT
|
||||
R <- RAND(0.0)
|
||||
ASSERT 1 == 2
|
||||
OUTPUT R
|
||||
@@ -0,0 +1,8 @@
|
||||
// RANDINT(A, B) stops the program when [A, B) is empty.
|
||||
// MUST-NOT-PROVE: argument@5
|
||||
FUNCTION G(A : INTEGER) RETURNS INTEGER
|
||||
DECLARE R : INTEGER
|
||||
R <- RANDINT(A, 3)
|
||||
RETURN R
|
||||
ENDFUNCTION
|
||||
OUTPUT G(5)
|
||||
Reference in new issue
Block a user