previous up next
Go backward to Recursive Definitions
Go up to Top
Go forward to Example
RISC-Linz logo

Example

Recursive function definition

*: N x N -> N
x * y :=
   if y = 0
      then 0
      else x + x * (y-1)
with termination function t(x, y) := y.

Reduction sequence:

2*3 = 2+(2*2) = 2+(2+2*1) =
   2+(2+(2+(2*0))) = 2+(2+(2+0)) = 6.

Termination after a finite number of unfoldings.


Author: Wolfgang Schreiner
Last Modification: October 14, 1999

previous up next