+let add_coercion (src,tgt,u,saturations) =
+ let f s t = eq_carr s src && eq_carr t tgt in
+ let where = List.filter (fun (s,t,_) -> f s t) !db in
+ let rest = List.filter (fun (s,t,_) -> not (f s t)) !db in
+ match where with
+ | [] -> db := (src,tgt,[u,1,saturations]) :: !db
+ | (src,tgt,l)::tl ->
+ assert (tl = []); (* not sure, this may be a feature *)
+ if List.exists (fun (x,_,_) -> UriManager.eq u x) l then
+ let l' = List.map
+ (fun (x,n,saturations') ->
+ assert (saturations=saturations');
+ if UriManager.eq u x then
+ (x,n+1,saturations)
+ else
+ (x,n,saturations))
+ l
+ in
+ db := (src,tgt,l')::tl @ rest
+ else
+ db := (src,tgt,(u,1,saturations)::l)::tl @ rest
+
+;;