Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Explain all drawbacks of the application procedure.

Answered: 1 week ago

Question

Determine Leading or Lagging Power Factor in Python.

Answered: 1 week ago