FACTOID # 136: Nauru, Tokelau and Western Sahara are the only three countries without official capital cities.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Anonymous recursion
Jump to: navigation, search
This article needs to be cleaned up to conform to a higher standard of quality.
This article has been tagged since November 2005.
See Wikipedia:How to edit a page and Category:Wikipedia help for help, or this article's talk page.


Anonymous recursion refers to the construction and existence of anonymously recursive functions. Given an n-argument recursive function f defined in terms of itself, it is possible to define an equivalent recursive anonymous function f * which is not defined in terms of itself. One possible procedure is the following: In mathematical logic and computer science, the recursive functions are a class of functions from natural numbers to natural numbers which are computable in some intuitive sense. ...

  1. Define an (n+1)-argument function h in terms of f the same way that f was defined in terms of itself, and let h′s last argument be f. (Function h inherits its first n arguments from f.)
  2. Change f, the last argument of h, from an n-argument function to an (n+1)-argument function by feeding f to itself as f′s last argument for all instances of f within the definition of h. (This puts function h and its last argument f on an equal footing.)
  3. Pass on h to itself as h′s own last argument, and let this be the definition of the desired n-argument recursive anonymous function f * :
f^* (x_1, x_2, ..., x_n) := h(x_1, x_2, ..., x_n, h)

where

h(.., f):= in terms of f(....,f)

in the same way as

f(..):= in terms of f(....).

Contents


Example

Given

f(x):= begin{cases} 1 & mbox{if}  x = 0  x cdot f(x - 1) & mbox{otherwise} end{cases}

The function f is defined in terms of itself: such circular definitions are not allowed in anonymous recursion (becase functions are not bound to labels). To start with a solution, define a function h(x,f) in exactly the same way that f(x) was defined above:

h(x,f) := begin{cases} 1 & mbox{if}  x = 0  x cdot f(x - 1) & mbox{otherwise} end{cases}

Second step: change f(x − 1) in the definition to f(x − 1,f):

h(x,f):=begin{cases} 1 & mbox{if}  x = 0  x cdot f(x-1, f) & mbox{otherwise} end{cases}

so that the function f passed on to h will have the same number of arguments as h itself.


Third step: the factorial function f * of x can now be defined as:

f * (x): = h(x,h).

Relation to the use of the Y combinator

The above approach to constructing anonymous recursion differs, but is related to, the use of fixed point combinators. To see how they are related, perform a variation of the above steps. Starting from the recursive definition (using the language of lambda calculus): A fixed point combinator is a function which computes fixed points of other functions. ... The lambda calculus is a formal system designed to investigate function definition, function application, and recursion. ...

bar f := (lambda n. , mbox{if}(n = 0, 1, n cdot bar f (n - 1)))

First step,

bar h:= (lambda f. lambda n. , mbox{if} (n = 0, 1, n cdot f (n - 1)))

Second step,

bar g:= (lambda g. lambda n.  mbox{if} (n = 0, 1, n cdot g (g) (n-1)))

where g (g) (n - 1) equiv g (g, n - 1). Note that the variation consists of defining bar g in terms of g(g,n − 1) instead of in terms of g(n − 1,g).


Third step: let a "Z combinator" be defined by

Z:= (lambda g.  (g  g))

such that

bar f^* := Z bar g.

Here, bar g is passed to itself right before a number is fed to it, so bar f^* n equiv n! for any Church number n. A Church integer is a representation of natural numbers as functions, invented by Alonzo Church as part of his lambda calculus. ...


Note that g  (g)  n equiv (g  (g))  n equiv (g  g)  n, i.e. g (g) equiv (g g).


Now an extra fourth step: notice that

bar g equiv (lambda g.  bar h  (g  g))

(see first and second steps) so that

bar f^* equiv (lambda. , g  (g  g)) (lambda g. , bar h (g  g))
equiv (lambda h. , (lambda g., (g  g)) (lambda g., h  (g  g)))  bar h.

Let the Y combinator be defined by

Y:= (lambda h. , (lambda g., (g  g)) (lambda g., h  (g  g)))

so that

Z bar g equiv Y bar h.

See also

The lambda calculus is a formal system designed to investigate function definition, function application, and recursion. ...

External links

  • The Lambda Calculus: notes by Don Blaheta (PDF file). See the section titled "What's left? Recursion", for the genesis of the Y combinator.

  Results from FactBites:
 
Fixed point combinator - definition of Fixed point combinator in Encyclopedia (567 words)
From a more practical point of view, fixed point combinators allow the definition of anonymous recursive functions.
By the way, these equations are meta-equations; functions in lambda calculus are all anonymous.
The function labels Y, H, FACT, PRED, MULT, ISZERO, 1, 0 (defined in the article for lambda calculus) are meta-labels, to which correspond meta-definitions and meta-equations, and with which a user can perform algebraic meta-substitutions.
  More results at FactBites »


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m