Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] rewriting without instantiating

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] rewriting without instantiating


Chronological Thread 
  • From: Robbert Krebbers <mailinglists AT robbertkrebbers.nl>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] rewriting without instantiating
  • Date: Mon, 3 Dec 2018 10:44:55 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mailinglists AT robbertkrebbers.nl; spf=None smtp.mailfrom=mailinglists AT robbertkrebbers.nl; spf=None smtp.helo=postmaster AT smtp1.science.ru.nl
  • Ironport-phdr: 9a23:z8EJ4xwAnhaubobXCy+O+j09IxM/srCxBDY+r6Qd1OMWIJqq85mqBkHD//Il1AaPAd2Lraocw8Pt8InYEVQa5piAtH1QOLdtbDQizfssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1JuPoEYLOksi7ze+/94HQbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeuBWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbOSxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDwULs6Wymt771zRRH1likHOT43/mLZhMN+g61Uog6uqRNkzo7IY4yYLuZycr/TcN4YQ2dKQ8ZfVzZGAoO5d4YBE+0BMv1DoIbjvVsOsQa1Cwy2BOzx0TBHnWH53bch0+88FgzG2RYvH9MKsHTVqtX1O6MSUeGuzKnU1jXOdOlW2TDm54fTbB8hu+2MXbFqccXP0kYgDB3Kjk+LqYD/OTOV0v0Avm6G5ORjTeKik3Mrpg9srjS128shiIbEipgIxl3F7yl13Yk4KNOgREJmbtOpEIFcuiWVOodsX88uXWNltDwnxrAFtpO2ejUBxo49yB7FcfOHdpCF4hL9W+aVJjd1nGlleLejhxaq7ESs0Pb8WdW10FlUqCpKjsfDumoX1xzO8MSHTP998l+g2TaJyQ/T9vlJLV06mKbGMZIt37w9m5UJvUjeHyL6glj6gaCYe0k8/+in8eXnYrHopp+GMI90jxnzMqE0lcy+BeQ4Mw4OX2ef+eS9z73j4Vb5Ta5Qjv0xiabWq47VJd4Hpq66GQ9azJ0s5A2hADe8y9QUh38HLFZddBKdk4fpI03OIOz/Dfqnn1usly5ry+naMb3lH5XCNWPOkKzhfLZ4805T0hA/zdFZ55JOC7EOOuj/WkHrtI+QMhhsOAuthu3jFd9V14UEWGvJDLXKHrnVtAqy4eglLvOQLKwPtTz3JuI+r6rrhH49mFkSeaiywYA/cneyFPl8P0aDbHDmj80aV2EO6FltBNf2gUGPBGYAL025WLgxs2liWdCWSLzbT4Xou4SvmSKyH5lYfGdDUAjeC3DifYieR/QWZSiYL9V61DoAB+D4F90RkCq2vQq/8IJJa/LO83dA54jk3tJ4/fHQjxw4/zFuFIKb1zPVFjwmriYzXzYzmZtHjwl9x1OEi/EqmPlEDYUV/PhIXwExONjG0qp8D4KqVw==

For this concrete example, it appears that the ssreflect rewrite tactic is doing what you want (i.e. it does _not_ instantiate the evar with []). I have no idea if this is coincidental, or an explicit feature of the ssreflect rewrite tactic.

Maybe some of the ssr developers around here could tell more.

On 12/3/18 10:38 AM, Jeremy Dawson wrote:
Hi Dominique,

Thanks for your answer, I just want it to rewrite ?Φ1 ++ [] ++ ?Φ2 to
?Φ1 ++ ?Φ2.

There would be only one possible spot to rewrite if it did not
instantiate ?Φ1 to [].

So how do I stop it instantiating variables in the goal? (Obviously I
want it to instantiate variables in the rule being used for rewriting,
ie the variable l in the app_nil_l rule). Experimenting with numbering
locations where it might rewrite would be very inconvenient, since I
will have dozens of goals I would be using my tactic on.

Cheers,

Jeremy



On 12/03/2018 07:04 PM, Dominique Larchey-Wendling wrote:


----- Mail original -----
De: "Jeremy Dawson"
<Jeremy.Dawson AT anu.edu.au>
À: "coq-club"
<coq-club AT inria.fr>
Envoyé: Lundi 3 Décembre 2018 07:16:55
Objet: [Coq-Club] rewriting without instantiating

Hi coq-club,

when I have a subterm like ?Φ1 ++ [] ++ ?Φ2 in a goal,
and I want to rewrite using app_nil_l (ie, [] ++ l = l)
how to I tell coq to rewrite without instantiating?

When I just say rewrite app_nil_l it instantiates ?Φ1 to []
and then removes "[] ++ ", which is not what I want at all.

Hi Jeremy,

It is not clear to me want you want to obtain here...
l++[]++m is the term l++([]++m) because contrary to + (nat),
++ (app) is right associative in Coq (to be compatible
with cons which can only be associated to the right).

It you want to be precise about which instance to rewrite,
you can write something like

rewrite app_nil_l at 1 3 ...

but if there are several ways to unify the rewrite rule
(ie several values of l in this case), the numbers above only
match the instances that correspond to the first unification
match Coq finds: unification comes before instance finding.

You can partially specify a rewrite rule with something like

rewrite app_nil_l with (l := _::_::nil)

for instance which lets Coq find (hopefully) the instance you
want but still avoids typing all the term, or the variables
it contains (which is bad for stability if you do not control
the names introduced by "intros").

In the case of

l++[]++m

there is only one thing you can do with
rewrite app_nil_l here. Btw, []++m reduces to
m and thus "simpl" would also change the goal into l++m.

Best,

Dominique




Archive powered by MHonArc 2.6.18.

Top of Page