$ swipl -l puzzle.pl % /Users/whm/.plrc compiled 0.00 sec, 6 clauses % /Users/whm/372/a9/puzzle.pl compiled 0.00 sec, 4 clauses Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.6.6) Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Please visit http://www.swi-prolog.org for details. For help, use ?- help(Topic). or ?- apropos(Word). ?- mishaps. 1. Farmer Brown was bitten by a snake. 2. Mrs. Brown was butted by the cow. 3. Son Johnny was attacked by a wasp. 4. Daughter was stung by a bee. 5. Mr. Reston was kicked by the mule. true. ?-