prolog working