Mapping fusion and synchronized hyperedge replacement into logic programming