Given a specification of a function, e.g., specification_of_sum
, how do I prove in Coq that only one such function exists?
I am studying mathematics, and I could prove this in hand, but my skills in Coq are limited (proving using rewrite
and apply
).
I found the code snippet below, which I've been struggling with for some time now.
I try to unfold the specification in the proof, but using my old friend rewrite
doesn't seem to let me go further.
Can someone explain how to approach this problem using simple syntax?
Definition specification_of_sum (sum : (nat -> nat) -> nat -> nat) :=
forall f : nat -> nat,
sum f 0 = f 0
/\
forall n' : nat,
sum f (S n') = sum f n' + f (S n').
(* ********** *)
Theorem there_is_only_one_sum :
forall sum1 sum2 : (nat -> nat) -> nat -> nat,
specification_of_sum sum1 ->
specification_of_sum sum2 ->
forall (f : nat -> nat)
(n : nat),
sum1 f n = sum2 f n.
Proof.
Abort.