The problem with lambda expressions is that they cannot be interpreted as functions in a mathematical sense, i.e. mappings from one set to another.
The reason is that the power of a set of functions from a set A itself is always greater than the power of A , so not all functions from A to A can be an element of A That is, there exists a function f: A -> A for which the expression f(f) does not make sense.
This is like a “set of all sets that do not contain themselves”, which logically does not make sense.
JavaScript is not a lambda calculus model.
The problem with your example is that
(lambda xg(xx)) (lambda xg(xx))
should be equivalent
g((lambda xg(xx)) (lambda xg(xx)))
but this is not in your JavaScript program, where g is the indicator function 0 .
xx always undefined . Therefore, the first line evaluates to g (undefined) = 0 . The second line evaluates to g (g (undefined)) = g (0) = 1 . That means your lambda calculus JavaScript model is not actually a model.
Since for every nonempty set D there exists a function from D to D without a fixed point, obviously, there can be no model of lambda calculus. I think it should even be possible to prove that there cannot be an implementation of Y-combinator in any Turing language.
Johnb
source share