Some Common Primitive Recursive Functions
- The following examples and definitions are from Kleene (1952) pp. 223-231 — many appear with proofs. Most also appear with similar names, either as proofs or as examples, in Boolos-Burgess-Jeffrey 2002 pp. 63-70; they add #22 the logarithm lo(x, y) or lg(x, y) depending on the exact derivation.
In the following we observe that primitive recursive functions can be of four types:
- functions for short: "number-theoretic functions" from { 0, 1, 2, ...} to { 0, 1, 2, ...},
- predicates: from { 0, 1, 2, ...} to truth values { t =true, f =false },
- propositional connectives: from truth values { t, f } to truth values { t, f },
- representing functions: from truth values { t, f } to { 0, 1, 2, ... }. Many times a predicate requires a representing function to convert the predicate's output { t, f } to { 0, 1 } (note the order "t" to "0" and "f" to "1" matches with ~(sig( )) defined below). By definition a function φ(x) is a "representing function" of the predicate P(x) if φ takes only values 0 and 1 and produces 0 when P is true".
In the following the mark " ' ", e.g. a', is the primitive mark meaning "the successor of", usually thought of as " +1", e.g. a +1 =def a'. The functions 16-21 and #G are of particular interest with respect to converting primitive recursive predicates to, and extracting them from, their "arithmetical" form expressed as Gödel numbers.
-
- Addition: a+b
- Multiplication: a×b
- Exponentiation: ab,
- Factorial a! : 0! = 1, a'! = a!×a'
- pred(a): Decrement: "predecessor of a" defined as "If a> 0 then a-1 → anew else 0 → a."
- Proper subtraction: a ┴ b defined as "If a ≥ b then a-b else 0."
- Minimum (a1, ... an)
- Maximum (a1, ... an)
- Absolute value: | a-b | =defined a ┴ b + b ┴ a
- ~sg(a): NOT: If a=0 then sg(a)=1 else if a>0 then sg(a)=0
- sg(a): signum(a): If a=0 then sg(a)=0 else if a>0 then sg(a)=1
- "b divides a" : If the remainder ( a, b )=0 then else b does not divide a "evenly"
- Remainder ( a, b ): the leftover if b does not divide a "evenly". Also called MOD(a, b)
- a = b: sg | a - b |
- a < b: sg( a' ┴ b )
- Pr(a): a is a prime number Pr(a) =def a>1 & NOT(Exists c)1
- Pi: the i+1-st prime number
- (a)i : exponent ai of pi =def μx ; μx is the minimization operator described in #E below.
- lh(a): the "length" or number of non-vanishing exponents in a
- a×b: given the expression of a and b as prime factors then a×b is the product's expression as prime factors
- lo(x, y): logarithm of x to the base y
- In the following, the abbreviation x =def xi, ... xn; subscripts may be applied if the meaning requires.
- #A: A function φ definable explicitly from functions Ψ and constants q1, ... qn is primitive recursive in Ψ.
- #B: The finite sum Σy
ψ(x, y) and product Πy ψ(x, y) are primite recursive in ψ. - #C: A predicate P obtained by substituting functions χ1,..., χm for the respective variables of a predicate Q is primitive recursive in χ1,..., χm, Q.
- #D: The following predicates are primitive recursive in Q and R:
-
-
- NOT_Q(x) .
- Q OR R: Q(x) V R(x),
- Q AND R: Q(x) & R(x),
- Q IMPLIES R: Q(x) → R(x)
- Q is equivalent to R: Q(x) ≡ R(x)
-
- #E: The following predicates are primitive recursive in the predicate R:
-
-
- (Ey)y
R(x, y) where (Ey)y denotes "there exists at least one y that is less than z such that" - (y)y
R(x, y) where (y)y denotes "for all y less than z it is true that" - μyy
R(x, y). The operator μyy R(x, y) is a bounded form of the so-called minimization- or mu-operator: Defined as "the least value of y less than z such that R(x, y) is true; or z if there is no such value."
- (Ey)y
-
- #F: Definition by cases: The function defined thus, where Q1, ..., Qm are mutually exclusive predicates (or "ψ(x) shall have the value given by the first clause that applies), is primitive recursive in φ1, ..., Q1, ... Qm:
-
- φ(x) =
- φ1(x) if Q1(x) is true,
- . . . . . . . . . . . . . . . . . . .
- φm(x) if Qm(x) is true
- φm+1(x) otherwise
- φ(x) =
- #G: If φ satisfies the equation:
-
- φ(y,x) = χ(y, NOT-φ(y; x2, ... xn ), x2, ... xn then φ is primitive recursive in χ. 'So, in a sense the knowledge of the value NOT-φ(y; x2 to n ) of the course-of-values function is equivalent to the knowledge of the sequence of values φ(0,x2 to n), ..., φ(y-1,x2 to n) of the original function."
Read more about this topic: Primitive Recursive Function
Famous quotes containing the words common, primitive and/or functions:
“There seems to be a common strain of miserliness in the American people when it comes to throwing away toothpaste tubes which have a little left in the bottom.”
—Robert Benchley (18891945)
“[How] the young . . . can grow from the primitive to the civilized, from emotional anarchy to the disciplined freedom of maturity without losing the joy of spontaneity and the peace of self-honesty is a problem of education that no school and no culture have ever solved.”
—Leontine Young (20th century)
“Let us stop being afraid. Of our own thoughts, our own minds. Of madness, our own or others. Stop being afraid of the mind itself, its astonishing functions and fandangos, its complications and simplifications, the wonderful operation of its machinerymore wonderful because it is not machinery at all or predictable.”
—Kate Millett (b. 1934)