Question: in Prolog, Given the fact, rules, and queries below % Facts & Rules fib(1,1). fib(2,1). fib(N,R):- N >= 3,N1 is N-1, N2 is N-2, fib(N1,R1),

in Prolog, Given the fact, rules, and queries below

% Facts & Rules fib(1,1). fib(2,1). fib(N,R):- N >= 3,N1 is N-1, N2 is N-2, fib(N1,R1), fib(N2,R2), R is R1+R2.

% Goals (queries) ?- fib(9,R). ?- fib(9,9).

a) Write English statement for the facts and rule. b) Describe step by step how the fib (3) is calculated. c) What is the answer of the two queries listed in bold. Explain them.

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!