Question: Question 4 ) [ 5 points ] By filling in the blanks in the knowledge base below, give facts / rules which introduce a relation

Question 4)[5 points] By filling in the blanks in the knowledge base below, give facts/rules which
introduce a relation subst. This relation has arity 4. Given an old element 0ld, a new element New, and
two lists x and Y, subst (New, Old, X, Y) holds if Y is the same list as x except where every occurrence
of the old element Old in x is replaced by an occurrence of the new element New in Y.
/* KNOWLEDGE BASE */
subst(dots,dots,[],[]).
subst(New , Old ,[..| T1],[... T2]) :- subst(New , Old ,...,...).
/* EXAMPLE QUERIES */
?- subst(7,1,[1,2,1,3],[7,2,7,3]).
Yes
?- subst(7,1,[1,2,1,3],[7,2,1,3]).
No
?- subst(7,1,[1,2,1,3],R).
R=[7,2,7,3]
 Question 4)[5 points] By filling in the blanks in the knowledge

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!