Whiteboard problems in pure Lambda Calculus
jtolds.com
jtolds.com
nil = λn.λc.n
cons = λx.λxs.λn.λc.c x (xs n c)
fold = λf.λz.λxs.xs z f
Another option is the Scott encoding, where a value is a case distinction nil = λn.λc.n
cons = λx.λxs.λn.λc.c x xs
fold = Y (λfold.λf.λz.λxs.xs z (λhead.λtail.f head (fold f z tail)))
And then there is the 3-tuple thing proposed in the article.In general, what you describe is representing an inductive type by its _eliminator_: https://www.quora.com/In-type-theory-what-is-an-eliminator-a...
In particular, and with apologies for being so clueless – it never occurred to me why currying was necessary – I didn't realize lambda calculus required functions to take only one argument. With that limitation, currying is genius.
The ironing is delicious.
https://github.com/MichaelBlume/lambdafuck/blob/master/src/l...
http://tromp.github.io/cl/Binary_lambda_calculus.html#Brainf...
to demonstrate the invariance theorem.
When Turing defined his machine model as a model for mechanical computation, Godel was convinced.
In an appendix to that paper, Turing also showed that his model was computationally equivalent to the lambda calculus. This involved writing a "universal" lambda expression, i.e. a combinator. (Y combinator is the most famous one, I think that was discovered by Haskell B. Curry.)
It was when Turing proved this equivalence that Godel accepted lambda calculus as a model of intuitive computation.
In between, I have heard that Church's student, Kleene, did formulate fixed-point combinators when proving addition was computable in the lambda-calculus. Kleene was then convinced that this was a universal model of computation. I do not know why Church did not follow this up.
So Turing does have some primacy over Church.
*edit: Most of Turing's work on this was done as an undergraduate at Cambridge, /before/ he became Church's doctoral student. So the work was not done under Church's supervision.
If you want to read further, you can read Soare's work on this tangled history:
http://www.people.cs.uchicago.edu/~soare/History/compute.pdf
https://en.wikipedia.org/wiki/History_of_the_Church%E2%80%93...
THEOREM XII. It is possible to associate simultaneously with every well-formed formula an enumeration of the formulas obtainable from it by conversion, in such a way that the function of two variables, whose value, when taken of a well-formed formula A and a positive integer n, is the n-th formula in the enumeration of the formulas obtainable from A by conversion, is recursive.
THEOREM XVI. Every recursive function of positive integers is λ-definable.
So approximately, Theorem XII gives an algorithm for evaluating a program A n steps, and theorem XVI says that this algorithm can be compiled in the a λ-calculus program.
Church cites a paper by Kleene for this construction[1]. It's true that the Kleene doesn't prove this using a general recursion combinator like the Y combinator; instead he first shows how to λ-encode primitive recursive functions, and gives a combinator for the μ operator [2].
When you talk about Church "not following up" the notion of universality, I'm not sure what more you would want him to do. Of course he did not prove that λ-calculus was equivalent to Turing machines, because those had not been invented yet. But he and Kleene did prove that the λ-definable functions coincide with the μ-recursive functions, which was the best known model of universal computation. And he argues ([0] section 7) that this captures the intuitive notions of "a function for which there exists an algorithm" and "a function which can be proven to have a given value".
[0] https://www.ics.uci.edu/~lopes/teaching/inf212W12/readings/c... [1] https://projecteuclid.org/download/pdf_1/euclid.dmj/10774894... [2] https://en.wikipedia.org/wiki/%CE%9C-recursive_function
I think that makes Mr. Church and his American team's work all the more interesting because they hadn't built practical machines and presumably never saw practical machines and worked almost exclusively in theory.
But it's tougher for our culture sometimes to credit the theorists and academics than it is to credit practical genius. Especially with the declassified documents of the incredible practical computing work Mr. Turing accomplished during the war (and helping the war effort), it is easy to give him a lion's share of the credit and ignore some of the equally fascinating/important academic work of Mr. Turing's contemporaries. (Especially knowing in retrospect that the practical work fed the academic work and vice versa.)
I have no clue why Turing became such a pop-culture icon, though...
He's definitely more known than Alonzo Church, though.
Turing had personal attributes that culture-makers in NY and Hollywood want to promote to people.
I can't say this was even close in terms of enjoyment or originality. Maybe I missed the point?
Serious question: if the code is legit and can't be simplified any shorter (like you could in any C style lang), can we consider lambda calculus the string theory of programming? By that I mean lots of work for little gain (as it turned out to be nowadays) ((I know it has gains in other fields)).
I can imagine it like an assembly like compile target and it can explain the verboseness.
https://www.youtube.com/watch?v=VUhlNx_-wYk
Well, perhaps not exactly the same thing, but only because Ruby requires the Z-combinator due to applicative order.
(λx.x y)
does not return y, though
(\x.x) y
does.