I am stuck trying to prove something in Coq that involves the use of a type class.
The specific type class is almost identical to this Functor type class: https://gist.github.com/aztek/2911378
My instance looks like this:
Instance ListFunctor : Functor list := { fmap := map }.
(* Proof stuff here *)
Defined.
map
is the map over lists from the standard library.
The "proof" I am doing is basically just a unit test:
Example list_map_test : fmap (fun x => x + 1) (1::2::3::nil) = (2::3::4::nil).
My goal looks like this and I am stuck:
(let (fmap0, _, _) := ListFunctor in fmap0) nat nat
(fun x : nat => x + 1) (1 :: 2 :: 3 :: nil) = 2 :: 3 :: 4 :: nil
Coq destructured the instance to get fmap0
and then applied the resulting anonymous function with the args nat nat (fun x : nat => x + 1) (1 :: 2 :: 3 :: nil)
.
As the next step in my proof, I would like to unfold fmap0
or the anonymous function.
How can I do this? I cannot do unfold fmap0
.
My expectation was that fmap0
is the standard lib map
because that is what I gave to the instance.
I was able to destruct the instance myself, but this shows the abstract version of fmap0
and not the implementation that was given when instantiating the type class.
What am I doing wrong?