Simple logic problem solved with PROLOG