Changes between Version 16 and Version 17 of VerificationWithContracts


Ignore:
Timestamp:
01/31/16 23:29:26 (10 years ago)
Author:
ziqing
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • VerificationWithContracts

    v16 v17  
    4040For example:
    4141{{{
     42/*@ requires (\valid(p) || !\valid(p) ) && \valid(q);
     43*/
     44foo(int * p, int * q);
     45}}}
     46The 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
     47predicate, 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.
    4252
     53Considering 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
    4358
     59/*@ requires \valid(p) && \valid(q);
     60*/
     61foo(int *p, int *q);
    4462}}}
     63For 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