Discussion:
[Coq-Club] Anybody uses the Quote plugin?
Maxime Dénès
2018-07-20 07:19:49 UTC
Permalink
Dear Coq-clubbers,

I'm trying to clean up the set of plugins shipped with Coq, so that we
can make the maintenance done by the development team more focused and
effective.

I was wondering if anybody was using the Quote plugin in real-world
developments. See https://github.com/coq/coq/pull/7894 for more context.

Thank you in advance for your feedback!

Maxime.
Tej Chajed
2018-07-20 12:41:28 UTC
Permalink
I definitely support getting rid of Quote. I used it once and then ran into
an issue: my unquote function took a type parameter, which is unsupported,
even if you try specializing it. I talked to Jason Gross, copied some code
from their reification-by-parametricity paper
<https://people.csail.mit.edu/jgross/personal-website/papers/2018-reification-by-parametricity-itp-camera-ready.pdf>,
and got it working fairly easily
<https://github.com/tchajed/ac-reasoning/commit/ef1170624436598385ef9d751cda7bd5b3704a4e#diff-abab72dc72587b469140949457b1ca89R92>
in pure Ltac.

It would be great to have some examples from that paper coped into the Coq
test suite and try to give it visibility, instead of maintaining Quote.
It's a more powerful technique and I believe with just a little boilerplate
can replace uses of Quote (if anybody actually weighs in and is using it).
Post by Maxime Dénès
Dear Coq-clubbers,
I'm trying to clean up the set of plugins shipped with Coq, so that we
can make the maintenance done by the development team more focused and
effective.
I was wondering if anybody was using the Quote plugin in real-world
developments. See https://github.com/coq/coq/pull/7894 for more context.
Thank you in advance for your feedback!
Maxime.
John Wiegley
2018-07-20 18:45:32 UTC
Permalink
I would also support dropping Quote; each time I've been able to use it, I
ended up just copying Ltac macros from existing templates so I would have the
configurability needed for future changes.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
Hugo Herbelin
2018-07-22 09:35:53 UTC
Permalink
Hi,

Somehow, a question is also whether it would be worth that someone
eventually provides a generic-enough quote function in Coq, for use at
both the vernac level or the plugin level.

My understanding of the Gross-Erbsen-Chlipala ITP 2018
reification-by-parametricity paper is that this quote function almost
already exists, it is "pattern". Then, what about going in the
direction of providing a variant of "pattern" which encapsulates the
boilerplate of the technique and which, maybe, also abstracts over the
foreign subterms?

Idem at the plugin level. Already e.g. ring, micromega, btauto have
their own reification mechanisms (sometimes even in Ltac) and this
seems suboptimal.

Best,

Hugo
Post by John Wiegley
I would also support dropping Quote; each time I've been able to use it, I
ended up just copying Ltac macros from existing templates so I would have the
configurability needed for future changes.
I definitely support getting rid of Quote. I used it once and then ran into an
issue: my unquote function took a type parameter, which is unsupported, even if
you try specializing it. I talked to Jason Gross, copied some code from their 
reification-by-parametricity paper, and got it working fairly easily in pure
Ltac.
It would be great to have some examples from that paper coped into the Coq test
suite and try to give it visibility, instead of maintaining Quote. It's a more
powerful technique and I believe with just a little boilerplate can replace
uses of Quote (if anybody actually weighs in and is using it).
Dear Coq-clubbers,
I'm trying to clean up the set of plugins shipped with Coq, so that we
can make the maintenance done by the development team more focused and
effective.
I was wondering if anybody was using the Quote plugin in real-world
developments. See https://github.com/coq/coq/pull/7894 for more context.
Thank you in advance for your feedback!
Maxime.
Matthieu Sozeau
2018-07-23 17:46:22 UTC
Permalink
Hi,

A somewhat generic solution is provided by RTac (Malecha and Bengston) and
is quite elaborate. I think Template-Coq should allow you to program your
quotation mechanism as you wish (baring potential performance problems). At
least using this you’d have direct access to the syntax of your term, no
typechecking involved. According to J. Gross et al ITP paper performance is
close to the “pattern” option, as far as I could tell.

