coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jonathan Leivent <jonikelee AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Ltac extend
- Date: Thu, 22 Sep 2016 10:07:31 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f170.google.com
- Ironport-phdr: 9a23:vgROoRHsQVjc0rOYAp4glZ1GYnF86YWxBRYc798ds5kLTJ76oMiwAkXT6L1XgUPTWs2DsrQf2rCQ6/yrBjRIoc7Y9itdINoUD15NoP5VtjJjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9fbytScaBx/iwguu14tjYZxhCrDu7e7J7ahus/ivLscxDo4xkI7oxwx2BhnZJZelQ2Ss8J1WVnhXx4sq91JFm+iVU/fkm8pgTAu3BY60kQOkAX3wdOGcv6ZizuA==
On 09/22/2016 04:27 AM, Robbert Krebbers wrote:
On 09/22/2016 10:15 AM, Frédéric Besson wrote:
Jason's trick can be simplified as follows:Otherwise:This is what I would call Ltac kung-fu.
Class is_var_bool {T} (x : T) := decide_is_var : bool.
Hint Extern 0 (is_var_bool ?x) => first [ is_var x; exact true | exact false ] : typeclass_instances.
Ltac is_var_bool x := constr:(_ : is_var_bool x).
A dark art which I sincerely admire but do not intend to practice.
Ltac is_var_bool x :=
constr:(ltac:(first [is_var x; exact true|exact false])).
I sometimes use this constr:(ltac:t) trick to define tactics that return a term while being implemented using possibly side-effecting tactics.
IMHO my solution isn't very pretty either...
Yet another solution is:
Ltac is_var_bool x :=
match goal with
| _ => let dummy := match goal with _ => is_var x end in true
| _ => false
end.
This is a throwback to the pre-tactic-in-term days of 8.4+.
IMHO none of these are pretty. But, one can mask them with a Tactic Notation. One additional behavioral feature of this ugly match form is that - if one instead uses multimatch for the outer match, the form have multiple backtracked successes, unlike the constr:(ltac:(...)) form.
-- Jonathan
- [Coq-Club] Ltac extend, Frédéric Besson, 09/20/2016
- Re: [Coq-Club] Ltac extend, Pierre-Marie Pédrot, 09/20/2016
- Re: [Coq-Club] Ltac extend, Frédéric Besson, 09/21/2016
- Re: [Coq-Club] Ltac extend, Jason Gross, 09/21/2016
- Re: [Coq-Club] Ltac extend, Frédéric Besson, 09/22/2016
- Re: [Coq-Club] Ltac extend, Robbert Krebbers, 09/22/2016
- Re: [Coq-Club] Ltac extend, Frédéric Besson, 09/22/2016
- Re: [Coq-Club] Ltac extend, Laurent Thery, 09/22/2016
- Re: [Coq-Club] Ltac extend, Jason Gross, 09/22/2016
- Re: [Coq-Club] Ltac extend, Frédéric Besson, 09/22/2016
- Re: [Coq-Club] Ltac extend, Jonathan Leivent, 09/22/2016
- Re: [Coq-Club] Ltac extend, Robbert Krebbers, 09/22/2016
- Re: [Coq-Club] Ltac extend, Frédéric Besson, 09/22/2016
- Re: [Coq-Club] Ltac extend, Jason Gross, 09/21/2016
- Re: [Coq-Club] Ltac extend, Frédéric Besson, 09/21/2016
- Re: [Coq-Club] Ltac extend, Pierre-Marie Pédrot, 09/20/2016
Archive powered by MHonArc 2.6.18.