let replace_at_vars env label p =
try
let lsubst = MT.get_at_vars ~remove:false env label in
(* TODO : check without removing from env !
let check_var l () v =
try
let _ = List.assoc v lsubst in
let str =
Pretty_utils.sfprintf
"\\at(..\\at(_, %a).., %s) not always supported when \
inner label is after outer one"
Macros.pp_logic_label label l
in abort str
with Not_found -> ()
in
let rec do_data l () d = MT.visit_exp_in_data (check_exp l) () d
and check_exp l () at_exp =
Fol.fold_data_in_exp (check_var l) (do_data l) () at_exp
in
(* check if there is no variable of lsubst in e *)
let check_bind l (_v, e) = check_exp l () e in
Hashtbl.iter check_bind env.MT.env_at;
*)
let subst v =
try let e = List.assoc v lsubst in Some e
with Not_found -> None
in subst_vars subst p
with Not_found -> p