let add x =
Term.fold
(fun y acc ->
try
let uy = Map.find y acc in
let uy' = Set.add x uy in
if uy == uy' then acc else Map.add y uy' acc
with
Not_found ->
Map.add y (Set.singleton x) acc)