ϵ">]>
Literature.
[1] J. Komara and P. J. Voda. Metamathematics of Computer Programming. 2001.
[2] J. Kľuka. Lecture Notes from Introduction to Declarative Programming Summer 2010/11.
Section. Tail Recursion and Iteration. See also in [1]:
the paragraph Fibonacci function in the section Primitive Recursion and
the paragraph Simulation of for-loops by recursion in the section Course of Values Recursion.
Your solution should simulate the following while-loop by primitive recursion:
if n = 0 then return(0) else begin n,a,b := n-1,1,0; while n <> 0 do n,a,b := n-1,a+b,a; return(a) end