Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] how to combine tactics

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] how to combine tactics


Chronological Thread 
  • From: Li-yao Xia <lysxia AT gmail.com>
  • To: coq-club AT inria.fr, Jason -Zhong Sheng- Hu <fdhzs2010 AT hotmail.com>
  • Subject: Re: [Coq-Club] how to combine tactics
  • Date: Mon, 5 Aug 2019 12:14:27 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=lysxia AT gmail.com; spf=Pass smtp.mailfrom=lysxia AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk1-f181.google.com
  • Ironport-phdr: 9a23:geCSfxXmViNnanpZrirEzaWZPgzV8LGtZVwlr6E/grcLSJyIuqrYbBGBt8tkgFKBZ4jH8fUM07OQ7/m6HzVYvt3Q7zgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrswndrNQajZdgJ6o+zhbEoGZDdvhLy29vOV+dhQv36N2q/J5k/SRQuvYh+NBFXK7nYak2TqFWASo/PWwt68LlqRfMTQ2U5nsBSWoWiQZHAxLE7B7hQJj8tDbxu/dn1ymbOc32Sq00WSin4qx2RhLklDsLOjgk+27Ql8JwkblboAq/qBNj347aboaVNP9kcaPce9MRWG5NU8lVWiBEBI63cokBAPcbPetAsofzuVUOoxu9CweiCuzgxT1HiWP506Ahz+QsExvL0BA8E98AsHnZqsj+OqcIUeCyyanF1TPNb/JP1Tb98ofIdQ0qrvCNXb1qbMHczk0vFgPejlSfqIzqJSiY1usIs2eB7upgUfijhHIgqwF0uzWiwNonhIfOhoIQ0F/E9CN5zZ40Jd2+Uk57YMSrHIFetyGAL4d2TcIiQ31ouCYn0bIKo5+7fC8MxZ86xBDfc+SKf5aU7h/nTuqcIjd1iGh7dL6hmRq+61Wsx+7hWsWszlpHoTBJn9jRunwXyhDe6ceKRuFj8kqh3zuEyhrd5fteIU8ukKrWM54hzaA0lpoUqUnDGzX5mETyjKOPb0Uk+fWk5/3pYrn7pZKQKpV4ig75MqQplcy/Bfo3PhISUGic/OSwzLzj/UvnT7VWlvA6jLXVvZTAKckYpqO1GRFZ3pg95xqlEjur08kUkWECLF1feRKHi4bpO0vJIPD9Ffq/h1StkCxkxvDHJLLsGZrNLn3Zn7fgebZx8VJTyA02zdxH/ZJbFqkBIO7vWk/2rNHXEhg5MxWtz+n7DNV9y5gRVHmUAq6ZNaPSqUWH6vguI+mKfo8VuSzyJ+Ir5/703jcFngoWerDs1p8KYli5GO5nKgOXez6koN4aFmFC+zg+S+rlwGaCXDhcIj6SQupo6D07Gpn8Vd6bboCqnLmI3SP9FZpTMDNoEFeJRFPpMpSNXL88aSvadstwiSwFXJCuToYg0VelswqsmOkvFfbd5iBN7cGr79Ny/eCGyUBrpG5ESv+F2mTIdFla22YBRjs4xqd6+BUvxVKK0Kw+iPtdR4UKu6F5FzwiPJuZ9NRUTsjoU1uYLNiMQVeiBN6hBGNpF49j85o1e094Xu6aoFXD0i6tWeFHkrWKANkt8fuZ0SGhfoByzHHJ0KRnhF4jEJNC

The manual presents "... ; [ ... | ... ]" as a separate construct from "... ; ...", that's one way to keep the latter associative:

https://coq.inria.fr/refman/proof-engine/ltac.html#coq:tacn.dispatch

Li-yao

On 8/5/19 11:34 AM, Jason -Zhong Sheng- Hu wrote:
this is surprising. I've been using [...|...] and I experienced nothing like
this. if my memory did not fail me, I read somewhere that ; is associative.
what's your coq version?

Thanks,
Jason Hu
https://hustmphrrr.github.io/
________________________________
From:
coq-club-request AT inria.fr

<coq-club-request AT inria.fr>
on behalf of Jeremy Dawson
<Jeremy.Dawson AT anu.edu.au>
Sent: August 5, 2019 9:44 AM
To:
coq-club AT inria.fr

<coq-club AT inria.fr>
Subject: Re: [Coq-Club] how to combine tactics

Further to my previous messages I have experimented some more, and find that

induction H ; (eapply derI ; [ NLrule_I | idtac]).

does work. Ie the parentheses are needed, and make a difference, in
this case.

(contrast tac1 ; tac2 ; tac3 where parentheses don't make any
difference, though I would have expected them to).

Cheers,

Jeremy

On 8/5/19 11:27 PM, Jeremy Dawson wrote:
Hi Laurent,

I'm guessing you mean something like this (but not exactly)

induction H ; (eapply derI; [apply: NLrule_I | idtact]).

but not exactly, since it gives this error
> ^
Error:
Syntax error: '<-' or '->' or [constr_with_bindings_arg] expected after
'apply' (in [tactic:simple_tactic]).

I've never seen the "apply:" construct, can you clarify?

Thanks

Jeremy


On 8/5/19 3:22 AM, Laurent Thery wrote:

If you are sure that eapply derI always generates 2 subgoals,

you can of course do (eapply derI; [apply: NLrule_I | idtact]).


On 8/4/19 3:57 PM, Jeremy Dawson wrote:
Hi,

I have a tactic eapply derI
which when applied to a goal produces two resulting goals.
Of these two I want to apply the tactic NLrule_I to the first one.
The tactic induction H results in 7 goals.

So when I try
Proof. intros. induction H ; eapply derI ; [> NLrule_I | ].
I get the error (not unexpected)
Error: Incorrect number of goals (expected 14 tactics, was given 2).

When I try
Proof. intros. induction H ; (eapply derI ; [> NLrule_I | ]).
I get the same error, which I don't understand at all
(though the fact that putting in parentheses doesn't have the
expected result has been discussed on this list previously).

When I try
Ltac derI_NLr := eapply derI ; [> NLrule_I | ].
Proof. intros. induction H ; derI_NLr.
although sometimes defining a tactic using Ltac
has previously given me what I want and expect,
in this case again I get the error
Ltac call to "derI_NLr" failed.
Incorrect number of goals (expected 14 tactics, was given 2).

How do I apply eapply derI to all goals, then NLrule_I to
the first subgoal resulting from each instance of eapply derI?

Thanks,

Jeremy





Archive powered by MHonArc 2.6.18.

Top of Page