Professional Researcher's Encyclopaedia

Knowledge is only a click away

Church integer - enyclopaedia article

Church integer

Summary: A Church integer is a representation of natural numbers as functions, invented by Alonzo Church as part of his lambda calculus. The natural number n is represented as a higher-order function, which takes a function f as argument and returns the n-fold composition f o f o ... o f as result. For example, in Haskell, a function that returns a particular Church integer might be church 0 = \\ f x -> x church n = c where c f x = c' f (f x) where c' = church ...

read the full Church integer article

Buy Church integer related products:


Buy from Amazon.co.uk Books - Music - Classical - VHS - DVD - Video-games - Software - Electronics - Toys
Buy from Amazon.com Books - Music - Classical - VHS - DVD - Videogames - Software - Electronics - Photo - Toys
Buy from Amazon.ca Books - Music - Classical - VHS - DVD - Video-games - Software - Livres en Français
Buy from Amazon.de - - - - - - -
Buy from Amazon.fr - - - - -
Advanced Product Search (new):    uk    |     us    |     ca    |     de    |     fr

Church integer

     From Wikipedia, the free encyclopedia.

A Church integer is a representation of natural numbers as functions, invented by Alonzo Church as part of his lambda calculus. The natural number n is represented as a higher-order function, which takes a function f as argument and returns the n-fold composition f o f o ... o f as result.

For example, in Haskell, a function that returns a particular Church integer might be

church 0 = \\ f x -> x
church n = c
  where
    c f x = c' f (f x)
      where
        c' = church (n - 1) 
The transformation from a Church integer to an integer might be
unchurch n = n (+1) 0
Thus the (+1) function would be applied to an initial value of 0 n times, yielding the ordinary integer n.

See lambda calculus for another expression of the same idea.

See also: Gödel number.


An earlier version of the above article was posted on PlanetMath. This article is open-content.

There are some interactive examples of Church integers here.

link to this article with the following HTML

 
This article is from Wikipedia. This article was up-to-date as of 8 May 2004 - See live article
All text is available under the terms of the GNU Free Documentation License.

This page is part of Professional Researcher
Web site design by Dean Marshall