1

Basically, I want to prove the following lemma, but I'm having trouble since I can't seem to directly rewrite inside of the lambdas.

However I feel like this should be possible, because if I were "inside" the lambda, I could easily prove it for any given x.

Lemma lemma :
  forall {A B : Type} (f : A -> B) (g : A -> B), 
    (forall (x : A), f x = g x) -> (fun x => f x) = (fun x => g x).
Reed Oei
  • 1,427
  • 2
  • 13
  • 19

1 Answers1

4

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.

SCappella
  • 9,534
  • 1
  • 26
  • 35
  • 1
    A minor clarification on syntactic comparison of functions: when Coq compares functions it takes into account computational rules, e.g. these two functions are equal: `Check eq_refl : (fun n => n) = (fun m => (fun n => 0 + n) m).`. – Anton Trunov Apr 12 '19 at 04:53