Programming in Prolog, 3rd Edition