Skip to content

Problem when arguments are not used in predicates

ID0001767: This issue was created automatically from Mantis Issue 1767. Further discussion may take place here.


Id Project Category View Due Date Updated
ID0001767 Frama-C Plug-in > wp public 2014-04-30 2015-03-17
Reporter davyg Assigned To correnson Resolution fixed
Priority normal Severity minor Reproducibility always
Platform - OS - OS Version -
Product Version Frama-C Neon-20140301 Target Version - Fixed in Version Frama-C Sodium

Description :

The following example generates an error when it is exported to coq/why3 or alt-ergo.

/@predicate p(double x, int y) = y;/

/@lemma lem : p((double) 0, (int) 1);/

The why file generated by wp is the following one :

theory Axiomatic

...

predicate p_p (y_0 : int) = 0 <> y_0

lemma Q_lem: (p_p 1.0)

end

Wp detects that x is not used so it does not appear in why predicate p_p when it is used in Q_lem the correct value is taken(1) but its type is incorrect that's why wp put 1.0(a real) and not 1(an int) as argument. It takes the correct value : the one of the second argument in the original lemma but takes the type of the first argument to generate the constant and not the second one.

Steps To Reproduce :

Write a file test.c with :

/@predicate p(double x, int y) = y;/

/@lemma lem : p((double) 0, (int) 1);/

And run frama-c -wp test.c

You will get the following error :

[kernel] preprocessing with "gcc -C -E -I. test.c" [wp] Running WP plugin... [wp] Collecting axiomatic usage [wp] 1 goal scheduled /tmp/wpd136d4.dir/typed/lemma_lem.ergo:9:[wp] user error: Alt-Ergo error: characters 17-25:typing error: int and real cannot be unified [wp] [Alt-Ergo] Goal typed_lemma_lem : Failed Error: characters 17-25:typing error: int and real cannot be unified [wp] Proved goals: 0 / 1 Alt-Ergo: 0 (failed: 1)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information