diff --git a/src/plugins/wp/ProverWhy3.ml b/src/plugins/wp/ProverWhy3.ml index 36313df6ce8c335fec3e9480f643ee537fb4048a..295acb36142011bdd3c2092804ae9ec7934b61d0 100644 --- a/src/plugins/wp/ProverWhy3.ml +++ b/src/plugins/wp/ProverWhy3.ml @@ -914,9 +914,8 @@ class visitor (ctx:context) c = let t = share cnv Prop (Lang.F.e_prop p) in let t = Why3.Term.t_forall_close vars [] - (Why3.Term.t_equ - (Why3.Term.t_app id (List.map Why3.Term.t_var vars) result) - t) + (Why3.Term.t_iff t + (Why3.Term.t_app id (List.map Why3.Term.t_var vars) result)) in let decl = Why3.Decl.create_prop_decl Why3.Decl.Paxiom diff --git a/src/plugins/wp/tests/wp_acsl/oracle/predicates_functions.res.oracle b/src/plugins/wp/tests/wp_acsl/oracle/predicates_functions.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..a45be8713b32199aad2c18ada8c43ed5fb063ea1 --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/oracle/predicates_functions.res.oracle @@ -0,0 +1,46 @@ +# frama-c -wp [...] +[kernel] Parsing tests/wp_acsl/predicates_functions.i (no preprocessing) +[wp] Running WP plugin... +[wp] Loading driver 'share/wp.driver' +[wp] 1 goal scheduled +[wp:print-generated] + theory WP + (* use why3.BuiltIn.BuiltIn *) + + (* use bool.Bool *) + + (* use int.Int *) + + (* use int.ComputerDivision *) + + (* use real.RealInfix *) + + (* use frama_c_wp.qed.Qed *) + + (* use map.Map *) + + predicate P_P (i:int) = i = 42 + + predicate P_RP int + + axiom P_RP_def : + forall i:int. i <= 0 \/ P_P i /\ P_RP ((- 1) + i) <-> P_RP i + + function L_F (i:int) : int = 2 * i + + function L_RF int : int + + axiom L_RF_def : + forall i:int. L_RF i = (if i <= 0 then 0 else L_F i + L_RF ((- 1) + i)) + + goal wp_goal : forall i:int. 0 < i -> P_RP (L_RF i) + end +[wp] 1 goal generated +------------------------------------------------------------ + Global +------------------------------------------------------------ + +Lemma foo: +Prove: (0<i_0) -> (P_RP (L_RF i_0)) + +------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_acsl/predicates_functions.i b/src/plugins/wp/tests/wp_acsl/predicates_functions.i new file mode 100644 index 0000000000000000000000000000000000000000..d54998f4cedefdd31991f8557bb9119e683e3430 --- /dev/null +++ b/src/plugins/wp/tests/wp_acsl/predicates_functions.i @@ -0,0 +1,14 @@ +/* run.config + OPT:-wp-prover=why3 -wp-gen -wp-msg-key print-generated +*/ +/* run.config_qualif + DONTRUN: +*/ + +/*@ predicate P(integer i) = i == 42 ; */ +/*@ predicate RP(integer i) = (i <= 0) || ( P(i) && RP(i-1) ) ; */ + +/*@ logic integer F(integer i) = i * 2 ; */ +/*@ logic integer RF(integer i) = (i <= 0) ? 0 : F(i) + RF(i-1) ; */ + +/*@ lemma foo: \forall integer i ; i > 0 ==> RP(RF(i)) ; */ \ No newline at end of file