% An example based on p262 of Appleby 91 'Programming Lnguages' % This uses a simplified english grammar. :-consult('/u/faculty/dick/cs320/prolog/english.pl'). :-verb([watches]). :-pred([is_happy]). X is_happy:-X watches football, X has supplies. X has supplies:-X has beer, X has pretzels. X watches football:-X sees T, T isa tv, X owns T, T is_on. T is_on:-cowboys on T. tom owns his_tv. his_tv isa tv. tom sees his_tv. cowboys on his_tv. tom has beer. tom has pretzels. dick has beer. dick owns two_tvs. two_tvs isa tv. harry has pretzels. joan has beer. joan has pretzels. joan has her_radio. her_radio is_on. :- write('Monday night is now'), nl. :-print('Words defined: is_happy, is_on, has, supplies, beer, pretzels, tom...'). :- write('Try: Who is_happy? and listing!'), nl. why:-pp postfix is_happy; pp infix has; pp infix owns; pp infix isa. why:-pp infix sees; pp postfix is_on.