
Imagining version control for APIs - mwsherman
http://clipperhouse.com/2015/12/20/imagining-version-control-for-apis/
======
gliese1337

        Is there a form of static analysis that transforms source code into a normalized representation, such that two semantically identical programs with different source can be proved identical?
    

No, there isn't. Not in the general case. Solving program equivalence would
also provide a solution to the Halting problem.

One way to prove this is as follows:

Given an arbitrary function, _f_ , we choose a number _x_ and define a
function _f '_, which on input _n_ returns 1 if _n = x_ , and otherwise calls
_f(n)_.

We now statically know that _f '_ halts on at least one input. If functional
equivalence were decidable, then deciding whether _f_ is identical to _f '_
decides whether _f_ (which, recall, is an arbitrary function) halts on input
_x_. That would solve the Halting problem. Thus, functional equivalence is
undecidable.

You can design normalized forms which will tell you if _some_ classes of
programs are functionally equivalent or not (and it's a darn good thing, too,
or it would be impossible to do compiler optimizations), but any realizable
algorithm for such must always have edge cases where it either gets the answer
wrong, or has to output "I don't know".

