1

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?

Clever7-
  • 21
  • 4
  • Because it's convenient to have such a thing in the tool chest later. If that were the end of the course it might indeed be pointless, but presumably you have lots left to do and this will be used. – David K Mar 09 '24 at 04:20
  • I'm familiar with only having a one-variable zero function, a one-variable successor function, projections, compositions and primitive recursion. You can build a constant function on any number of variables from projection, zero and successor. Do you object to having a one-variable zero function? – Chad K Mar 09 '24 at 18:01

1 Answers1

1
  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.
Dan Doel
  • 3,715