Talk:Church encoding

message: The following discussion was moved here from Talk:Church numeral as a result of that page being merged into this one. --David Wahler (talk) 15:53, 25 October 2005 (UTC)
thread_title: Moved

message: Isn't the scheme implementation backwards?
That is, shouldn't it be:
(define zero (lambda (f) (lambda (x) x)))
(define one  (lambda (f) (lambda (x) (f x))))
(define two  (lambda (f) (lambda (x) (f (f x)))))
(define three (lambda (f) (lambda (x) (f (f (f x))))))
This would be in line with both the top-of-page explanatory text and the Haskell, not to mention the examples given on the lambda calculus page.  Actually, why make it as hard to read as it is?  Just say:
(define (zero f) (lambda (x) x))
(define (one f) (lambda (x) (f x)))
(define (two f) (lambda (x) (f (f x))))
(define (three f) (lambda (x) (f (f (f x)))))
The unchurch examples also become less obscure:
(define (add1 x) (+ x 1))
(define (unchurch c) ((c add1) 0))
However, I fail to see what the scheme example adds at this point.  The Haskell is already clean, and above all matches the English text.  Also, the Haskell allows you to define all the church integers at one swoop, whereas the scheme example only shows a few examples (because the scheme equivalent of the "church" function is just too ugly).
Scrap the scheme.  It adds nothing to the article and just gets in the way of understanding what church numbers are.
:* I agree with erasing the scheme example. It is worse than the Haskell one. If someone wants to do it in pure lambda calculus, that would be worthwhile. Brighterorange 16:40, 2 Jun 2005 (UTC)
thread_title: Scheme Example

message: The Haskell functions are elegant. But I can't help noticing that if you use extended Haskell, you can write the types as
 church :: Integer -> (forall a. Church a)
 unchurch :: (forall a. Church a) -> Integer
This shows the isomorphism (actually, with natural numbers, not Integer) a little more clearly. But then others might complain that this isn't (yet) Haskell. —Ashley Y 11:33, 2 December 2005 (UTC)
replies: text: I'm more of an ML person myself, but aren't both of those pretty much the same?  forall a. Church a just eliminates the prenex restriction on the type of the function, if Haskell even has a prenex restriction.  I don't suppose it really matters much either way.  --bmills 22:30, 4 December 2005 (UTC)
replies: text: The type signature for "church" is exactly the same, as you say, but the one for unchurch isn't. (church,unchurch) is not an isomorphism between the naturals and "Church Integer", but it is an isomorphism between the naturals and "forall a. Church a". However, I don't intend to change it. —Ashley Y 10:38, 5 December 2005 (UTC)
thread_title:  Haskell functions 

message: The intro states: "Many students of mathematics are familiar with Gödel numbering members of a set; Church encoding is an equivalent operation defined on lambda abstractions instead of natural numbers." Doesn't this needlessly obfuscate things? What meaning of "equivalent" is this? I think it is best to delete this sentence.  --LambiamTalk 07:15, 16 November 2006 (UTC)
thread_title:  Relationship to Gödel numbering 

message: I have written a Python implementation of Church lists using higher order functions, when I was bored.  Feel free to reference it, if you like.  --Ertugrul S. (talk) 01:26, 26 January 2009 (UTC)
thread_title:  External implementations 

message: The term (\n.((n(\x.F))(\x.T))) [n], where [n] is the Church numeral of n, equals T if n is zero and F is n is not zero. Should the predicate Zero?=\n.((n(\x.F))(\x.T)) not be added to the numerical functions like Plus, Pred, etc? Jos.koot (talk) 10:17, 1 April 2009 (UTC)
thread_title:  Zero-predicate 

message: Shouldn't the functions here be the same as those in the lambda calculus article? Phantom Hoover (talk) 14:44, 19 December 2009 (UTC)
thread_title:  Currying 

message: Are Peano axioms at all related to Church encodings for numbers and addition? If so, they ought to at least be referenced.  —Preceding unsigned comment added by Indil (talk • contribs) 04:27, 12 May 2011 (UTC)
thread_title:  Mention Peano axioms? 

message: I found the explanations found elsewhere hard to follow.  I hope this is more accessible.
Thepigdog (talk) 05:30, 3 November 2013 (UTC)
thread_title:  Added an explanation of predecessor 

message: I am considering some cosmetic changes to this page to write the lambda calculus using the Extension:Math - MediaWiki. If anyone has a strong affection for the current layout please tell me and I will desist.  I really like MathJax option in preferences for displaying math.  I have never had any problem with it and it is much clearer.  Also it zooms when you click on it :). I use x\ y for application, which looks good but is a little cumbersome to write.
Thepigdog (talk) 17:26, 4 December 2013 (UTC)
thread_title:  Clean up 

message: I added division and signed numbers.  Its overkill in terms of demonstrating the Church-Turing thesis, but some people appear to be curious about how negative number may be implemented.  The best source I have found on signed numbers is,
* representing-negative-and-complex-numbers-using-lambda-calculus
but its really a high level summary answer to a question.  I don't know if it is appropriate to add it as a reference.  Other sites were hard to understand and or coded in Scheme.  
The best I found for division is Lloyd Allison's site,
* Lambda Calculus Integers
His implementation of DIVMOD allows both divisor and remainder to be defined.  I haven't used exactly that definition because it is harder to understand and it uses MINUS (MONUS) twice, which takes many beta reductions.  However the description I have given doesn't seem that good to me.  I will think on it.
Thepigdog (talk) 12:29, 25 March 2014 (UTC)
thread_title:  Division and negative numbers 

message: Hello fellow Wikipedians,
I have just modified  on Church encoding. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
*Added archive https://web.archive.org/web/20160304083208/http://tromp.github.io/cl/LC.pdf to http://tromp.github.io/cl/LC.pdf
When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at ).
Cheers.—InternetArchiveBot (Report bug) 14:12, 24 November 2016 (UTC)
thread_title:  External links modified 

message: Someone brought up the two definitions for boolean negation in #haskell, talking about the definitions not_1 and not_2 in this section.
No one seemed to know why there were two and the definitions seemed to work both in haskell and in python so I don't understand the difference. It doesn't seem to have anything to do with strict v. lazy -- as opposed to what the notes seem to say -- since both work in both a strict and a lazy language.
Clarification or correction of the article would be much appreciated.
2A02:1810:2505:BF00:EC76:4D29:7CE7:51FB (talk) 23:19, 23 December 2018 (UTC)
replies: text: Agreed, the notes are definitely incorrect.  I'm removing them, and if there are relevant actual differences between the two they can be added in the future. Ebf526 (talk) 01:02, 20 July 2021 (UTC)
thread_title:  Church encoded boolean logic operators <math>not_1</math> and <math>not_2</math>