coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Frédéric Besson <frederic.besson AT inria.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Ltac extend
- Date: Thu, 22 Sep 2016 10:15:19 +0200
> On 21 Sep 2016, at 21:39, Jason Gross
> <jasongross9 AT gmail.com>
> wrote:
>
> > In the same vein, I would be glad if a tactic such as ‘is_var' would not
> > be a tactic but a function returning a boolean.
>
> Ltac is_var_bool x := tryif is_var x then constr:(true) else constr:(false).
>
> Does that work?
Doesn’t it trigger the infamous error message "expecting a tactic got a term"
> Otherwise:
>
> 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).
This is what I would call Ltac kung-fu.
A dark art which I sincerely admire but do not intend to practice.
Remember that at OCaml level [is_var] is just a trivial pattern-matching over
the constr i.e O(1) for a tiny 1.
Best,
—
Frédéric
- [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.