let copy_table (s : ('p, ('p, 'q) Hashtbl.t) Hashtbl.t) 
               (t : ('r, ('r, 'q) Hashtbl.t) Hashtbl.t)
               (f : '-> 'r) = 
  Hashtbl.iter 
    (fun s1 m -> 
       let old_map = try Hashtbl.find t (f s1) with
           Not_found -> 
             let newmap = Hashtbl.create def_delta_size in
             let _ = Hashtbl.replace t (f s1) newmap in
               newmap 
       in
         Hashtbl.iter
           (fun s2 cs -> 
              Hashtbl.replace old_map (f s2) cs
           ) m
    ) s