Question: Create the following Prolog rules for working with polynomials. gen _ poly / 1 which has as its arguments a list of terms. The rule

Create the following Prolog rules for working with polynomials.
gen_poly/1 which has as its arguments a list of terms. The rule should assert a rule f/2 that succeeds when the first argument is a value and the second argument is the result of evaluating the polynomial at the value given. In the example below, notice that f/2 is undefined before we call gen_poly, then after the call f/2 is defined.
?- f(2,N).
ERROR: Undefined procedure: f/2(DWIM could not correct goal)
?- gen_poly([[1|2],[2|1],[3|0]]).
true.
?- f(2,N).
N =11.

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!