The statement you're trying to prove is (essentially) functional extentionality, which is well-known to not be provable in Coq without extra axioms. Basically, the idea is that f
and g
can be intentionally very different (their definitions can look different), but still take on the same values. Equality of functions (fun x => f x) = (fun x => g x)
would (without any additional axioms) imply that the two functions are syntactically the same.
For example, take f(n) = 0
and g(n) = 1 if x^(3 + n) + y^(3 + n) = z^(3 + n) has a non-trivial solution in integers, otherwise 0
(both functions from natural numbers to natural numbers). Then f
and g
are intentionally different - one doesn't syntactically reduce to the other. However, thanks to Andrew Wiles, we know that f
and g
are extentionally the same since g(n) = 0
for all n
.
You can freely add your lemma (or various strengthenings) as an axiom to Coq without worrying about inconsistency.