0

I would like to generate all the preconditions generated by Frama-C which are stored in a table according to the calculus.ml code. I am mainly interested to get the initial predicate which is converted to logic formula and sent to the solvers. Can this be done? Please help me to print the initial predicate which is sent to the solvers. The code I am trying with is given below:

int main()  
{  
    int x=42,y=40;  
    if(x<50)  
    {  
        x=x+2; y=x-y;  
    }   
    else  
    {  
        x=x-2; y=x-y;  
    }  
    //@ assert P: y>0;  
}
Pascal Cuoq
  • 79,187
  • 7
  • 161
  • 281
D.L.
  • 169
  • 3
  • 17
  • Have you seen the WP option list with `-wp-help` ? Did you try `-wp-print` ? If so, please explain how it is different from what you wish. – Anne Oct 22 '14 at 14:29
  • What i want is initial weakest precondition in terms of logical formula. Like for this (x<=51 ^ x-y>=1)V(x>=48 ^ x-y>=1) – D.L. Oct 22 '14 at 15:32
  • This is not the WP of your example. The WP is `if (42 < 50) then 42+2-40 > 0 else 42-2-40 > 0` which is trivially simplified to True by the tool. To get the kind of formula that you ask, you have to transform x and y declarations into formal parameters of the function. – Anne Oct 23 '14 at 06:31
  • But as far as i know this is forward analysis. If it is doing backward analysis then it will obviously generate some logic expression then put the value of x and y and will return true. – D.L. Oct 24 '14 at 04:08

1 Answers1

3

I think that you can get what you wish by using the -wp-out dir option, and then look at the generated .ergo file in the dir directory, but some simplifications might already have been done. I don't think that you can turn off these internal simplifications.

Anne
  • 1,270
  • 6
  • 15
  • The proof obligations were not generating because of qed. Now I am getting the prof obligations in a directory by disabling qed using -wp-no-simpl. Thank you for your help. – D.L. Jan 05 '15 at 04:54