The Wikipedia article on the Y combinator provides the following JavaScript implementation of the Y combinator:
function Y(f) {
return (
(function (x) {
return f(function (v) { return x(x)(v); }); })
(function (x) {
return f(function (v) { return x(x)(v); }); })
);
}
The existence of a Y combinator in JavaScript should imply that every JavaScript function has a fixed point (since for every function g
, Y(g)
and g(Y(g))
should be equal).
However, it isn't hard to come up with functions without fixed points that violate Y(g) = g(Y(g))
(see here). Even certain functionals do not have fixed points (see here).
How does the proof that every function has a fixed point reconcile with the given counter-examples? Is JavaScript not an untyped lambda calculus in which the proof that Y(g) = g(Y(g))
applies?