File tree 15 files changed +49
-13
lines changed
Quantifiers-initialisation
Quantifiers-initialisation2
Quantifiers-invalid-var-range
Quantifiers-two-dimension-array
15 files changed +49
-13
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ 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
14
__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" );
@@ -18,6 +20,7 @@ int main()
18
20
__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
21
20
22
__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" );
23
+ // clang-format on
21
24
22
25
return 0 ;
23
26
}
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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -6,13 +6,16 @@ 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
11
13
__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
14
13
15
__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
16
15
17
__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 }) });
18
+ // clang-format on
16
19
17
20
18
21
assert (a [0 ][0 ]> 10 );
Original file line number Diff line number Diff line change 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$
5
+ ^\[main.assertion.1\] line 21 assertion a\[.*\]\[.*\] > 10: SUCCESS$
6
+ ^\[main.assertion.2\] line 23 assertion tmp_if_expr\$\d+: SUCCESS$
7
+ ^\[main.assertion.3\] line 24 assertion tmp_if_expr\$\d+: SUCCESS$
8
+ ^\[main.assertion.4\] line 26 assertion tmp_if_expr\$\d+: SUCCESS$
9
+ ^\[main.assertion.5\] line 28 assertion tmp_if_expr\$\d+: SUCCESS$
10
+ ^\[main.assertion.6\] line 29 assertion tmp_if_expr\$\d+: SUCCESS$
11
11
^\*\* 0 of 6 failed
12
12
^VERIFICATION SUCCESSFUL$
13
13
^EXIT=0$
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 @@ -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 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$
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+: SUCCESS$
10
10
^\*\* 0 of 5 failed
11
11
^VERIFICATION SUCCESSFUL$
12
12
^EXIT=0$
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 );
Original file line number Diff line number Diff line change 2
2
main.c
3
3
4
4
^\*\* Results:$
5
- ^\[main.assertion.1\] line 9 assertion tmp_if_expr(\$\d+)?: FAILURE$
6
- ^\[main.assertion.2\] line 10 assertion tmp_if_expr\$\d+: SUCCESS$
5
+ ^\[main.assertion.1\] line 12 assertion tmp_if_expr(\$\d+)?: FAILURE$
6
+ ^\[main.assertion.2\] line 13 assertion tmp_if_expr\$\d+: SUCCESS$
7
7
^\*\* 1 of 2 failed
8
8
^VERIFICATION FAILED$
9
9
^EXIT=10$
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ int zero_array[10];
2
2
3
3
int main ()
4
4
{
5
+ // clang-format off
6
+ // clang-format would rewrite the "==>" as "== >"
5
7
// C# style
6
8
assert (__CPROVER_forall { int i ; (i >=0 && i < 10 ) == > zero_array [i ]== 0 });
7
9
@@ -20,4 +22,5 @@ int main()
20
22
21
23
assert (__CPROVER_forall {unsigned i ; i > 9 || c [i ]== i });
22
24
return 0 ;
25
+ // clang-format on
23
26
}
You can’t perform that action at this time.
0 commit comments