High-order pattern matching is an undecidable problem. That means there is no algorithm that, given an equation a => b
, where a
and b
are open terms on the simply typed lambda calculus, finds a substitution S
such that aS => bS
, where =>
stands for "has the same Bn normal form". Yet, humans can solve that problem efficiently. For example, given the following problem:
a = (λt . t
(F (λ f x . (f (f (f x)))))
(F (λ f x . (f (f x)))))
b = (λ t . t
(λ f x . (f (f (f (f (f (f x)))))))
(λ f x . (f (f (f (f x))))))
Any human with sufficient knowledge on the lambda calculus will be able to notice F
is the "double" function for church numbers, quickly coming with the solution that
F = (λ a b c . (a b (a b c)))
My question is: if that problem is undecidable, how can humans quickly and effortlessly solve it?