Characterizations of termination in logic programming