Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Need help making a modular reflection reifier

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Need help making a modular reflection reifier


Chronological Thread 
  • From: Gaëtan Gilbert <gaetan.gilbert AT skyskimmer.net>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Need help making a modular reflection reifier
  • Date: Thu, 22 Oct 2020 21:57:31 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gaetan.gilbert AT skyskimmer.net; spf=Pass smtp.mailfrom=gaetan.gilbert AT skyskimmer.net; spf=None smtp.helo=postmaster AT relay3-d.mail.gandi.net
  • Ironport-phdr: 9a23:013GoB3giRAGLBQMsmDT+DRfVm0co7zxezQtwd8ZseIRI/ad9pjvdHbS+e9qxAeQG9mCtLQb26GL4+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVhjexe7F/IRa5oQjRtcQdnJdvJLs2xhbVuHVDZv5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnMURGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LptRRT1iikIKiQ5/XnKhMJugqJVoBGvqRJxzIHbYo6aKPVwc7jBfd4ZX2dNQtpdWiJDD466coABD/ABPeFdr4TlplUBtwe5BRW2C+Pp0jBGh3723akh3Os/CwHGwBErEtUBsHvOstr1KL0dUeavwKnHzDXDa+hZ1inn6IjUaR0huvKMXLJrccrSyEkvEgbFgUuKqYD/OTOayPgNvnGd4uF9Wu2hl3QppBttojiz2MgskI/Ji5oVxF3A6Ch13ps4K9K7RUN4fNKpEYdcuiWVOoZqTc4vR2JltTg1xLAFp5O1cikHxYkoyhPdZPKKd5WE7wzgWeieJzpzmXFreKqnihqs7EStyPfwW8uo3FpQsyZIkdfBumoQ2xHX6sWLUuVx8lqv1DqVygze6v9ILVopmafaNpIt2LE9moYVvE/eBCH5gl/2g7WTdkg8+uin9eDnYrL+q5+GKYB0jhvxM6Qgl8CmHOs0KA0OUHKa+eS4zrHj8lf2QLNXgf03iKXZto7VJdgDqq64BQ9azJoj5g6hAzu70tkUh3sKIE5fdB6ajIXkNUvCLO38APq/m1islS1kx/HCPr3vGJXNKX3Dna/ufbln9UFc1BA8zdZF65JbC7EBJOn8VVHrtNzEFRI5KA+0wub8CNV+14MeXGePDbGDMK/It1+H+P4vL/GWZIAJoDb9N+Ql5/n2gHAlnl8dZLCl0ocTaHClBftrOF6ZYHrpgtcZC2gGpAs+TOrwiF2DSzFffXiyX7hvrg08XYmhFMLIQp2nqL2HxiayWJNMNU5cDVXZPn5ra4yCbNgNbCifONMpxjMNWKSoTcku1BWkuRXm46FkP/HX+ygduIil0tVpsb6A3Sou/CB5WpzOm1qGSHt5yztRGm0GmZtnqEk48W+tlKh1h/sCSI5J6vdAQ1x/OdjZxu1+Td/7XA7AONGEVAT+G4n0MXQKVts0huQ2TQNlAdz70ELY3DuxAL4QkrGRQpo57vCEhimjF4NG03/DkZIZoRwjS8pLO3ehg/chpRPQFpXKkkCcmrzsc6kAjnfA

try Parameter Inline op ... in the module type.
If that doesn't work then maybe unfolding in the tactic works:

Ltac reifier := ...
let opv := eval cbv [op] in op in
match ...
| opv ?X ?y => ...

Gaëtan Gilbert

On 22/10/2020 21:46, jonikelee AT gmail.com wrote:
I'm trying to make a particular reflection procedure I have into an
abstract module, and have hit a problem with its reifier. The
problem is that the reifier, being a tactic, doesn't recognize that a
abstract (module parameter) operation is equivalent to an instatiation
of that operation. The reifier is of course a tactic defined using a
match on the abstract operation, and since the instantiation is not
syntactically the same, it can't reify terms that use the instantiation
operation instead of the abstract one.

I mean something like:

Module Type XT.
...
Parameter op : A -> A -> Prop.
...
End XT.
Module R(Import X: XT).
....
Ltac reifier := ...
match ...
| op ?X ?y => ...
End R.
Module X <: XT.
...
Definition op := anop.
...
End X.
Module Import MyR := R X.
...
(* attempt to call reifier on some code containing: *)
anop a b

The reifier tactic will not see that "anop" is convertible with "op",
and so will not reify "anop a b". It will reify "op a b", but clients
of module R will be using "anop" instead of "op".

Is there a way around this? I am contemplating defining "op" to be
overloaded using canonical structures. But is there any way to make it
work with a purely module-style abstraction? I guess I'm looking for a
way to make "op" be syntactically the same as "anop", as if defined by
Notation instead of Definition.

Perhaps another way is to force the reifier to notice convertibility by
doing something like this:

Ltac reifier := ...
match ...
| ?OP ?X ?Y => unify OP op; ...

But that seems like it could slow down the reifier dramatically.




Archive powered by MHonArc 2.6.19+.

Top of Page