Question: prolog programming $ problem 1 (simple recursion) & Given facts: in(toy, greenbox). $ toy is in greenbox in(greenbox, redbox). % greenbox is in redbox in(redbox,

prolog programming prolog programming $ problem 1 (simple recursion) & Given facts: in(toy, greenbox).

$ problem 1 (simple recursion) & Given facts: in(toy, greenbox). $ toy is in greenbox in(greenbox, redbox). % greenbox is in redbox in(redbox, bluebox). % redbox is in bluebox % Implement a predicate find_in(X,Y) that is true iff 8 X is in Y or x can be found in an object in Y. Use recursion. The predicate should work for any facts in(Obji, Obj2) such as given above. % Test cases: % ? - find_in(toy, greenbox). % true. $ ?- find_in(toy, redbox). % true. % ?- find_in(toy, bluebox). % true. 8 ?- find_in(greenbox, bluebox). % true. ? - find_in(toy, orangebox). $ false. 8 Write your solution here

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!