User blog comment:Primussupremus/Can someone please explain to me how the SKI combinator calculus works?/@comment-30754445-20170814190819

Basically, to expand a SKI string, you look at the first letter in the string and follow the rule associated with that letter: You repeat the process until the rules tell you to stop.

And these are the rules:

1. If the first letter is "I" we simply delete it. For example: I(frog) → frog

(I'm using english words for sake of clarity. Obviously, "frog" is not a valid SKI-string. An actual example would be - say - I(ISK) → ISK)

2. If the first letter is "K" then:

2a. If there are at least two things after the K, you erase both the K and the 2nd thing after it.

For example: K(frog)(toad)(cat) → (frog)(cat).

2b. If there are less than two thing after the K, the rules tell you to stop.

For example K(frog) → STOP

3. If the first letter is "S" then:

3a: If there are at least three things after the S, you do the following:

(i) Create a new object we'll call X, which is made of a copy of the 2nd and 3rd things after the S, together, in a pair of parenthesis.

(ii) insert the object you've created in (i) immediately after the 3rd thing after S.

(iii) erase the S and the original 2nd thing after S.

For example, if you have S(frog)(toad)(cat)(dog) then we do:

(i) X = ((toad)(cat))

(ii) Insert the X after the (cat) in the original string to get: S(frog)(toad)(cat) ((toad)(cat)) (dog)

(iii) erase the S and the 2nd thing after it (which is 'toad'):

(frog)(cat) ((toad)(cat)) (dog)

And the full transformation can be written as:

S(frog)(toad)(cat)(dog) → (frog)(cat) ((toad)(cat)) (dog)

3b. If there are less than three things after S, the rules tell you to stop.

Example: S(frog)(toad) → STOP

4. If the entire string left is 'I' (with nothing after it), the rules tell you to stop.

5. If the rules didn't tell you to stop (via rule 2b or 3b or 4), repeat the above process with your new string. Note that this cannot be done with the word examples above, because we have no rule for expanding a string that begins with (say) 'frog'. But in a real SKI-string, the 'words' are also made of S's and K's and I's, so the process can continue.

And that's it (for ordinary SKI calculus). The actual Xi function uses a stronger version that includes a 4th letter (Ω) but we can ignore it for now because Ω isn't really needed to create an uncomputable function.

Now, any SKI-string - when repeatedly expanded - will end up doing one of the following two things:

1. Eventually reach some final state and stop (via rules 2b or 3b or 4).

-or-

2. Expand forever.

So we can define the following uncomputable function:

f(n) = The maximum possible length (i.e. number of letters) of final state which was arrived from a starting string of length n.

And this function is indeed uncomputable, because it is possible to encode any computable function (any Turing Machine) as a SKI-string. Indeed, it can be shown that SKI calculus is exactly as powerful as ordinary Busy Beavers.