          
%		The Pigs and Balloons Puzzle
%
% (1) All, who neither dance on tight ropes nor eat penny-buns, are old.
% (2) Pigs, that are liable to giddiness, are treated with respect.
% (3) A wise balloonist takes an umbrella with him.
% (4) No one ought to lunch in public who looks ridiculous and eats penny-buns.
% (5) Young creatures, who go up in balloons, are liable to giddiness.
% (6) Fat creatures, who look ridiculous, may lunch in
%     public, provided that they do not dance on tight ropes.
% (7) No wise creatures dance on tight ropes, if liable to giddiness.
% (8) A pig looks ridiculous, carrying an umbrella.
% (9) All, who do not dance on tight ropes, and who are treated
%     with respect are fat.
%     Show that no wise young pigs go up in balloons.
%				-Lewis Carroll, Symbolic Logic, p. 378


predicates( [
	balloonist,
	dances_on_tightropes,
	eats_lunch_in_public,
	eats_pennybuns,
	fat,
	has_umbrella,
	liable_to_giddiness,
	looks_ridiculous,
	old,
	pig,
	treated_with_respect,
	wise,
	young
	   ] ).

axiom( [ [], [dances_on_tightropes(X), eats_pennybuns(X), old(X)] ] ).
axiom( [ [pig(X), liable_to_giddiness(X)], [treated_with_respect(X)] ] ).
axiom( [ [wise(X), balloonist(X)], [has_umbrella(X)] ] ).
axiom( [ [looks_ridiculous(X),eats_pennybuns(X),eats_lunch_in_public(X)], [] ] ).
axiom( [ [balloonist(X), young(X)], [liable_to_giddiness(X)] ] ).
axiom( [ [fat(X), looks_ridiculous(X)],
		[dances_on_tightropes(X), eats_lunch_in_public(X)] ] ).
axiom( [ [liable_to_giddiness(X), wise(X), dances_on_tightropes(X)], [] ] ).
axiom( [ [pig(X), has_umbrella(X)], [looks_ridiculous(X)] ] ).
axiom( [ [treated_with_respect(X)], [dances_on_tightropes(X), fat(X)] ] ).

% Everyone is young or old

axiom( [ [], [young(X), old(X)] ] ).
axiom( [ [young(X), old(X)], [] ] ).


axiom( [ [], [wise(piggy)] ] ).
axiom( [ [], [young(piggy)] ] ).
axiom( [ [], [pig(piggy)] ] ).
axiom( [ [], [balloonist(piggy)] ] ).





precedence( [
	balloonist,
	dances_on_tightropes,
	eats_lunch_in_public,
	eats_pennybuns,
	fat,
	has_umbrella,
	liable_to_giddiness,
	looks_ridiculous,
	old,
	pig,
	treated_with_respect,
	wise,
	young,
	piggy
	   ] ).





