Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started