File tree 28 files changed +198
-25
lines changed
Quantifiers-initialisation
Quantifiers-initialisation2
Quantifiers-invalid-var-range
Quantifiers-two-dimension-array
28 files changed +198
-25
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,12 @@ int main()
7
7
c [1 ][0 ]= 1 ;
8
8
c [1 ][1 ]= 2 ;
9
9
10
+ // clang-format off
11
+ // clang-format would rewrite the "==>" as "== >"
10
12
__CPROVER_assert (__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) }, "Exists-Exists: successful" );
11
13
12
- __CPROVER_assert (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (!__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) }, "NotExists-NotExists: successful" );
14
+ // NOLINTNEXTLINE(whitespace/line_length)
15
+ __CPROVER_assert (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (!__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) }, "NotExists-NotExists: failed" );
13
16
14
17
__CPROVER_assert (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) }, "NotExists-Exists: failed" );
15
18
@@ -18,6 +21,7 @@ int main()
18
21
__CPROVER_assert (!__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > (__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) }, "NotForall-Forall: successful" );
19
22
20
23
__CPROVER_assert (!__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > (!__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) }, "NotForall-NotForall: successful" );
24
+ // clang-format on
21
25
22
26
return 0 ;
23
27
}
Original file line number Diff line number Diff line change 1
- CORE
1
+ KNOWNBUG
2
2
main.c
3
3
4
4
^\*\* Results:$
5
5
^\[main.assertion.1\] .* Exists-Exists: successful: SUCCESS$
6
- ^\[main.assertion.2\] .* NotExists-NotExists: successful: SUCCESS $
6
+ ^\[main.assertion.2\] .* NotExists-NotExists: failed: FAILURE $
7
7
^\[main.assertion.3\] .* NotExists-Exists: failed: FAILURE$
8
8
^\[main.assertion.4\] .* NotExists-Forall: failed: FAILURE$
9
9
^\[main.assertion.5\] .* NotForall-Forall: successful: SUCCESS$
10
10
^\[main.assertion.6\] .* NotForall-NotForall: successful: SUCCESS$
11
- ^\*\* 2 of 6 failed
11
+ ^\*\* 3 of 6 failed
12
12
^VERIFICATION FAILED$
13
13
^EXIT=10$
14
14
^SIGNAL=0$
15
+ --
16
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -4,10 +4,13 @@ int main()
4
4
a [0 ]= 1 ;
5
5
a [1 ]= 2 ;
6
6
7
+ // clang-format off
8
+ // clang-format would rewrite the "==>" as "== >"
7
9
int x = __CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 };
8
10
int y = __CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]< 2 };
9
11
int z1 = __CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]< 1.5 };
10
12
int z2 = __CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]< 2 * 10 };
13
+ // clang-format on
11
14
12
15
assert (x );
13
16
assert (y );
Original file line number Diff line number Diff line change 10
10
^VERIFICATION FAILED$
11
11
^EXIT=10$
12
12
^SIGNAL=0$
13
+ --
14
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ int main()
9
9
a [3 ]= 3 ;
10
10
a [4 ]= 4 ;
11
11
12
+ // clang-format off
13
+ // clang-format would rewrite the "==>" as "== >"
12
14
__CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 5 ) == > b [i ]== a [i ]});
15
+ // clang-format on
13
16
14
17
assert (b [0 ]== 0 );
15
18
assert (b [1 ]== 1 );
Original file line number Diff line number Diff line change 11
11
^VERIFICATION SUCCESSFUL$
12
12
^EXIT=0$
13
13
^SIGNAL=0$
14
+ --
15
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ int main()
4
4
a [0 ]= 1 ;
5
5
a [1 ]= 2 ;
6
6
7
+ // clang-format off
8
+ // clang-format would rewrite the "==>" as "== >"
7
9
if (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 })
8
10
__CPROVER_assert (0 , "failure 1" );
9
11
@@ -18,6 +20,7 @@ int main()
18
20
19
21
if (__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=5 && a [i ]<=10 })
20
22
__CPROVER_assert (0 , "success 2" );
23
+ // clang-format on
21
24
22
25
return 0 ;
23
26
}
Original file line number Diff line number Diff line change 11
11
^VERIFICATION FAILED$
12
12
^EXIT=10$
13
13
^SIGNAL=0$
14
+ --
15
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ int main()
2
2
{
3
3
int a [5 ];
4
4
5
+ // clang-format off
6
+ // clang-format would rewrite the "==>" as "== >"
5
7
__CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 5 ) == > a [i ]== i + 1 });
8
+ // clang-format on
6
9
7
10
assert (a [0 ]== 1 );
8
11
assert (a [1 ]== 2 );
Original file line number Diff line number Diff line change 11
11
^VERIFICATION SUCCESSFUL$
12
12
^EXIT=0$
13
13
^SIGNAL=0$
14
+ --
15
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ int main()
3
3
int a [10 ];
4
4
int c [10 ];
5
5
6
+ // clang-format off
7
+ // clang-format would rewrite the "==>" as "== >"
6
8
// C# style
7
9
__CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 9 + 1 ) == > a [i ]>=1 && a [i ]<=10 });
8
10
__CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 10 ) == > __CPROVER_forall {int j ; (j > i && j < 10 ) == > a [j ]> a [i ]} });
@@ -14,5 +16,6 @@ int main()
14
16
assert (a [2 ]> a [3 ]);
15
17
__CPROVER_assert (__CPROVER_forall {unsigned i ; (i >=1 && i < 10 ) == > c [i - 1 ]<=c [i ]}, "forall c[]" );
16
18
assert (c [3 ]>=c [1 ]);
19
+ // clang-format on
17
20
return 0 ;
18
21
}
Original file line number Diff line number Diff line change 11
11
^VERIFICATION FAILED$
12
12
^EXIT=10$
13
13
^SIGNAL=0$
14
+ --
15
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ int main()
2
2
{
3
3
4
4
int a [3 ][3 ];
5
+ // clang-format off
6
+ // clang-format would rewrite the "==>" as "== >"
5
7
__CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 5 ) == > __CPROVER_exists {int j ; (j >=i && j < 3 ) == > a [i ][j ]== 10 } });
8
+ // clang-format on
6
9
7
10
assert (a [0 ][0 ]== 10 || a [0 ][1 ]== 10 || a [0 ][2 ]== 10 );
8
11
Original file line number Diff line number Diff line change 1
- CORE
1
+ KNOWNBUG
2
2
main.c
3
3
4
4
^\*\* Results:$
5
5
^\*\* 0 of 1 failed
6
6
^VERIFICATION SUCCESSFUL$
7
7
^EXIT=0$
8
8
^SIGNAL=0$
9
+ --
10
+ ^warning: ignoring
11
+ --
12
+ This produces the expected verification result, but actually ignores some
13
+ quantifiers.
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [2 ][2 ];
4
+ int b [2 ][2 ];
5
+ int c [2 ][2 ];
6
+ int d [2 ][2 ];
7
+
8
+ // clang-format off
9
+ // clang-format would rewrite the "==>" as "== >"
10
+ // NOLINTNEXTLINE(whitespace/line_length)
11
+ __CPROVER_assume (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) && (__CPROVER_exists {int j ; (j >=0 && j < 2 ) && a [i ][j ]<=10 }) });
12
+
13
+ assert (0 );
14
+
15
+ // NOLINTNEXTLINE(whitespace/line_length)
16
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > (!__CPROVER_exists {int j ; (j >=0 && j < 2 ) && b [i ][j ]>=1 && b [i ][j ]<=10 }) });
17
+
18
+ assert (0 );
19
+
20
+ // NOLINTNEXTLINE(whitespace/line_length)
21
+ __CPROVER_assume (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) && (!__CPROVER_exists {int j ; (j >=0 && j < 2 ) && (c [i ][j ]== 0 || c [i ][j ]<=10 )}) });
22
+
23
+ assert (0 );
24
+
25
+ // NOLINTNEXTLINE(whitespace/line_length)
26
+ __CPROVER_assume (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) && (__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > d [i ][j ]>=1 && d [i ][j ]<=10 }) });
27
+ // clang-format on
28
+
29
+ assert (0 );
30
+
31
+ assert (a [0 ][0 ] > 10 );
32
+
33
+ assert ((b [0 ][0 ] < 1 || b [0 ][0 ] > 10 ) && (b [0 ][1 ] < 1 || b [0 ][1 ] > 10 ));
34
+ assert ((b [1 ][0 ] < 1 || b [1 ][0 ] > 10 ) && (b [1 ][1 ] < 1 || b [1 ][1 ] > 10 ));
35
+
36
+ assert (c [0 ][0 ] == 0 || c [0 ][1 ] == 0 || c [1 ][0 ] <= 10 || c [1 ][1 ] <= 10 );
37
+
38
+ assert (((d [0 ][0 ] < 1 || d [0 ][0 ] > 10 ) || (d [0 ][1 ] < 1 || d [0 ][1 ] > 10 )));
39
+ assert (((d [1 ][0 ] < 1 || d [1 ][0 ] > 10 ) || (d [1 ][1 ] < 1 || d [1 ][1 ] > 10 )));
40
+
41
+ return 0 ;
42
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ fixed.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.5\] line 31 assertion a\[.*\]\[.*\] > 10: SUCCESS$
6
+ ^\[main.assertion.6\] line 33 assertion tmp_if_expr\$\d+: SUCCESS$
7
+ ^\[main.assertion.7\] line 34 assertion tmp_if_expr\$\d+: SUCCESS$
8
+ ^\[main.assertion.8\] line 36 assertion tmp_if_expr\$\d+: SUCCESS$
9
+ ^\[main.assertion.9\] line 38 assertion tmp_if_expr\$\d+: SUCCESS$
10
+ ^\[main.assertion.10\] line 39 assertion tmp_if_expr\$\d+: SUCCESS$
11
+ ^\*\* 4 of 10 failed
12
+ ^VERIFICATION FAILED$
13
+ ^EXIT=10$
14
+ ^SIGNAL=0$
15
+ --
16
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -6,14 +6,24 @@ int main()
6
6
int c [2 ][2 ];
7
7
int d [2 ][2 ];
8
8
9
+ // clang-format off
10
+ // clang-format would rewrite the "==>" as "== >"
9
11
__CPROVER_assume (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > a [i ][j ]<=10 }) });
10
12
13
+ assert (0 );
14
+
11
15
__CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > (!__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > b [i ][j ]>=1 && b [i ][j ]<=10 }) });
12
16
17
+ assert (0 );
18
+
13
19
__CPROVER_assume (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (!__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) });
14
20
21
+ assert (0 );
22
+
15
23
__CPROVER_assume (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > d [i ][j ]>=1 && d [i ][j ]<=10 }) });
24
+ // clang-format on
16
25
26
+ assert (0 );
17
27
18
28
assert (a [0 ][0 ]> 10 );
19
29
Original file line number Diff line number Diff line change 1
- CORE
1
+ KNOWNBUG
2
2
main.c
3
3
4
4
^\*\* Results:$
5
- ^\[main.assertion.1 \] line 18 assertion a\[.*\]\[.*\] > 10: SUCCESS$
6
- ^\[main.assertion.2 \] line 20 assertion tmp_if_expr\$\d+: SUCCESS$
7
- ^\[main.assertion.3 \] line 21 assertion tmp_if_expr\$\d+: SUCCESS$
8
- ^\[main.assertion.4 \] line 23 assertion tmp_if_expr\$\d+: SUCCESS$
9
- ^\[main.assertion.5 \] line 25 assertion tmp_if_expr\$\d+: SUCCESS$
10
- ^\[main.assertion.6 \] line 26 assertion tmp_if_expr\$\d+: SUCCESS$
11
- ^\*\* 0 of 6 failed
5
+ ^\[main.assertion.5 \] line 28 assertion a\[.*\]\[.*\] > 10: SUCCESS$
6
+ ^\[main.assertion.6 \] line 30 assertion tmp_if_expr\$\d+: SUCCESS$
7
+ ^\[main.assertion.7 \] line 31 assertion tmp_if_expr\$\d+: SUCCESS$
8
+ ^\[main.assertion.8 \] line 33 assertion tmp_if_expr\$\d+: SUCCESS$
9
+ ^\[main.assertion.9 \] line 35 assertion tmp_if_expr\$\d+: SUCCESS$
10
+ ^\[main.assertion.10 \] line 36 assertion tmp_if_expr\$\d+: SUCCESS$
11
+ ^\*\* 0 of 10 failed
12
12
^VERIFICATION SUCCESSFUL$
13
13
^EXIT=0$
14
14
^SIGNAL=0$
15
+ --
16
+ ^warning: ignoring
17
+ --
18
+ All assertions are unreachable as each of the __CPROVER_assume evaluate to false
19
+ (!exists i. i>=0 && i<2 ==> ... is equivalent to forall i. i>=0 && i<2 && ...,
20
+ where neither i>=0 nor i<2 is actually true for all values of i).
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ int main()
4
4
a [0 ]= 1 ;
5
5
a [1 ]= 2 ;
6
6
7
+ // clang-format off
8
+ // clang-format would rewrite the "==>" as "== >"
7
9
if (!__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 })
8
10
__CPROVER_assert (0 , "success 1" );
9
11
@@ -18,6 +20,7 @@ int main()
18
20
19
21
if (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=5 && a [i ]<=10 })
20
22
__CPROVER_assert (0 , "failure 2" );
23
+ // clang-format on
21
24
22
25
return 0 ;
23
26
}
Original file line number Diff line number Diff line change 11
11
^VERIFICATION FAILED$
12
12
^EXIT=10$
13
13
^SIGNAL=0$
14
+ --
15
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [2 ][2 ];
4
+ int b [2 ][2 ];
5
+
6
+ // clang-format off
7
+ // clang-format would rewrite the "==>" as "== >"
8
+ // NOLINTNEXTLINE(whitespace/line_length)
9
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > (__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > a [i ][j ]== i + j }) });
10
+ // NOLINTNEXTLINE(whitespace/line_length)
11
+ __CPROVER_assume (__CPROVER_exists { int i ; (i >=0 && i < 2 ) && (__CPROVER_exists {int j ; (j >=0 && j < 2 ) && b [i ][j ]== i + j + 1 }) });
12
+ // clang-format on
13
+
14
+ assert (a [0 ][0 ] == 0 );
15
+ assert (a [0 ][1 ] == 1 );
16
+ assert (a [1 ][0 ] == 1 );
17
+ assert (a [1 ][1 ] == 2 );
18
+ assert (b [0 ][0 ] == 1 || b [0 ][1 ] == 2 || b [1 ][0 ] == 2 || b [1 ][1 ] == 3 );
19
+ return 0 ;
20
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ fixed.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] line 14 assertion a\[.*\]\[.*\] == 0: SUCCESS$
6
+ ^\[main.assertion.2\] line 15 assertion a\[.*\]\[.*\] == 1: SUCCESS$
7
+ ^\[main.assertion.3\] line 16 assertion a\[.*\]\[.*\] == 1: SUCCESS$
8
+ ^\[main.assertion.4\] line 17 assertion a\[.*\]\[.*\] == 2: SUCCESS$
9
+ ^\[main.assertion.5\] line 18 assertion tmp_if_expr\$\d+: SUCCESS$
10
+ ^\*\* 0 of 5 failed
11
+ ^VERIFICATION SUCCESSFUL$
12
+ ^EXIT=0$
13
+ ^SIGNAL=0$
14
+ --
15
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -3,8 +3,11 @@ int main()
3
3
int a [2 ][2 ];
4
4
int b [2 ][2 ];
5
5
6
+ // clang-format off
7
+ // clang-format would rewrite the "==>" as "== >"
6
8
__CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > (__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > a [i ][j ]== i + j }) });
7
9
__CPROVER_assume (__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > b [i ][j ]== i + j + 1 }) });
10
+ // clang-format on
8
11
9
12
assert (a [0 ][0 ]== 0 );
10
13
assert (a [0 ][1 ]== 1 );
Original file line number Diff line number Diff line change 1
- CORE
1
+ KNOWNBUG
2
2
main.c
3
3
4
4
^\*\* Results:$
5
- ^\[main.assertion.1\] line 9 assertion a\[.*\]\[.*\] == 0: SUCCESS$
6
- ^\[main.assertion.2\] line 10 assertion a\[.*\]\[.*\] == 1: SUCCESS$
7
- ^\[main.assertion.3\] line 11 assertion a\[.*\]\[.*\] == 1: SUCCESS$
8
- ^\[main.assertion.4\] line 12 assertion a\[.*\]\[.*\] == 2: SUCCESS$
9
- ^\[main.assertion.5\] line 13 assertion tmp_if_expr\$\d+: SUCCESS $
10
- ^\*\* 0 of 5 failed
11
- ^VERIFICATION SUCCESSFUL $
12
- ^EXIT=0 $
5
+ ^\[main.assertion.1\] line 12 assertion a\[.*\]\[.*\] == 0: SUCCESS$
6
+ ^\[main.assertion.2\] line 13 assertion a\[.*\]\[.*\] == 1: SUCCESS$
7
+ ^\[main.assertion.3\] line 14 assertion a\[.*\]\[.*\] == 1: SUCCESS$
8
+ ^\[main.assertion.4\] line 15 assertion a\[.*\]\[.*\] == 2: SUCCESS$
9
+ ^\[main.assertion.5\] line 16 assertion tmp_if_expr\$\d+: FAILURE $
10
+ ^\*\* 1 of 5 failed
11
+ ^VERIFICATION FAILED $
12
+ ^EXIT=10 $
13
13
^SIGNAL=0$
14
+ --
15
+ ^warning: ignoring
16
+ --
17
+ The assertion on line 13 need not hold as the assume can be satisfied by picking
18
+ a value for i that does not fulfil the left-hand side of the implication.
Original file line number Diff line number Diff line change @@ -3,8 +3,11 @@ int main()
3
3
int a [2 ];
4
4
int b [2 ];
5
5
6
+ // clang-format off
7
+ // clang-format would rewrite the "==>" as "== >"
6
8
__CPROVER_assume ( __CPROVER_forall { float i ; (i >=0 && i < 2 ) == > a [i ]>=10 && a [i ]<=10 } );
7
9
__CPROVER_assume ( __CPROVER_forall { char i ; (i >=0 && i < 2 ) == > b [i ]>=10 && b [i ]<=10 } );
10
+ // clang-format on
8
11
9
12
assert (a [0 ]== 10 && a [1 ]== 10 );
10
13
assert (b [0 ]== 10 && b [1 ]== 10 );
You can’t perform that action at this time.
0 commit comments