add prolog implementation