Question: [PROLOG] The predicate below could read as follows: A person is busy if they employed by two companies or if their employer is in Toronto

[PROLOG]

The predicate below could read as follows:

A person is busy if they employed by two companies or if their employer is in Toronto.

busy (X): - employee (X, C1), employee (X, C2), compare (<, C1, C2). busy (X): - employee (X, C), company (C, toronto).

Draw the complete search tree for the following query:

?- busy(X).

The Prolog search tree shows, for each node, the current goals to be proven. The branches of the tree must show the unification performed in order to pass from a parent node to its child node.

% Database for the above question

city(ottawa,ontario). city(toronto,ontario). city(kingston,ontario). city(gatineau,quebec). city(montreal,quebec). company(shopify,ottawa). company(rossvideo,ottawa). company(dium,gatineau). company(uber,toronto). company(deepmind,montreal). company(google,toronto). person(annie,gatineau). person(paul,gatineau). person(suzy,gatineau). person(robert,gatineau). person(tom,ottawa). person(tim,kingston). person(joe,montreal). person(jane,ottawa). person(marie,ottawa). person(jack,toronto). person(simon,toronto). employee(annie,dium). employee(tom,shopify). employee(jane,shopify). employee(marie,shopify). employee(joe,deepmind). employee(jack,google). employee(simon,google). employee(suzy,shopify). employee(paul,rossvideo). employee(marie,rossvideo). employee(simon,uber). 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!