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: Jeremy Dawson <Jeremy.Dawson AT anu.edu.au>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] how to combine tactics
  • Date: Mon, 5 Aug 2019 13:22:08 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=anu.edu.au;dmarc=pass action=none header.from=anu.edu.au;dkim=pass header.d=anu.edu.au;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=26P02eBDm4DUUugPqwA5M9SmVVHSJu8Cg/2z6rF5/z0=; b=oDGeI6GHsg/Roe84zAPXMaUj+NKkE53Fxbem5eOJj2oMVY6PPoAAxRw04qasG/WAYAKgNj88l7/utoz5X6YJMfOhynlxdoq7HoC5cfwoCzUCcGn0LsWNsjwcEaMXjfJBscFHiE1FSWRr8XzOkTvuhVVB03MjenP/kk/ifLsVTk1rnQs/mSiuS2tkPNzR3KDimt7Vt6NhdsbWBsQbHjIvZMJ/AjtJwOUL3Tgsn4BZjxi3RQZA9sx82fkTVNlbw+AQRcf7fg4TwAtVUJlNngz+I4WgXIGwpfD9WwF+8SU7SH8ApTCItl+MmmEfzSisVMMacK4IACilzdq/G5RjEh/Dhw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hIvxRSoKkbd9Z0PezdQ2wZpHnsvkOh8ORvSUbS6p0k5J7DSdOydV7DubyA+aYjBByIG+AtXREv2SNJTPWi6w4eW3/q5yXMTXAj1p5UbYExF7UYFkEV8XepE9zjjX4WkUM+lvz6uA/x4eY5+YbGPGeeSxuiYribG7neANKJqXhy41sxJJrQqAKvDB0ye2PfgUcUuORyTOLQux0yiD8CC73RddaZfeNaoOVpictCiNyIc9neKHpvLlO7U3HeYxwzW7FjnlzCgZzjx6s8A3j+VwCtmyVBp4rd526x7TNtpTCQZ2SZDBpgR3rybkMOz2y9bypOR3GjPwjBqp6HDvI3ddVQ==
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=Jeremy.Dawson AT anu.edu.au; spf=Pass smtp.mailfrom=Jeremy.Dawson AT anu.edu.au; spf=Pass smtp.helo=postmaster AT AUS01-ME1-obe.outbound.protection.outlook.com
  • Ironport-phdr: 9a23:qfvxcBeZ1XzNtQQZZBbIvIW4lGMj4u6mDksu8pMizoh2WeGdxcW9bR7h7PlgxGXEQZ/co6odzbaP6ea5ATNLv8/JmUtBWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYdFRrlKAV6OPn+FJLMgMSrzeCy/IDYbxlViDanbr5+MQu6oR/MusUKg4ZuJac8xgbUqXZUZupawn9lK0iOlBjm/Mew+5Bj8yVUu/0/8sNLTLv3caclQ7FGFToqK2866tHluhnFVguP+2ATUn4KnRpSAgjK9w/1U5HsuSbnrOV92S2aPcrrTbAoXDmp8qlmRAP0hCoBKjU293zZitFrjKJDvh2uuwB/zYDTYIGQLvV+f6Xdds4eSWdOWstdUipMCZ6+YYQSFeoMJeZWoZfgqVsSoxWwBgesC+HuyjBUiXH50rY30/g4EQzcwAAsA84CvXTSod7oNKkSS+e1zKzQwDvHcfxWwyny6I3Icxs8r/+DR7xxcdHWyUkpCgjIiVGeppL/PzyL0+QMs3KX4eR6WuOhkG4nrAdxryO1yccql4nFnJwaxU3Z9Slj2ok1OMS1RUhmatCqF5tQsjuVN4pwQs46QmFovjw6yrwctpKhcigK0owrxxHea/ybc4iI/wnsWPyQITd/gn9uZbGxhw6q/EWv1uHwTNS43EpIoyZfj9XBuHEA2wbO5sSbVPdx5lqt1SiT2wzJ9+1JI1o4mbfYJpMl2LI8iJQevVnbEi/4hkr7j7Oae0Ah9+Wr6+nqbbrrq5qSN4JwiAzzPKEjldGjDeslMQUDWnWU9OCi27L9+0DyXa9EgecskqbDtZDXPcQbqbC9Aw9Syosu9xiwASq63NgFhHUJK11LdA+eg4juIF7BPur0DfCig1SwizhrwO3GPrv8DZnXNnjDirDhfapj5EFA1AozzNdf55ROBrEGPfLzRkvxtNvfDh86KQC73+HnCNBl2oMfX2KAHLOZPbvdvFOU/O4jPvWAaY0PtDrgJfUo5uTigWIllVMDZaWp2IEYaHG8HvRoOUWZZn/sj88FH2gUpAoxUunqiV2YXTBdfXmzUbk85jY9CI+9F4jDQJ2tjKaf0yimA51afHpJCk2UHXfya4qEQ+sMaD6VIsJ5jjMEUqGhR5Y92hGqqQ/10KFqLvHU+y0drZLszsJ55+zVlREo9Dx7Fd6R02+XTzI8omRdDTQxxeV0pVF34laFy6lxxfJCX5QH7PRQFww+KJT0zupgCtm0VBiXLfmTT1PzYNi8DDQgBv443MQJZQ4pOdi4gxXSmQajHKQSkZSCAoFy/67BmXHscZUug03a3bUs2gF1CvBEMner0/IurlSBN8vyi0yc0p2SW+EExieUrjWKy3fIsU1FFgdtA/2cDCIvI3DOpNG83XvsCrqnCLApKAxEkJTQI61XLNDlkBNPWaW6YYmMUyeKg261QC2w6PaMYY7tJzpP9RjmUBFBti1KuHGMOE45GzurpH/YAHp2D1Xzbkjw8O547nSmUkszyALMZEpkheO4

