[Edit]
The general question seems incredibly hard to solve. Here is a significantly restricted version of this question.
How do I dete
This is impossible according to Rice's theorem:
In computability theory, Rice's theorem states that, for any non-trivial property of partial functions, there is no general and effective method to decide whether an algorithm computes a partial function with that property.
If you restrict the domain of the functions to be finite, then you can trivially verify if ∀x: f(x) = g(x) using brute force, but this is not possible with an infinite domain.