let replace map f a =
let tau = ref dep0 in
let lookup y =
try
let (b, rho) = f y in
if not(rho == dep0) then
tau := dep2 rho !tau;
b
with
Not_found -> y
in
let b = map lookup a in
(b, !tau)