My 2 cents,
— Matthieu
Post by Hugo Herbelin
Hi,
Somehow, a question is also whether it would be worth that someone
eventually provides a generic-enough quote function in Coq, for use at
both the vernac level or the plugin level.
My understanding of the Gross-Erbsen-Chlipala ITP 2018
reification-by-parametricity paper is that this quote function almost
already exists, it is "pattern". Then, what about going in the
direction of providing a variant of "pattern" which encapsulates the
boilerplate of the technique and which, maybe, also abstracts over the
foreign subterms?
Idem at the plugin level. Already e.g. ring, micromega, btauto have
their own reification mechanisms (sometimes even in Ltac) and this
seems suboptimal.
Best,
Hugo
Post by John Wiegley
I would also support dropping Quote; each time I've been able to use it,
I
Post by John Wiegley
ended up just copying Ltac macros from existing templates so I would
have the
Post by John Wiegley
configurability needed for future changes.
I definitely support getting rid of Quote. I used it once and then ran
into an
Post by John Wiegley
issue: my unquote function took a type parameter, which is unsupported,
even if
Post by John Wiegley
you try specializing it. I talked to Jason Gross, copied some code from
their
Post by John Wiegley
reification-by-parametricity paper, and got it working fairly easily in
pure
Post by John Wiegley
Ltac.
It would be great to have some examples from that paper coped into the
Coq test
Post by John Wiegley
suite and try to give it visibility, instead of maintaining Quote. It's
a more
Post by John Wiegley
powerful technique and I believe with just a little boilerplate can
replace
Post by John Wiegley
uses of Quote (if anybody actually weighs in and is using it).
Dear Coq-clubbers,
I'm trying to clean up the set of plugins shipped with Coq, so that
we
Post by John Wiegley
can make the maintenance done by the development team more focused
and
Post by John Wiegley
effective.
I was wondering if anybody was using the Quote plugin in real-world
developments. See https://github.com/coq/coq/pull/7894 for more
context.
Post by John Wiegley
Thank you in advance for your feedback!
Maxime.
Jason Gross
2018-07-27 15:13:08 UTC
Permalink
Post by Hugo Herbelin
this quote function almost
already exists, it is "pattern". Then, what about going in the
direction of providing a variant of "pattern" which encapsulates the
boilerplate of the technique and which, maybe, also abstracts over the
foreign subterms?
I'd be quite interested in this. In particular, there are two useful
things I'd like to see here, which have different degrees of difficulty:
(1) The `pattern` tactic currently abstracts over terms, and then applies
the result to the terms that are abstracted over. I'd like a version that
does not create the application node. If `pattern` is implemented by
sequencing these two, this should be as simple as exposing the first step
to the tactic layer
(2) The only thing `quote` supports that reification by parametricity
doesn't is, as you say, foreign subterms. I think it would be useful to
have a version of pattern that does this.
Post by Hugo Herbelin
I think Template-Coq should allow you to program your quotation mechanism
as you wish (baring potential performance problems).

