Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Is it possible to perform tactics in an existential's context from Ltac?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Is it possible to perform tactics in an existential's context from Ltac?


Chronological Thread 
  • From: Yannick Forster <yannick AT yforster.de>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Is it possible to perform tactics in an existential's context from Ltac?
  • Date: Thu, 28 Jun 2018 09:41:53 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=yannick AT yforster.de; spf=None smtp.mailfrom=yannick AT yforster.de; spf=None smtp.helo=postmaster AT vela.uberspace.de
  • Ironport-phdr: 9a23:s3W+ghM0nJJIxQeGgQMl6mtUPXoX/o7sNwtQ0KIMzox0LPX4rarrMEGX3/hxlliBBdydt6oazbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlJiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSkaKTA5/mHZhM9+gq1Vrx2upQBwzYHPbYGJNvdzZL/Rcc8USGdDWMtaSixPApm7b4sKF+cOP/xXr4/7p1sPsRS+BhSnCuPoyj9SnX/2wbM10/48GgzB3A0vBdQOsHLVrNrpN6cfSuC0zKfPzTXZdPNWxSny6JLSfh88v/6BRLR9etfSx0k3Dw7IilWdpZb4Mz6a2OkBqXWX4uh+We61lmIqrx99rz6yzck2kIbJnJgaylXc+CV53ok1Idq4RVZlYdG6FJtfrTuWN5ZtTcw8WWFooz46xacatpGlZiQF1Yooywbea/yBbYeI/gruWeKRLDtimX5od7yyiwyv/UWi1OHwTNS43VJUoiZdl9nDrHEN1xjd6sidTft9+1+s2DaV2ADV7OFEIFw7lanAJp8hzL4wkYATsV/fHiDogkX6lrKZeVs89uiy9+vneqnmpoObN4Jslg7+Nb0ultWjDuQ8LwgBRHOW+f+81b3m5U32Wq9GjvwwkqnDsZDVP94XpqCjA1wd7oF24BGmSjyizd4wnH8dLVsDdgjUoZLuPgT/Kfb+DPy8y3qriix3yuqOaqzoBJPMJXvrgbnmZ61h5lQaxAdlnoMX3I5dFrxUeKG7YUT2rtGNVkZoYTzx+P7uDZBG7q1bXGuOBqGDN6aL6g2Z6OU1OPWBfskZtWSlcqR317vVlXY83GQlU+yxx5JOMyKpEPN8OFmUezzgj4VZSDpYjk8FVOXvzWa6f3tTanK1BvNu+Dw/AcS7B4rZXZiki7HH0CrpRpA=

Hi all,

Ralf's example works using inline ltac:

Goal exists (n : nat), n = 2.
eexists.
instantiate (1 := ltac:(refine (S _))).

This produces:

S ?Goal0 = 2

Does this enable your idea again Ralf?

Best
Yannick

On 28/06/18 07:37, Ralf Jung wrote:
Hi John,

I was going to suggest something like

Goal exists (n : nat), n = 2.
eexists.
instantiate (1 := refine (S _)).

because "instantiate" can actually run tactics. However, the above does not
work, saying

Instance is not well-typed in the environment of ?n.

I am not sure how to get around that. It's certainly possible to refine an
evar
using new evars, just not this way I guess...

Kind regards,
Ralf

On 27.06.2018 21:58, John Grosen wrote:
I am currently dealing with a problem in which I have an existential
variable in the goal and want to apply a lemma to the goal, but Coq's
unifier is not powerful enough to automatically unify the relevant part
of the lemma with the evar. However, in this particular case, it is
programatically obvious how to unify them, so I would like to write some
Ltac to do so. Imagine this (greatly simplified) example:

Goal exists (n : nat), n = 2.
evar (n : nat).
exists n.
only [n]: refine (S _).

This works, but I usually don't have a name for the existential
variables I'm dealing with and the automation certainly doesn't know
about any. So what I'd like to do is this:

Goal exists (n : nat), n = 2.
eexists.
match goal with
| [ |- ?x = _ ] =>
only [x]: refine (S _)
end.

However, Coq complains with "No such goal." As far as I can tell, this
is because the argument in "only [_]" is a syntactic identifier.

Then, is there any way to select a goal with a non-syntactic identifier,
like I have in this situation?

Thanks,
John




Archive powered by MHonArc 2.6.18.

Top of Page