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:
“The hourly kindness, the days common speech,
The habitual content of each with each
When neither soul nor body has been crossed.”
—William Butler Yeats (18651939)
“Human beings will be happiernot when they cure cancer or get to Mars or eliminate racial prejudice or flush Lake Erie but when they find ways to inhabit primitive communities again. Thats my utopia.”
—Kurt Vonnegut, Jr. (b. 1922)
“If photography is allowed to stand in for art in some of its functions it will soon supplant or corrupt it completely thanks to the natural support it will find in the stupidity of the multitude. It must return to its real task, which is to be the servant of the sciences and the arts, but the very humble servant, like printing and shorthand which have neither created nor supplanted literature.”
—Charles Baudelaire (18211867)