3

The wikipedia entry on lambda calculus defines some formulas that work with Church numerals like

SUCC := λn.λf.λx.f (n f x)

In Churches paper where he first defines his lambda calculus, he says that

..a function of two variables whose value, when taken of the well-formed formulas F and X, is the formaula {F}(X), is recursive..

Later on in his paper, he calls this function B(m,n).

How could all this information be used to describe how a function like B might work on the SUCC 1

I understand that we will have to work out the inputs and outputs as powers of primes as throughout the paper he uses Gódel's numbering system however I'm just finding it hard to piece it all together.

André Kool
  • 4,880
  • 12
  • 34
  • 44

1 Answers1

0

I use lambda calculus with javascript. I gonna try to show some little example, how the SUCC and the function B aka Bluebird/Compose works and can be combosed.

First a little reminder with Church-Numerals (in JS):

const n0 = f => x => x       
const n1 = f => x => f(x) 
const n2 = f => x => f(f(x))     
const n3 = f => x => f(f(f(x)))

and the Succesor SUCC := λnfx.f(nfx) for the Church-Numerals in JS: const succ = n => f => x => f( n(f)(x) ). We can see that the succ-Function just takes a Church-Numeral and add a f before, so that a succ(n1) with the body f(x) would be f(f(x)). Therefore, it ends up doing 1 + n compositions of f in total.

// example creating new Church-Numbers with the Succesor-Function
const n4 = succ(n3)
const n5 = succ(n4)

// or do Addition with Church-Numbers
const n7  = n2(succ)(n5)
const n10 = n5(succ)(n5)

//to test if it works, us the helper-function churchtoJsNum
const churchtoJsNum = n => n(x => x + 1)(0)

churchtoJsNum(n10) // 10

There is another way to write successor, because we are doing n-fold compositions: a compose function. Smullyan named this the Bluebird after Curry’s B combinator.

B := λfgx.f(gx)

in JS: const B = f => g => x => f(g(x))

Now can combine the succ and B-Function.

const succ = n => f => x => B(f) (n(f)) (x)  

Now that we have an actual composition function, we can define successor without mentioning the final x value argument.

const succ = n => f => B(f)(n(f));

Be Br
  • 51
  • 5