coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Pierre Casteran <pierre.casteran AT labri.fr>
- To: Daniel Schepler <dschepler AT gmail.com>
- Cc: coq-club AT inria.fr, Matthieu Sozeau <mattam AT mattam.org>
- Subject: Re: [Coq-Club] Class Instances on the same type
- Date: Mon, 11 Apr 2011 20:34:57 +0200
Quoting Daniel Schepler
<dschepler AT gmail.com>:
For local overriding of the default: for a one-shot thing, I believe you could
use "fun z:Z => dot z (dot z z (Monoid:=Z_mult)) (Monoid:=Z_mult)".
And in a section, you might be able to do (untested):
Section use_mult_monoid.
Existing Instance Z_mult.
Let cube (z:Z) := dot z (dot z z).
...
Hi Daniel and Matthieu,
Thank you for your answers.
I tried the solution with "Existing Instance", but
that directive didn't modify the behaviour of dot.
I wanted to avoid using decorations like (Monoid := ...)
because I had too many occurrences of dot to consider.
I tried succesfully an ugly solution :
Section foo.
Notation dot := (dot (Monoid:= Z_add)).
Definition triple (z:Z) := dot z (dot z z).
End foo.
But I think that a local modification of the cost
would be very much better solution.
The first
End use_mult_monoid.
--
Daniel Schepler
- [Coq-Club] Class Instances on the same type, Pierre Casteran
- Re: [Coq-Club] Class Instances on the same type,
Matthieu Sozeau
- Re: [Coq-Club] Class Instances on the same type,
Daniel Schepler
- Re: [Coq-Club] Class Instances on the same type, Pierre Casteran
- Re: [Coq-Club] Class Instances on the same type,
Daniel Schepler
- Re: [Coq-Club] Class Instances on the same type,
Matthieu Sozeau
Archive powered by MhonArc 2.6.16.