let add_spec_post stmt_opt asked_bh acc spec =
let add_pred _b acc p =
match stmt_opt with
| None -> add_fct_post p acc
| Some s -> add_stmt_spec_post s p acc
in
let add_behav acc b =
let post = Ast_info.behavior_postcondition b in
let id_post = Logic_const.new_predicate post in
add_pred b acc id_post
in match asked_bh with
| None -> List.fold_left add_behav acc spec.spec_behavior
| Some bhv ->
let b = get_behav bhv spec.spec_behavior in
match b with None -> acc
| Some b -> List.fold_left (add_pred b) acc b.b_ensures