nightclub
nightclub

Reputation: 721

How to make a substitution in Lambda Calculus?

I would like to know how to make the following lambda substitution:

Let:

M = λxy.x (λx.x)(λy.x y)

Calculate the substitution:

M[x := y xλz.z]

Do you know some way to make such substitution in GHC, Matlab, Wolfram-Mathematica, or any other tool so I can check it?

Upvotes: 0

Views: 247

Answers (1)

Bill
Bill

Reputation: 3977

A few seconds with Google turns up

Mathematica lambda calculus

that there is a Wolfram Demonstrations package that does some lambda calculus. I don't know whether you might be able to use that to evaluate your expression or not. If you can't directly use that then rarely it is possible to look at the source for the demo and try to extract the line or two of code for your own use, but often the demos seem to be so complicated because of their use of graphical presentation that it is very difficult to make any use of the code.

Demo lambda

If that doesn't work then that same Google search also turns up that "Mastering Mathematica" by Gray has an example lambda calculus interpreter starting on page 387. That might show you just enough pages that you can grab that code for your problem. Or a used copy of the book might only be a dollar on the net from a used book dealer.

Upvotes: 1

Related Questions