coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "Soegtrop, Michael" <michael.soegtrop AT intel.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Coq's performance over destruct tactic
- Date: Wed, 9 May 2018 14:00:53 +0000
- Accept-language: de-DE, en-US
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=michael.soegtrop AT intel.com; spf=Pass smtp.mailfrom=michael.soegtrop AT intel.com; spf=None smtp.helo=postmaster AT mga14.intel.com
- Dlp-product: dlpe-windows
- Dlp-reaction: no-action
- Dlp-version: 11.0.200.100
- Ironport-phdr: 9a23:1yIy3Byjs9Y8mQfXCy+O+j09IxM/srCxBDY+r6Qd2+4UIJqq85mqBkHD//Il1AaPAd2Araocw8Pt8InYEVQa5piAtH1QOLdtbDQizfssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1JuPoEYLOksi7ze+/94HdbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeuBWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbOSxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDwULs6Wymt771zRRHolikJKiI5/m/UhMxxkK1UrwmsqAZjz4PQeoyZKOZyc6HbcNgHRWRBRMFRVylZD4+ycoUPCPQOPelEr4nnoFsOtQOyDhSrCuPu1jBIhmX50rM+0+gvDArL2wkgH9MSv3TUttr6KqMSXfquzKnP0zrDYO9W2S366IjQaR0hoPeMXa5ufsrV00UgCwTFjlCJpIHjIjib2OMNs22B4OphU+Kik28nqwdtojexwscgkJTGiZwTx1vZ9it52J44KcC8RUJle9KpEJtduzuaOodoWM8uXnxktSYixrEbuJO2cjIGxZopyhLFdfCKfYyF7gj+WOuSPDt0nG9pdbO7ihqo70StyuLxWtOq3FpQsCZInd3Bu3YQ3BLJ8MeHUOFy/kK51DaPyQ/T7uZELFgxlarUMZEt37E9moASsUTFAi/5hkH2gLWKeUUj/+ik8+XnYrP4qZ+AL4J4lwXzPro0lsG/Aek0KAgDU3aB9eihybHu/VX1QLBQgf03lqnZvoraJcMepqOhBg9V05os6xalADi41NQUh2IHLFVbdxKIk4jpIVbOIOjjAPe+hVSsjClkx/TcMrL9BZXNK2DPkK39crZl905c1A0zwMhD6JJTE7ENOe78WkvstNPDFRI5KAy1w+P/CNpnzI8eWGSPArWYMKzIq1OI6PgvcKGwY9pfszHkbvMh+vTGjHkjmFZbc7Pjlc8cb2n9FfB7KW2YZ2Dti5EPCzFZkBA5Sbmgs1qPXiJJYG72F4c97TEyBYbsRdPGR4utibGFmjy8E5JKfGdeIlGKDXrsMY6DXqFfO2qpPsZ9n2lcBvCaQIg72ET27V6o+/9cNuPRvxYgm9fm3dlx6ffUkEhrpz1yE8mZlWqKSjMtxz9ad3oNxKl65HdF5BKby6Eh2q5ZE8Be47VCVQJobceBndw/MMj7X0f6RvnMSFuiRYz5UzQ+R4tthd4If0t5Xd6li0Kb0g==
Dear Wilayat,
below please find a complete proof script which works. It takes 30 milliseconds (on my rather old machine).
You can repelace the solution also with
repeat DestructMatchArg. all: reflexivity.
The first repeat results in 29 trivial goals, not 65536 as with a brute force destruct.
To see how it works, it is instructive to call DestructmatchArg and reflexivity manually step by step.
Of cause you can also add DestructmatchArg as extern hint to auto, as well as the unfolding, so that just auto does the trick.
Hope it helps J
Best regards,
Michael
(* DestructMatchArg Example *)
Inductive bool: Type:= true | false. Definition and (x y: bool) : bool := match x, y with | true, true => true | _, _ => false end.
Definition or (x y: bool) : bool := match x, y with | false, false => false | _, _ => true end.
Notation "x + y" := (and x y) (at level 50, left associativity) : bool_scope. Notation "x * y" := (or x y) (at level 40, left associativity) : bool_scope.
Open Scope bool_scope.
(* In nested matches, get the argument of the inner most match *)
Local Ltac GetInnerMatch term := match term with | context [match ?inner with _ => _ end] => GetInnerMatch inner | _ => term end.
(** Destruct the argument of a match in the goal or hypothesis *)
Ltac DestructMatchArg := match goal with | |- context [match ?term with _ => _ end] => let EQ:=fresh "EQ_DestructMatchArg" in let inner:=GetInnerMatch term in destruct inner eqn:EQ | H: context [match ?term with _ => _ end] |- _ => let EQ:=fresh "EQ_DestructMatchArgInHyp" in let inner:=GetInnerMatch term in destruct inner eqn:EQ end.
Theorem equal: forall a b c d e f g h i j k l m n x y:bool, a*b*c*d*e*f*g*h*i*j*k*l*m*n + x + x*y = a*b*c*d*e*f*g*h*i*j*k*l*m*n + x. Proof. intros; unfold or; unfold and. time repeat ( try reflexivity; try DestructMatchArg ). Qed. Intel Deutschland GmbH |
- [Coq-Club] Coq's performance over destruct tactic, Wilayat Khan, 05/08/2018
- Re: [Coq-Club] Coq's performance over destruct tactic, Maxime Dénès, 05/08/2018
- RE: [Coq-Club] Coq's performance over destruct tactic, Soegtrop, Michael, 05/08/2018
- <Possible follow-up(s)>
- Re: [Coq-Club] Coq's performance over destruct tactic, Soegtrop, Michael, 05/09/2018
- Re: [Coq-Club] Coq's performance over destruct tactic, Pierre Courtieu, 05/09/2018
Archive powered by MHonArc 2.6.18.