let get_ext_postconditions kf termination_kind =
let spec = Kernel_function.get_spec kf in
Wp_parameters.debug ~level:3 "[get_ext_postconditions] '%s' for %a@."
(string_of_termination_kind termination_kind)
Kernel_function.pretty_name kf;
let mk_id b p = mk_fct_post_id kf b termination_kind p in
let labels = NormAtLabels.labels_fct_post in
let add acc id p =
try
let p = NormAtLabels.preproc_annot labels p in
Wp_parameters.debug ~level:3 "take called postcond : %a@."
!Ast_printer.d_predicate_named p;
(id, p) :: acc
with e ->
let txt = Pretty_utils.sfprintf "postcondition %s" (prop_txt id) in
NormAtLabels.catch_label_error e txt "annotation"; acc
in
let add_behav acc b =
let assumes = Logic_const.pold (build_bhv_assumes b) in
let add_post acc p = match p with
| kind, p when kind = termination_kind ->
let id = mk_id b p in
let p = Logic_const.pred_of_id_pred p in
let p = Logic_const.pimplies (assumes, p) in
add acc id p
| _ -> acc
in
List.fold_left add_post acc b.b_post_cond
in
let acc = List.fold_left add_behav [] spec.spec_behavior in
if acc = [] then
Wp_parameters.debug ~level:3 "no called %s postcondition for %a@."
(string_of_termination_kind termination_kind)
Kernel_function.pretty_name kf;
acc