%% Prolog Introduction and Critique %% Clauses %% the_tea_is_ready :- the_tea_cup_has_tea_in_it. %% ready(tea). Yes ready(Drink) :- in(Drink,_). in(tea,mug). %% Clauses objection %% the_tea_is_ready :- the_tea_is_saturated, fail. %% ready1(tea). No ready1(Drink) :- not(saturated(Drink)). saturated(tea). %% Terms %% ?- run1(pole,library). Yes run1(A,C) :- run(A,B), run(B,C). run(pole,tree). run(tree,library). %% Terms objection %% the_dogs_run :- the_dogs_are_tied_to_a_pole, fail. %%run(horse). No run(Animal) :- not(tied(Animal)). tied(horse). %% Facts %% the_children_climb. %% climb(tom,frame). Yes climb(tom,frame). %% Facts objection %% climb(frame). No climb(Object) :- not(frozen(Object)). frozen(frame). %% Predicate name %% buy(carrots). Yes buy1(Food) :- fresh(Food). fresh(carrots). %% Predicate name objection %% buy2(carrots). No buy2(Food) :- not(found(Food)). found(carrots). %% First Argument %% ate('Paul','banana'). Yes ate('Paul','banana'). %% First Argument objection %% ate('Paul'). No ate(Person) :- not(lands(Person)). lands('Paul'). %% Second Argument %% swallowed('Robert','tomato'). Yes swallowed('Robert','tomato'). %% Second Argument objection %% ate1(tomato). No ate1(Food) :- not(squashed(Food)). squashed(tomato). %% Commas %% loves('Helen','John'). Yes loves('Helen','John'). %% Commas objection %% kissed('John'). No kissed(Person) :- not(squeezed(Person)). squeezed('John'). %% Atoms %% planted('John','seeds'). Yes planted('John','seeds'). %% Atoms objection %% tripped('John'). No tripped('John') :- fail. %% Rules %% in3(apple,bag). Yes in2(Object1,Object2) :- in3(Object1,Object3), in3(Object3,Object2). in3(apple,box). in3(box,bag). %% Rules objection %% regurgitate(apple). No regurgitate(Food) :- not(slip_on(Food)). slip_on(apple). %% Head %% on(lid,table). Yes on(Object1,Object2) :- on1(Object1,Object3), on1(Object3,Object2). on1(lid,teapot). on1(teapot,table). %% Head objection %% pull(teapot). No pull(Object) :- not(inaccessible(Object)). inaccessible(teapot). %% Body %% next_to('Lily','Tess'). Yes next_to(Person1,Person2) :- next_to1(Person1,Person3), next_to1(Person3,Person2). next_to1('Lily','Jenny'). next_to1('Jenny','Tess'). %% Body objection %% clean('Lily'). No clean(Person) :- not(late(Person)). late('Lily'). %% First subgoal behind(Person1,Person2) :- behind1(Person1,Person3), behind1(Person3,Person2). behind1('Paul','Pauline'). behind1('Pauline','Jack'). %% First subgoal objection walk(Person) :- not(trip(Person)). trip('Paul'). %% Second subgoal above(Object1,Object2) :- above(Object1,Object3), above(Object3,Object2). above('top of bun','veggie patty'). above('veggie patty','bottom of bun'). %% Second subgoal objection eat(Filling) :- not(watery(Filling)). watery('veggie patty'). %% Full stops %% Tony is describing Joanne, Paul and Jan. left(X,Z) :- left(X,Y), left(Y,Z). left('Joanne','Paul'). left('Paul','Jan'). %% Full stops objection stop(Person) :- fall(Person). fall('Tony'). %% Variables ancestor(Grandparent,Child) :- parent(Grandparent,Parent), parent(Parent,Child). parent('Margaret','Maggie'). parent('Maggie','Quentin'). %% Variables objection blind('Margaret').