Changes between Version 16 and Version 17 of VerificationWithContracts
- Timestamp:
- 01/31/16 23:29:26 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
VerificationWithContracts
v16 v17 40 40 For example: 41 41 {{{ 42 /*@ requires (\valid(p) || !\valid(p) ) && \valid(q); 43 */ 44 foo(int * p, int * q); 45 }}} 46 The construction of an initial state seems to be irrelevant to if the pointer p is valid or not, but when CIVL recursively analyzes the requirement 47 predicate, it's hard to know if it's relevant or not. Thus my rough solution is : 48 1. Making `\valid` expressions uninterpreted functions; 49 2. Pointer "p" should be valid initially only if {{{ requirement => valid_of_p }}}; 50 3. Vice versa, pointer "p" should be undefined initially only if {{{ requirement => !valid_of_p }}}; 51 4. Otherwise, it's a non-deterministic choice. 42 52 53 Considering pointer alias, I'm planning such an approach: 54 First, there is an outer scope outside of the source function which is going to be verified. It can be used to represent a set of all visible 55 scopes from the source function. Thus, for each pointer argument, creating a unique unconstraint array element in the outer scope. 56 {{{ 57 $input int X[2]; // one for each pointer 43 58 59 /*@ requires \valid(p) && \valid(q); 60 */ 61 foo(int *p, int *q); 44 62 }}} 63 For this example, considering aliasing, the context can be 64 {{{ 65 ( ( \valid(p) && \valid(q) ) => \valid(p) ) => (exists i, 0 <= i < 2 such that *p == X[i] ); 66 }}} 67
