An alternative way of expressing a lambda abstraction and reduction. Indexes are used instead of lettered terms based on the order of input. Abstractions are surrounded by []'s
(λmn.(λsz.ms(nsz)))(λsz.sz)(λsz.sz)
m -> 1, n -> 2, s -> 3, z -> 4
(λmn.(λsz.ms(nsz))) = [1 3 (2 3 4)]
(λsz.sz) = [1 2]
[1 3 (2 3 4)][1 2][1 2]
[[1 2] 2 (1 2 3)][1 2] ;1 was replaced with [1 2], remaining terms decremented
[[1 2] 1 ([1 2] 1 2)] ;1 was replaced with [1 2], remaining terms decremented
[1 ([1 2] 1 2)] ;1 2 was replaced by 1 ([1 2] 1 2)]
[1 (1 2)] ;1 2 was replaced by 1 2
(λmn.m(mn))
The notation above is just a more compact and unambiguous way of expressing lambda abstractions. Compound abstractions reduce to a single normal form automatically, alpha reduction is not needed.
Single positive indexes are used for bound terms. Negative indexes are used for kill terms. Negative indexes are placed last in order of decreasing magnitude.
I = λx.x = [1]
K = λxy.x = [1 -2]
KI = λyx.x = [2 -1]
S = λxyz.xz(yz) = [1 3 (2 3)]
Applying S to K:
[1 3 (2 3)][1 -2]
[[1 -2] 2 (1 2)] ;1 was replaced with [1 -2], remaining terms decremented
[[.2 -1] (1 2)] ;reducing: 1 replaced by .2*, -2 decremented (in magnitude)
[2 -2 -1] ;(1 2) bound terms become kill terms due to -1.
[2 -1] = KI ;-2 kill term is void due to surviving 2 term
* the . notation signifies the bound term is from the outer abstraction
and must be used to prevent decrementing and double replacement of the
term until the substitution of all terms in the abstraction is complete.
[2 -1][anything] ;applying KI to anything
[1] = I ;yeilds I, therefor SK[anything] = [1] = I
Applying K to K:
[1 -2][1 -2]
[[1 -2] -1] ;kill terms are absorbed and also increase the magnitude of bound terms
[2 -3 -1] ;applying this result to anything yields K.
[2 -3 -1][anything]
[2 -1]