I'm using the Coq MSet library in my development and I'm having some trouble to use the generalised rewriting involving MSet values. Below I have a simplified version of my problem:
First, we need to define the modules for MSet.
Module NSet := Make Nat_as_OT.
Module NSetDec := MSetDecide.WDecide NSet.
And I have a function with the following type:
Parameter calc : NSet.t -> string -> bool.
What I want is to rewrite set equalities present in calls to function calc
.
For this, I tried to define a Proper
instance like this.
Instance calc_proper
: Proper (NSet.Equal ==> @eq string ==> @eq bool) calc.
Proof.
intros S S' H s s' H1.
rewrite H1.
rewrite H. (** error here! *)
My doubt is how to finish such an instance. When I try to execute the last rewrite
, Coq returns the following error message:
Tactic failure: setoid rewrite failed: Unable to satisfy the following constraints:
UNDEFINED EVARS:
?X33==[S S' H s s' H1 |- relation bool] (internal placeholder) {?r}
?X34==[S S' H s s' H1 |- relation string] (internal placeholder) {?r0}
?X35==[S S' H s s' H1 (do_subrelation:=do_subrelation)
|- Proper (NSet.Equal ==> ?r0 ==> ?r) calc] (internal placeholder) {?p}
?X36==[S S' H s s' H1 |- ProperProxy ?r0 s'] (internal placeholder) {?p0}
?X38==[S S' H s s' H1 |- relation bool] (internal placeholder) {?r1}
?X39==[S S' H s s' H1 (do_subrelation:=do_subrelation)
|- Proper (?r ==> ?r1 ==> flip impl) eq] (internal placeholder) {?p1}
?X40==[S S' H s s' H1 |- ProperProxy ?r1 (calc S' s')] (internal placeholder) {?p2}
TYPECLASSES:?X33 ?X34 ?X35 ?X36 ?X38 ?X39 ?X40
Which seems that my code is missing some instance(s). The minimal example that exhibit the problem is available at the following gist.