I actually don't see how this would work in Template-Coq. In particular,
I'm not aware of any Gallina denotation function for template-coq terms, so
it seems like there'd need to be a separate tactic phase where I denote the
map of foreign terms.
Post by Hugo Herbelin
performance is close to the “pattern” option, as far as I could tell.
This is true, though template-coq stack overflows on reifying enormous
terms in a way that pattern does not.
Post by Hugo Herbelin
Hi,
A somewhat generic solution is provided by RTac (Malecha and Bengston) and
is quite elaborate. I think Template-Coq should allow you to program your
quotation mechanism as you wish (baring potential performance problems). At
least using this you’d have direct access to the syntax of your term, no
typechecking involved. According to J. Gross et al ITP paper performance is
close to the “pattern” option, as far as I could tell.
My 2 cents,
— Matthieu
Post by Hugo Herbelin
Hi,
Somehow, a question is also whether it would be worth that someone
eventually provides a generic-enough quote function in Coq, for use at
both the vernac level or the plugin level.
My understanding of the Gross-Erbsen-Chlipala ITP 2018
reification-by-parametricity paper is that this quote function almost
already exists, it is "pattern". Then, what about going in the
direction of providing a variant of "pattern" which encapsulates the
boilerplate of the technique and which, maybe, also abstracts over the
foreign subterms?
Idem at the plugin level. Already e.g. ring, micromega, btauto have
their own reification mechanisms (sometimes even in Ltac) and this
seems suboptimal.
Best,
Hugo
Post by John Wiegley
I would also support dropping Quote; each time I've been able to use
it, I
Post by John Wiegley
ended up just copying Ltac macros from existing templates so I would
have the
Post by John Wiegley
configurability needed for future changes.
I definitely support getting rid of Quote. I used it once and then ran
into an
Post by John Wiegley
issue: my unquote function took a type parameter, which is unsupported,
even if
Post by John Wiegley
you try specializing it. I talked to Jason Gross, copied some code from
their
Post by John Wiegley
reification-by-parametricity paper, and got it working fairly easily in
pure
Post by John Wiegley
Ltac.
It would be great to have some examples from that paper coped into the
Coq test
Post by John Wiegley
suite and try to give it visibility, instead of maintaining Quote. It's
a more
Post by John Wiegley
powerful technique and I believe with just a little boilerplate can
replace
Post by John Wiegley
uses of Quote (if anybody actually weighs in and is using it).
Dear Coq-clubbers,
I'm trying to clean up the set of plugins shipped with Coq, so that
we
Post by John Wiegley
can make the maintenance done by the development team more focused
and
Post by John Wiegley
effective.
I was wondering if anybody was using the Quote plugin in real-world
developments. See https://github.com/coq/coq/pull/7894 for more
context.
Post by John Wiegley
Thank you in advance for your feedback!
Maxime.
Christian Doczkal
2018-07-31 12:43:37 UTC
Permalink
Hi,

I found one use of quote "in the wild": Adam Chlipala's CPDT.

Indeed, teaching is one reason why it might be good if Coq where to ship
with some easy to use reflection mechanism supporting, like quote does,
simple data types and foreign subterms.

