typeclass - Coq: unfolding class instances -


how unfold class instances in coq? seems possible when instance doesn't include proof, or something. consider this:

class c1 (t:type) := {v1:t}. class c2 (t:type) := {v2:t;c2:v2=v2}.  instance c1_nat: c1 nat:= {v1:=4}.  instance c2_nat: c2 nat:= {v2:=4}. trivial. qed.  theorem thm1 : v1=4. unfold v1. unfold c1_nat. trivial. qed.  theorem thm2 : v2=4. unfold v2. unfold c2_nat. trivial. qed. 

thm1 proved, can't prove thm2; complains @ unfold c2_nat step error: cannot coerce c2_nat evaluable reference..

what's going on? how c2_nat's definition of v2?

you ended definition of c2_nat qed. definitions ending qed opaque , cannot unfolded. write following instead

instance c2_nat: c2 nat:= {v2:=4}.   trivial. defined. 

and proof finishes without problems.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -