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: "jonikelee AT gmail.com" <jonikelee AT gmail.com>
  • To: Joshua Gancher <jrg358 AT cornell.edu>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Need help making a modular reflection reifier
  • Date: Thu, 22 Oct 2020 19:10:41 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt1-f180.google.com
  • Ironport-phdr: 9a23:Y06wHhRMTLduxqRUR4fOwbqNg9psv+yvbD5Q0YIujvd0So/mwa6zZRKN2/xhgRfzUJnB7Loc0qyK6v+mBjxLvMbJmUtBWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYdFRrlKAV6OPn+FJLMgMSrzeCy/IDYbxlViDanbr5+MRe7oR/Tu8QVjodvKqU8wQbVr3VVfOhb2XlmLk+JkRbm4cew8p9j8yBOtP8k6sVNT6b0cbkmQLJBFDgpPHw768PttRnYUAuA/WAcXXkMkhpJGAfK8hf3VYrsvyTgt+p93C6aPdDqTb0xRD+v4btnRAPuhSwaMTMy7WPZhdFqjK9DrhyvpwJxzZPXbo6XOvpweazScs8VS2daQsZRTjZMDp+mYocTDecMO/tToYnnp1sJqBuzHQegBOHoyj9Oh3/23rM10+A/Hg7YxwEgENcOv27VrNXxLqsdTee1zKzGwT7eaP5W2zD96I7JchAiv/6MWax/ftTKxEkgEgPKlFSQqYj/MzyJ0eQNtnGW4ux9Xu2gl2ApsRt+oiSzxsgykInJgJoYx0za+Sh7z4s4O9+1RU91b9CkDJZdtyWXOpV3T848XmxluDo2xqAHtJKlYiUH1YoqyhHDZ/GZfYaF/hHuWeKRLDp+mXlre6q/ig6s/US8zuDwTMq53VZQoiZYk9TAqmoB2wHQ58SbUvdx4Eas1SqS2w3W9+1JJVw7mK/UJpMg3rI8ip8evVndEiL2nUj7gqybeVgn9+Wt7+nnbLvmppGZOo96lA7yLLoil8mhDek8MwUDX26W8vmm2rL55032WrBKg+U2kqbHtJDaItwWpqujDA9U1oYv8g+/Dyu73NgBk3kLMVFIdA6dg4jmPFHOJ//4DfOhjFi2jDhrwPXGMqXgApXLMHfDjK/scahh50NY0gY+ztBS64hJBrwAPP7/QFL9ud/EAhMhNgy72efnCNFz1oMEXmKPB7eUMKHVsV+O5+IvIPeDZIsLtznjMPUl6PvugmU4mV8ZZ6WmwZwXaHWgEvR8P0qZeWbsgssGEWoSogU+S/XqhESeXj5Xena9RLkx5io7CYKjFYfMXJqhgL2H3CehH51ZfHpKCl6WESSgS4LRefAXaD+bauBolDcEWKLpH4072krz5CfxzKBhI+7QvCAUqMSw+sJy4riZlxY09D95C8mQ+26IRmBw2GgPQnV+iKJ4p01+x1OO3IB3hvVZEZpY4PYfAVRyDoLV0+EvU4O6YQnGZNrcEA/3EOXjOik4S5cK+/FLZk98H9u4iRWahnilBrYUk/qAA5lmq/uBjUi0HN50zjP97Idkj1QiRZERZ2ivh6o67hSKQoCQwx3fmKGteqARmiXK8TXblDbcjARjSAd1FJ79czUHfEKP9Ib240rDS/mlDrF1agY=

Thanks - "repeat fold op" works, but "Parameter Inline" does not.
Furthermore "repeat fold op" only works if op is not defined using
"Parameter Inline".


On Thu, 22 Oct 2020 16:01:42 -0400
Joshua Gancher <jrg358 AT cornell.edu> wrote:

> For this simple example, you can also fold the op:
>
> Ltac reify :=
> repeat fold op; match goal with
> | [ |- op _ _ ] => ..
> end.
>
> I am not sure if it is better to fold anop into op or unfold op into
> anop, however.
>
> On Thu, Oct 22, 2020 at 3:57 PM Gaëtan Gilbert <
> gaetan.gilbert AT skyskimmer.net> wrote:
>
> > 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