Question

This is a question from the book Data structures using C and C++ by Tenenbaum. Not a homework problem but self-study.

Recursive definition of a+b, where a and b are non-negative integers, in terms of successor function succ defined as

succ(int x) { return(x++); }

I have been thinking how is it possible? Can I change the function? I am not sure from the problem definition in the book. So how can this be done?

Was it helpful?

Solution

Here is a hint:

a + 3 = succ(succ(succ(a)))

Also, by definition, every natural number is either 0 or the successor of some (smaller) natural number.

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top