So keeping quote and developing it to the point where the reflective
tactics shipped with Coq (can) make use of it, might be worthwhile. I
suppose that would require handling type parameters (denote : ∀ X,
varmap X -> tm -> X), or allowing quote to take a nonempty initial
varmap (to ease reifying two sides of an equation with a common varmap,
etc.

The, closely related, question that got me interested in this is: What
is currently the simplest way to do reification into ones own
inductively defined data type (with variables) in such a way that the
variable map containing the foreign subterms is injective not just with
respect to syntactic equality but with respect to conversion.

Best,
Christian
Post by Hugo Herbelin
Hi,
Somehow, a question is also whether it would be worth that someone
eventually provides a generic-enough quote function in Coq, for use at
both the vernac level or the plugin level.
My understanding of the Gross-Erbsen-Chlipala ITP 2018
reification-by-parametricity paper is that this quote function almost
already exists, it is "pattern". Then, what about going in the
direction of providing a variant of "pattern" which encapsulates the
boilerplate of the technique and which, maybe, also abstracts over the
foreign subterms?
Idem at the plugin level. Already e.g. ring, micromega, btauto have
their own reification mechanisms (sometimes even in Ltac) and this
seems suboptimal.
Best,
Hugo
Post by John Wiegley
I would also support dropping Quote; each time I've been able to use it, I
ended up just copying Ltac macros from existing templates so I would have the
configurability needed for future changes.
I definitely support getting rid of Quote. I used it once and then ran into an
issue: my unquote function took a type parameter, which is unsupported, even if
you try specializing it. I talked to Jason Gross, copied some code from their 
reification-by-parametricity paper, and got it working fairly easily in pure
Ltac.
It would be great to have some examples from that paper coped into the Coq test
suite and try to give it visibility, instead of maintaining Quote. It's a more
powerful technique and I believe with just a little boilerplate can replace
uses of Quote (if anybody actually weighs in and is using it).
Dear Coq-clubbers,
I'm trying to clean up the set of plugins shipped with Coq, so that we
can make the maintenance done by the development team more focused and
effective.
I was wondering if anybody was using the Quote plugin in real-world
developments. See https://github.com/coq/coq/pull/7894 for more context.
Thank you in advance for your feedback!
Maxime.
Assia Mahboubi
2018-08-30 10:12:09 UTC
Permalink
Hi,
Post by Christian Doczkal
(...)
Indeed, teaching is one reason why it might be good if Coq where to ship
with some easy to use reflection mechanism supporting, like quote does,
simple data types and foreign subterms.
When I am teaching reflection, I usually show (and ask in related exercises) a
small Ltac function performing the reification phase. I think it is helpful to
see the pattern matching at work, and possibly also the construction of the
varmap, as opposed to having a "black box" command like Quote. Plus on a simple
toy example, it is really not that difficult to implement.
Post by Christian Doczkal
So keeping quote and developing it to the point where the reflective
tactics shipped with Coq (can) make use of it, might be worthwhile.
When implementing the ring tactic a while ago, we briefly considered using it,
but eventually fall back to some specific OCaml code. I do not remember the details.

I wholeheartedly agree that the lack of code sharing among Coq reflexive tactics
is very unfortunate. Performance and customization are a delicate issue though.

On the other hand, I do not know what is the best candidate for the purpose of a
"generic and efficient refication toolkit". Maybe not the Quote plugin I would say.

If I understand correctly the survey by Jason and his co-authors, the
pattern-based technique they propose does not deal with variable maps. Thus it
cannot be used for reflective tactics à la ring.

And therefore the problem of constructing a variable map is out of the scope of
their benchamrk.

Some of the meta programming solution they benchmark can be used in this case
(canonical structures, type classes, etc.) and could in principle be used for
this purpose. But performance is an issue on large terms, in particular in the
variable map building phase.
Post by Christian Doczkal
(...)
The, closely related, question that got me interested in this is: What
is currently the simplest way to do reification into ones own
inductively defined data type (with variables) in such a way that the
variable map containing the foreign subterms is injective not just with
respect to syntactic equality but with respect to conversion.
I am also interested, and I do not know the answer.

For instance, this would help interfacing automation tactics with a
canonical-structure based hierarchy of structures. But again, building a
variable map up to conversion too naively can trigger massive performance
problems. A while ago, we ran into this nature of problems when trying to prove
identities on rational numbers represented as a pair of unary integers with a
proof. The solution involves using an opaque cast as a head symbol on constant,
and a specific tactic parameter to deal with the leaves of a given expression.

Best,

assia
Post by Christian Doczkal
Best,
Christian
Post by Hugo Herbelin
Hi,
Somehow, a question is also whether it would be worth that someone
eventually provides a generic-enough quote function in Coq, for use at
both the vernac level or the plugin level.
My understanding of the Gross-Erbsen-Chlipala ITP 2018
reification-by-parametricity paper is that this quote function almost
already exists, it is "pattern". Then, what about going in the
direction of providing a variant of "pattern" which encapsulates the
boilerplate of the technique and which, maybe, also abstracts over the
foreign subterms?
Idem at the plugin level. Already e.g. ring, micromega, btauto have
their own reification mechanisms (sometimes even in Ltac) and this
seems suboptimal.
Best,
Hugo
Post by John Wiegley
I would also support dropping Quote; each time I've been able to use it, I
ended up just copying Ltac macros from existing templates so I would have the
configurability needed for future changes.
I definitely support getting rid of Quote. I used it once and then ran into an
issue: my unquote function took a type parameter, which is unsupported, even if
you try specializing it. I talked to Jason Gross, copied some code from their 
reification-by-parametricity paper, and got it working fairly easily in pure
Ltac.
It would be great to have some examples from that paper coped into the Coq test
suite and try to give it visibility, instead of maintaining Quote. It's a more
powerful technique and I believe with just a little boilerplate can replace
uses of Quote (if anybody actually weighs in and is using it).
Dear Coq-clubbers,
I'm trying to clean up the set of plugins shipped with Coq, so that we
can make the maintenance done by the development team more focused and
effective.
I was wondering if anybody was using the Quote plugin in real-world
developments. See https://github.com/coq/coq/pull/7894 for more context.
Thank you in advance for your feedback!
Maxime.
Loading...