program on GNU Prolog