File tree 24 files changed +580
-46
lines changed
Quantifiers-initialisation
Quantifiers-initialisation2
Quantifiers-invalid-var-range
Quantifiers-two-dimension-array
24 files changed +580
-46
lines changed Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+
4
+ int c [2 ][2 ];
5
+ c [0 ][0 ]= 0 ;
6
+ c [0 ][1 ]= 1 ;
7
+ c [1 ][0 ]= 1 ;
8
+ c [1 ][1 ]= 2 ;
9
+
10
+ __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
+
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" );
13
+
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-Exists: failed" );
15
+
16
+ __CPROVER_assert (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > c [i ][j ]>=1 && c [i ][j ]<=10 }) }, "NotExists-Forall: failed" );
17
+
18
+ __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
+
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-NotForall: successful" );
21
+
22
+ return 0 ;
23
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] Exists-Exists: successful: SUCCESS$
6
+ ^\[main.assertion.2\] NotExists-NotExists: successful: SUCCESS$
7
+ ^\[main.assertion.3\] NotExists-Exists: failed: FAILURE$
8
+ ^\[main.assertion.4\] NotExists-Forall: failed: FAILURE$
9
+ ^\[main.assertion.5\] NotForall-Forall: successful: SUCCESS$
10
+ ^\[main.assertion.6\] NotForall-NotForall: successful: SUCCESS$
11
+
12
+ ^\*\* 2 of 6 failed (2 iterations)$
13
+ ^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [2 ];
4
+ a [0 ]= 1 ;
5
+ a [1 ]= 2 ;
6
+
7
+ int x = __CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 };
8
+ int y = __CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]< 2 };
9
+ int z1 = __CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]< 1.5 };
10
+ int z2 = __CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]< 2 * 10 };
11
+
12
+ assert (x );
13
+ assert (y );
14
+ assert (z1 );
15
+ assert (z2 );
16
+
17
+ return 0 ;
18
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] assertion x: SUCCESS$
6
+ ^\[main.assertion.2\] assertion y: FAILURE$
7
+ ^\[main.assertion.3\] assertion z1: SUCCESS$
8
+ ^\[main.assertion.4\] assertion z2: SUCCESS$
9
+
10
+ ^\*\* 1 of 4 failed (2 iterations)$
11
+ ^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [5 ];
4
+ int b [5 ];
5
+
6
+ a [0 ]= 0 ;
7
+ a [1 ]= 1 ;
8
+ a [2 ]= 2 ;
9
+ a [3 ]= 3 ;
10
+ a [4 ]= 4 ;
11
+
12
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 5 ) == > b [i ]== a [i ]});
13
+
14
+ assert (b [0 ]== 0 );
15
+ assert (b [1 ]== 1 );
16
+ assert (b [2 ]== 2 );
17
+ assert (b [3 ]== 3 );
18
+ assert (b [4 ]== 4 );
19
+ return 0 ;
20
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] assertion b\[(signed long int)0\] == 0: SUCCESS$
6
+ ^\[main.assertion.2\] assertion b\[(signed long int)1\] == 1: SUCCESS$
7
+ ^\[main.assertion.3\] assertion b\[(signed long int)2\] == 2: SUCCESS$
8
+ ^\[main.assertion.4\] assertion b\[(signed long int)3\] == 3: SUCCESS$
9
+ ^\[main.assertion.5\] assertion b\[(signed long int)4\] == 4: SUCCESS$
10
+
11
+ ^\*\* 0 of 5 failed (1 iteration)$
12
+ ^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [2 ];
4
+ a [0 ]= 1 ;
5
+ a [1 ]= 2 ;
6
+
7
+ if (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 })
8
+ __CPROVER_assert (0 , "failure 1" );
9
+
10
+ if (__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 })
11
+ __CPROVER_assert (0 , "failure 2" );
12
+
13
+ if (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=2 && a [i ]<=10 })
14
+ __CPROVER_assert (0 , "success 1" );
15
+
16
+ if (__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=2 && a [i ]<=10 })
17
+ __CPROVER_assert (0 , "failure 3" );
18
+
19
+ if (__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=5 && a [i ]<=10 })
20
+ __CPROVER_assert (0 , "success 2" );
21
+
22
+ return 0 ;
23
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] failure 1: FAILURE$
6
+ ^\[main.assertion.2\] failure 2: FAILURE$
7
+ ^\[main.assertion.3\] success 1: SUCCESS$
8
+ ^\[main.assertion.4\] failure 3: FAILURE$
9
+ ^\[main.assertion.5\] success 2: SUCCESS$
10
+
11
+ ^\*\* 3 of 5 failed (2 iterations)$
12
+ ^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [5 ];
4
+
5
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 5 ) == > a [i ]== i + 1 });
6
+
7
+ assert (a [0 ]== 1 );
8
+ assert (a [1 ]== 2 );
9
+ assert (a [2 ]== 3 );
10
+ assert (a [3 ]== 4 );
11
+ assert (a [4 ]== 5 );
12
+ return 0 ;
13
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] assertion a\[(signed long int)0\] == 1: SUCCESS$
6
+ ^\[main.assertion.2\] assertion a\[(signed long int)1\] == 2: SUCCESS$
7
+ ^\[main.assertion.3\] assertion a\[(signed long int)2\] == 3: SUCCESS$
8
+ ^\[main.assertion.4\] assertion a\[(signed long int)3\] == 4: SUCCESS$
9
+ ^\[main.assertion.5\] assertion a\[(signed long int)4\] == 5: SUCCESS$
10
+
11
+ ^\*\* 0 of 5 failed (1 iteration)$
12
+ ^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [10 ];
4
+ int c [10 ];
5
+
6
+ // C# style
7
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 9 + 1 ) == > a [i ]>=1 && a [i ]<=10 });
8
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 10 ) == > __CPROVER_forall {int j ; (j > i && j < 10 ) == > a [j ]> a [i ]} });
9
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 9 ) == > c [i + 1 ]>=c [i ] });
10
+
11
+
12
+ __CPROVER_assert (__CPROVER_forall {unsigned i ; (i >=0 && i < 10 ) == > a [i ]>=1 && a [i ]<=10 }, "forall a[]" );
13
+ assert (a [9 ]> a [1 ]);
14
+ assert (a [2 ]> a [3 ]);
15
+ __CPROVER_assert (__CPROVER_forall {unsigned i ; (i >=1 && i < 10 ) == > c [i - 1 ]<=c [i ]}, "forall c[]" );
16
+ assert (c [3 ]>=c [1 ]);
17
+ return 0 ;
18
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] forall a\[\]: SUCCESS$
6
+ ^\[main.assertion.2\] assertion a\[(signed long int)9\] > a\[(signed long int)1\]: SUCCESS$
7
+ ^\[main.assertion.3\] assertion a\[(signed long int)2\] > a\[(signed long int)3\]: FAILURE$
8
+ ^\[main.assertion.4\] forall c\[\]: SUCCESS$
9
+ ^\[main.assertion.5\] assertion c\[(signed long int)3\] >= c\[(signed long int)1\]: SUCCESS$
10
+
11
+ ^\*\* 1 of 5 failed (2 iterations)$
12
+ ^VERIFICATION FAILED$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+
4
+ int a [3 ][3 ];
5
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 5 ) == > __CPROVER_exists {int j ; (j >=i && j < 3 ) == > a [i ][j ]== 10 } });
6
+
7
+ assert (a [0 ][0 ]== 10 || a [0 ][1 ]== 10 || a [0 ][2 ]== 10 );
8
+
9
+ return 0 ;
10
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+
6
+ ^\*\* 0 of 1 failed (1 iteration)$
7
+ ^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+
4
+ int a [2 ][2 ];
5
+ int b [2 ][2 ];
6
+ int c [2 ][2 ];
7
+ int d [2 ][2 ];
8
+
9
+ __CPROVER_assume (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > a [i ][j ]<=10 }) });
10
+
11
+ __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
+
13
+ __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
+
15
+ __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 }) });
16
+
17
+
18
+ assert (a [0 ][0 ]> 10 );
19
+
20
+ assert ( (b [0 ][0 ]< 1 || b [0 ][0 ]> 10 ) && (b [0 ][1 ]< 1 || b [0 ][1 ]> 10 ));
21
+ assert ( (b [1 ][0 ]< 1 || b [1 ][0 ]> 10 ) && (b [1 ][1 ]< 1 || b [1 ][1 ]> 10 ));
22
+
23
+ assert (c [0 ][0 ]== 0 || c [0 ][1 ]== 0 || c [1 ][0 ]<=10 || c [1 ][1 ]<=10 );
24
+
25
+ assert ( ((d [0 ][0 ]< 1 || d [0 ][0 ]> 10 ) || (d [0 ][1 ]< 1 || d [0 ][1 ]> 10 )) );
26
+ assert ( ((d [1 ][0 ]< 1 || d [1 ][0 ]> 10 ) || (d [1 ][1 ]< 1 || d [1 ][1 ]> 10 )) );
27
+
28
+
29
+ return 0 ;
30
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] assertion a\[(signed long int)0\]\[(signed long int)0\] > 10: SUCCESS$
6
+ ^\[main.assertion.2\] assertion tmp_if_expr$3: SUCCESS$
7
+ ^\[main.assertion.3\] assertion tmp_if_expr$6: SUCCESS$
8
+ ^\[main.assertion.4\] assertion tmp_if_expr$9: SUCCESS$
9
+ ^\[main.assertion.5\] assertion tmp_if_expr$12: SUCCESS$
10
+ ^\[main.assertion.6\] assertion tmp_if_expr$15: SUCCESS$
11
+
12
+ ^\*\* 0 of 6 failed (1 iteration)$
13
+ ^\VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [2 ];
4
+ a [0 ]= 1 ;
5
+ a [1 ]= 2 ;
6
+
7
+ if (!__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 })
8
+ __CPROVER_assert (0 , "success 1" );
9
+
10
+ if (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=1 && a [i ]<=10 })
11
+ __CPROVER_assert (0 , "success 2" );
12
+
13
+ if (!__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > a [i ]>=2 && a [i ]<=10 })
14
+ __CPROVER_assert (0 , "failure 1" );
15
+
16
+ if (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=2 && a [i ]<=10 })
17
+ __CPROVER_assert (0 , "success 3" );
18
+
19
+ if (!__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > a [i ]>=5 && a [i ]<=10 })
20
+ __CPROVER_assert (0 , "failure 2" );
21
+
22
+ return 0 ;
23
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] success 1: SUCCESS$
6
+ ^\[main.assertion.2\] success 2: SUCCESS$
7
+ ^\[main.assertion.3\] failure 1: FAILURE$
8
+ ^\[main.assertion.4\] success 3: SUCCESS$
9
+ ^\[main.assertion.5\] failure 2: FAILURE$
10
+
11
+ ^\*\* 2 of 5 failed (2 iterations)$
12
+ ^\VERIFICATION FAILED$
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
+ __CPROVER_assume (__CPROVER_forall { int i ; (i >=0 && i < 2 ) == > (__CPROVER_forall {int j ; (j >=0 && j < 2 ) == > a [i ][j ]== i + j }) });
7
+ __CPROVER_assume (__CPROVER_exists { int i ; (i >=0 && i < 2 ) == > (__CPROVER_exists {int j ; (j >=0 && j < 2 ) == > b [i ][j ]== i + j + 1 }) });
8
+
9
+ assert (a [0 ][0 ]== 0 );
10
+ assert (a [0 ][1 ]== 1 );
11
+ assert (a [1 ][0 ]== 1 );
12
+ assert (a [1 ][1 ]== 2 );
13
+ assert (b [0 ][0 ]== 1 || b [0 ][1 ]== 2 || b [1 ][0 ]== 2 || b [1 ][1 ]== 3 );
14
+ return 0 ;
15
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] assertion a\[(signed long int)0\]\[(signed long int)0\] == 0: SUCCESS$
6
+ ^\[main.assertion.2\] assertion a\[(signed long int)0\]\[(signed long int)1\] == 1: SUCCESS$
7
+ ^\[main.assertion.3\] assertion a\[(signed long int)1\]\[(signed long int)0\] == 1: SUCCESS$
8
+ ^\[main.assertion.4\] assertion a\[(signed long int)1\]\[(signed long int)1\] == 2: SUCCESS$
9
+ ^\[main.assertion.5\] assertion tmp_if_expr$3: SUCCESS$
10
+
11
+ ^\*\* 0 of 5 failed (1 iteration)$
12
+ ^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int a [2 ];
4
+ int b [2 ];
5
+
6
+ __CPROVER_assume ( __CPROVER_forall { float i ; (i >=0 && i < 2 ) == > a [i ]>=10 && a [i ]<=10 } );
7
+ __CPROVER_assume ( __CPROVER_forall { char i ; (i >=0 && i < 2 ) == > b [i ]>=10 && b [i ]<=10 } );
8
+
9
+ assert (a [0 ]== 10 && a [1 ]== 10 );
10
+ assert (b [0 ]== 10 && b [1 ]== 10 );
11
+
12
+ return 0 ;
13
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^\*\* Results:$
5
+ ^\[main.assertion.1\] assertion tmp_if_expr$1: FAILURE$
6
+ ^\[main.assertion.2\] assertion tmp_if_expr$2: SUCCESS$
7
+
8
+ ^\*\* 1 of 2 failed (2 iterations)$
9
+ ^\VERIFICATION FAILED$
You can’t perform that action at this time.
0 commit comments