ϵ">]>
Literature.
[1] J. Komara. Specification and Verification of Programs. Downloadable lecture notes available through the web page of the course.
[2] J. Komara and P. J. Voda. Metamathematics of Computer Programming. 2001.
Euclidean algorithm II. Find a course of values recursive definition of based on the property
[CL] Remark. Note that we have
Section. Iterative Recursion. 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 with substitution in parameters:
def f(n): if n == 0: return 0 else: n,a,b = n-1,1,0 while n != 0: n,a,b = n-1,a+b,a return a