Derivation and Safety of an Abstract Unification Algorithm for Groundness and Aliasing Analysis