haskellclojurelambdafunctional-programminglisp

How to compare two functions for extensional equivalence, as in (λx.2*x) == (λx.x+x)?


Is there a way to compare two functions for equality? For example, (λx.2*x) == (λx.x+x) should return true, because those are obviously equivalent.


Solution

  • It's pretty well-known that function equality is undecidable in general, so you'll have to pick a subset of the problem that you're interested in. You might consider some of these partial solutions: