prolog AI Homework