File tree 13 files changed +62
-24
lines changed
quantifiers-exists-ensures-01
quantifiers-exists-ensures-02
quantifiers-exists-requires-01
quantifiers-exists-requires-02
quantifiers-forall-ensures-01
quantifiers-forall-ensures-02
quantifiers-forall-requires-01
quantifiers-forall-requires-02 13 files changed +62
-24
lines changed Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
main.c
3
3
--enforce-all-contracts
4
4
^EXIT=0$
Original file line number Diff line number Diff line change
1
+ // clang-format off
1
2
int f1 (int * arr ) __CPROVER_ensures (__CPROVER_exists {
2
3
int i ;
3
- (0 <= i && i < 10 ) && arr [i ] == i
4
+ (0 <= i && i < 10 ) == > arr [i ] == i
4
5
})
6
+ // clang-format on
5
7
{
6
8
for (int i = 0 ; i < 10 ; i ++ )
7
9
{
Original file line number Diff line number Diff line change 6
6
^VERIFICATION SUCCESSFUL$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the postconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_exists
10
+ in __CPROVER_ensures clauses. By using the --enforce-all-contracts flag,
11
+ goto-instrument will transform the __CPROVER_ensures clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_exists.
Original file line number Diff line number Diff line change
1
+ // clang-format off
1
2
int f1 (int * arr ) __CPROVER_ensures (__CPROVER_exists {
2
3
int i ;
3
- (0 <= i && i < 10 ) && arr [i ] != 0
4
+ (0 <= i && i < 10 ) == > arr [i ] != 0
4
5
})
6
+ // clang-format on
5
7
{
6
8
for (int i = 0 ; i < 10 ; i ++ )
7
9
{
Original file line number Diff line number Diff line change 1
- CORE
1
+ KNOWNBUG
2
2
main.c
3
3
--enforce-all-contracts
4
4
^EXIT=10$
5
5
^SIGNAL=0$
6
6
^VERIFICATION FAILED$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the postconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_exists
10
+ in __CPROVER_ensures clauses. By using the --enforce-all-contracts flag,
11
+ goto-instrument will transform the __CPROVER_ensures clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_exists.
13
+
14
+ Known Bug:
15
+ We expect verification to fail because arr[i] is always equal to 0 for
16
+ [0 <= i < 10]. In fact, we expect the (0 <= i && i < 10) statement to act as a
17
+ range for i. However, in the current implementation of quantifier handling,
18
+ the (0 <= i && i < 10) statement is not interpreted as an explicit range, but
19
+ instead, as part of a logic formula, which causes verification to succeed.
Original file line number Diff line number Diff line change
1
+ // clang-format off
1
2
int f1 (int * arr ) __CPROVER_requires (__CPROVER_exists {
2
3
int i ;
3
- (0 <= i && i < 10 ) && arr [i ] == 4
4
+ (0 <= i && i < 10 ) == > arr [i ] == 4
4
5
}) __CPROVER_ensures (__CPROVER_return_value == 0 )
6
+ // clang-format on
5
7
{
6
8
return 0 ;
7
9
}
Original file line number Diff line number Diff line change 6
6
^VERIFICATION SUCCESSFUL$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the preconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_exists
10
+ in __CPROVER_requires clauses. By using the --replace-all-calls-with-contracts
11
+ flag, goto-instrument will transform the __CPROVER_requires clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_exists.
Original file line number Diff line number Diff line change
1
+ // clang-format off
1
2
int f1 (int * arr ) __CPROVER_requires (__CPROVER_exists {
2
3
int i ;
3
- (0 <= i && i < 10 ) && arr [i ] == 1
4
+ (0 <= i && i < 10 ) == > arr [i ] == 1
4
5
}) __CPROVER_ensures (__CPROVER_return_value == 0 )
6
+ // clang-format on
5
7
{
6
8
return 0 ;
7
9
}
Original file line number Diff line number Diff line change 1
- CORE
1
+ KNOWNBUG
2
2
main.c
3
3
--replace-all-calls-with-contracts
4
4
^EXIT=10$
5
5
^SIGNAL=0$
6
6
^VERIFICATION FAILED$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the preconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_exists
10
+ in __CPROVER_requires clauses. By using the --replace-all-calls-with-contracts
11
+ flag, goto-instrument will transform the __CPROVER_requires clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_exists.
13
+
14
+ Known Bug:
15
+ We expect verification to fail because arr[i] is never equal to 1 for
16
+ [0 <= i < 10]. In fact, we expect the (0 <= i && i < 10) statement to act as a
17
+ range for i. However, in the current implementation of quantifier handling,
18
+ the (0 <= i && i < 10) statement is not interpreted as an explicit range, but
19
+ instead, as part of a logic formula, which causes verification to succeed.
Original file line number Diff line number Diff line change 1
1
CORE
2
2
main.c
3
- --replace -all-calls-with -contracts
3
+ --enforce -all-contracts
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
6
^VERIFICATION SUCCESSFUL$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the preconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_forall
10
+ in __CPROVER_ensures clauses. By using the --enforce-all-contracts
11
+ flag, goto-instrument will transform the __CPROVER_ensures clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_forall.
Original file line number Diff line number Diff line change 6
6
^VERIFICATION FAILED$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the postconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_forall
10
+ in __CPROVER_ensures clauses. By using the --enforce-all-contracts
11
+ flag, goto-instrument will transform the __CPROVER_ensures clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_forall.
Original file line number Diff line number Diff line change 6
6
^VERIFICATION SUCCESSFUL$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the preconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_forall
10
+ in __CPROVER_requires clauses. By using the --replace-all-calls-with-contracts
11
+ flag, goto-instrument will transform the __CPROVER_requires clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_forall.
Original file line number Diff line number Diff line change 6
6
^VERIFICATION FAILED$
7
7
--
8
8
--
9
- Verification:
10
- This test asserts the preconditions of f1.
9
+ The purpose of this test is to ensure that we can safety use __CPROVER_forall
10
+ in __CPROVER_requires clauses. By using the --replace-all-calls-with-contracts
11
+ flag, goto-instrument will transform the __CPROVER_requires clauses into an
12
+ assertion and the verification remains sound when using __CPROVER_forall.
You can’t perform that action at this time.
0 commit comments