173 points · by abiboudis · 5y ago · 52 comments
[1] http://people.cs.uchicago.edu/~odonnell/Teacher/Lectures/For...
https://en.wikipedia.org/wiki/Combinatory_logic#One-point_ba...
[1] https://books.google.com/books?id=1xEVkzuX5e0C&pg=PA779&lpg=...
A combinator is not just a closed lambda term; it must have all lambdas in leading position. Like S = \x \y \z. x z (y z)
> A combinator [...] must have all lambdas in leading position.
What's your opinion on:
ωabcd = bd(cd) if a has no normal form[0][1]
or = c if b has no normal form
or = d if c has no normal form
or = dd otherwise
where
SII = ωωωω
Ω = SII(SII) = ωωωω(ωωωω)
S = ωΩ = ω(ωωωω(ωωωω))
K = ωωΩ = ωω(ωωωω(ωωωω))
I = ωωωΩ = ωωω(ωωωω(ωωωω))
as a single-'combinator' basis?0: Aka, does not halt.
1: Evaluation diverges if a (or b or c, if queried) is somthing like:
SII(C(C(B(ωωx(KI)K)(SII))Ω)I)
(from https://en.wikipedia.org/wiki/Combinatory_logic#Undecidabili...) that tries to diagonalize ω.It is very long, contains surprisingly few of the characteristic Wolfram promotion usually found in Wolfram texts, but besides a detailed biography and pictures of historic documents, there are a few gems (people who researched "algebra of logic" before most others) for the persistent reader.
> And maybe if the operation we now call currying needs a symbol we should be using the “sha” character Ш from the beginning of Schönfinkel’s name to remind us of a person about whom we know so little, but who planted a seed that gave us so much.
That's a good suggestion!
For folks who are interested in combinators but didn't get what they want from the text: the approachable reference on combinators is Hindley and Sheldon's "Lambda-Calculus and Combinators: an introduction"
... and of course, there is "To mock a mockingbird" by Raymond Smullyan, which introduces the topic through puzzles.
One I like:
"Of course, there are confusions. There’s yet another birthdate for Schönfinkel: September 4, 1889. Wrong year. Perhaps wrongly done correction from the Julian calendar."
Here we are over 100 years later and still dealing with constant time and calendar bugs.
Stephen Wolfram obviously knows what he's talking about... but lacks Feynman's ability to put it into layman's terms.
My suspicion is that there is an implied list, and if you go off the end of the list, you get a hidden zero... if not, you get a one.
The SKI combinator Wikipedia page has a section about Boolean logic that comes close to making sense to me.
Please let me know if I'm getting this right.... restating the page, putting it into familiar notation
Booleans are a list of [1,0]
T(x,y) = x
F(x,y) = y
Applying this over Booleans
T(1,0) --> 1
F(1,0) --> 0
They then go to explain that
T(x,y) = K combinator
Then they go on to explain
False(x,y) = SK, which I think is K(S(Boolean)
It's at this point, I'm lost.
Is SK --> S(K(xy)) or K(S(xy))
I can't resolve that to get any further.
S := λx.λy.λz.x z (y z)
K := λx.λy.x
I := λx.x
There's nothing really more to it. What's weird/amazing is that just with these three (technically, just S and K, as I can be derived from them), you can compute anything.How many parameters do S,K,or I take?
If x=11, y=12, z=13 what are S,K? I assume I = 11
S 11 12 = 12
K 11 12 13 = 11 13 (12 13)
I 11 = 11
Keep in mind that the literals "11," "12," and "13" in λ-Calculus aren't numbers.[1] https://personal.utdallas.edu/~gupta/courses/apl/lambda.pdf
S x y z = x z (x z)
K x y = x
I x = x
So, you can think of the whole thing as a list of S K I and parenthesized sequences of S, K, and I.If you see S up front, you take the next three things (call then x y and z) and put them back on in this order x y (x z). x, y, and z are either a letter or a parenthesized sequence of letters and parentheses.
Note that S is the only combinator that makes the list longer.
If you want to think of them as functions they need to be _curried_. So they take one argument at a time and return a new function that takes the next argument. In javascript, if "(x, y) => x + y" were your function, the curried version would be: "x => y => x + y".
Expressed in javascript, our combinators are like: (but lazily evaluated)
let S = x => y => z => x(z)(y(z))
let K = x => y => x
let I = x => x
Note for example that (K x) would be a new function that takes one more value, throws it away and returns x. K is sometimes called the constant function.True / False are represented by building an expression that returns either the first thing that comes after it, or the second thing. So True/False are in essence their own if statements:
T t e = t
F t e = e
(I'll call the variables t and e for "then" and "else".)So T = K, and SK will do what F is doing above, we apply it to t e and expand using the rules above to see:
S K t e = K e (t e) = e
You can think of this as just applying the rewrite rules above, but it sounds like you want to also think of it in terms of functions. In which case, in the javascript notation you're looking at: S(K)(t)(e)
S is applied to K to get a new function that takes two more arguments, above we wrote: S = x => y => z => x(z)(y(z))
so S(K) is y => z => K(z)(K(y(z))
Applying this to 't', we get S(K)(t) is z => K(z)(K(t(z))
And then applying this to e: S(K)(t)(e) is K(e)(K(t(e)))
Now K(e) is (anything) => e, so the K(t(e)) is just thrown away.This is where trying to express it in javascript gets a little wiggy. The t(e) here might not make sense. The K(e) function throws away the K(t(e)) but in javascript all of the arguments are evaluated before handing them to the function, so it would evaluate t(e) and then K(t(e)) before handing it K(e), where it is then ignored.
In the SKI calculus, recursion relies on this laziness (or you'd loop forever going down a path that would be thrown away).
Numbers can be expressed as functions using _Church encoding_.
Zero f x = x
Succ num f x = f (num f x)
Here, Zero is 0, Succ Zero is 1, Succ (Succ Zero) is 2, etc. If you expand this out, it looks like: Zero f x = x
One f x = f(x)
Two f x = f(f(x))
...
So a number ends up being something that takes a function and a value and calls the function on the value that number of times. There are ways to do addition, subtraction, multiplication, etc.If you want to go deep down this rabbit hole, there was an IOCCC entry that was a simplified version of Haskell that compiled down to the SKI calculus - and it could compile itself. The process of developing it is written up here:
https://crypto.stanford.edu/~blynn/compiler/
It's pretty dense stuff, but fascinating.>S K t e = K e (t e) = e
S K t e = K e (t e) // that makes sense
What is (t e)? I got to the same point in the python example down thread.
It is "t" applied to "e" - so it would be t(e) in javascript notation. This could be nonsensical, but because of lazy evaluation it never gets expanded/evaluated. (K doesn't use its second argument.)
The SKI stuff is defined as applying those replacement rules from the outside in, so:
K e (t e) ... -> e ...
you take that whole expression from the front (K and the next two expressions) and replace it with the expression that was in the first argument's location. But (t e) here is dropped without ever being expanded / evaluated.Most languages fully evaluate arguments before passing them to functions, but a few rare languages like Haskell don't evaluate the arguments until they're needed. So for
K e (t e)
it will assign the whole tree (t e) wherever y occurs in the function definition, and just keep passing it along until something needs its value (if you use apply it to something like a function, use it in a case statement, or pass it to a primitive function like plus).The miranda language (whose source was recently published) is also lazy, and works by compiling your code down to SKI combinators and then evaluating them. So this actually has been used in practice.
Göttingen was at the time a top place for mathematics. In fact, it was a sufficient “math town” that around that time postcards of local mathematicians were for sale there.
Utterly charming.
Consider "Planet Without Laughter" (note this from the site of Knuth-- that Knuth --and presumably he hosts it there for a reason, so pay attention kids!)
https://www-cs-faculty.stanford.edu/~knuth/smullyan.html
Also he looks like Gandalf! :)
https://en.wikipedia.org/wiki/Far_Rockaway,_Queens#Notable_p...
It seems Smullyan moved to Manhattan and went to high school in the Bronx, so they would not have been at Far Rockaway High School together.
In any event, I don't think the piece is meant as a "ha ha" comedy. It's more of a contemplation or a work of philosophy.
Did it make you smile at any point?
If not, um... retroactive spoiler warning? Sorry.
Say, have you heard of that book, The Three Knuths of Ypsilanti?
[1] http://www.cip.ifi.lmu.de/~langeh/test/1924%20-%20Schoenfink...
[2]https://plato.stanford.edu/entries/logic-combinatory/#SchoEl...
[1] https://ncatlab.org/nlab/show/partial+combinatory+algebra
https://writings.stephenwolfram.com/2020/12/where-did-combin...
https://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combi...
From a programmer's viewpoint it seems like a daunting task: Write all your programs without using variables. Can that work in practice?
On yet another tombstone, I wonder how many people internally within the wolfram dark net, touched this up Before it got published.
The so called gem notes, are more often than not, not his own discoveries aka universality of rule 110. Truth be told I hear many other voices in this piece that have not been mentioned or acknowledged.