Hi Jason,

I have tried this, I get

induction H ; eapply derI ; [ NLrule_I | ].
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Tactic failure: Incorrect number of goals (expected 14 tactics).

ie, exactly the same problem. (I agree that the documentation seems to
say it would do what I want).

Cheers,

Jeremy

On 8/5/19 3:56 AM, Jason -Zhong Sheng- Hu wrote:
> Hi Jeremy,
>
> have you tried
>
> eapply derI ; [ NLrule_I | ].
>
> notice that > is dropped. you can read it from the refman:
> https://coq.inria.fr/refman/proof-engine/ltac.html#coq:tacn.dispatch
> The tactic language — Coq 8.9.0 documentation
> <https://coq.inria.fr/refman/proof-engine/ltac.html#coq:tacn.dispatch>
> The tactic language¶. This chapter gives a compact documentation of L
> tac, the tactic language available in Coq.We start by giving the syntax,
> and next, we present the informal semantics. If you want to know more
> regarding this language and especially about its foundations, you can
> refer to .Chapter Detailed examples of tactics is devoted to giving
> small but nontrivial use examples of this ...
> coq.inria.fr
>
> /Variant/ |expr_0
> <https://coq.inria.fr/refman/proof-engine/ltac.html#grammar-token-expr>
> ; [expr_i
> <https://coq.inria.fr/refman/proof-engine/ltac.html#grammar-token-expr>*|]|
>
> This variant of local tactic application is paired with a sequence.
> In this variant, there must be as many |expr_i
> <https://coq.inria.fr/refman/proof-engine/ltac.html#grammar-token-expr>|
> as goals generated by the application of |expr_0
> <https://coq.inria.fr/refman/proof-engine/ltac.html#grammar-token-expr>|
> to each of the individual goals independently. All the above
> variants work in this form too. Formally, |expr
> <https://coq.inria.fr/refman/proof-engine/ltac.html#grammar-token-expr>
> ; [ ... ]| is equivalent to |[> expr
> <https://coq.inria.fr/refman/proof-engine/ltac.html#grammar-token-expr>
> ; [> ... ] .. ]|.
>
> I suppose this is what you want.
>
> *Thanks,*
> *Jason Hu*
> *https://hustmphrrr.github.io/*
> ****
> ------------------------------------------------------------------------
> *From:*
> coq-club-request AT inria.fr
>
> <coq-club-request AT inria.fr>
> on behalf
> of Laurent Thery
> <Laurent.Thery AT inria.fr>
> *Sent:* August 4, 2019 1:14 PM
> *To:*
> coq-club AT inria.fr
>
> <coq-club AT inria.fr>
> *Subject:* Re: [Coq-Club] how to combine tactics
> Hi Jeremy,
>
> the selector you try to apply seems to be work globally and not locally
> like you think. As a ssreflect user,
>
> https://coq.inria.fr/refman/proof-engine/ssreflect-proof-language.html
>
> I will use the ssreflect tactical first to solve your goal
>
> ================================================
>
> From Coq Require Import ssreflect.
>
> Inductive Seven := one | two | three | four | five | six | seven.
>
> Definition  double (x : Seven) := x.
>
> Lemma derivI : forall (n y : Seven), y = y -> double n =  double n ->  n
> = n.
> Proof. now trivial. Qed.
>
> Ltac NLrule_I := trivial.
>
> Goal forall h : Seven, h = h.
> Proof.
> induction h; (eapply derivI; first NLrule_I).
>
> ================================================================
>
>
>
> As I usual
>
> 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