Implementation of syntactic unification algorithm on dag