Why do we have a constant function as part of primitive recursive functions?

44 Views Asked by At

Currently taking a class on computability theory and started learning about primitive recursive functions. The constant function described as follows:

$C^n_a(x_1,...,x_n) = a$

First of all, why do we have a function of this sort to begin with? Can't we just refer to the constant itself as it is? Also why is $x_1, ..., x_n$ passed to it if they're not used?

1

There are 1 best solutions below

0
On BEST ANSWER
  1. If you don't have constant functions, none of the other rules will let you build them. They are all ways of combining previously defined functions or returning one of the arguments to the function. The constant functions are how you refer to constants.

  2. Sometimes functions just don't use some (or any) of their arguments.

    • These are perfectly valid functions
    • Also, some other rules involve combining functions that take all the 'extra' arguments necessary to compute the function. Then a constant base case must throw them all away. This is pretty commonplace in actual functional programming. General purpose functions that abstract 'looping' patterns might provide their cases with the most possible information, and a simple case just ignores that information and yields a constant.