coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Robbert Krebbers <mailinglists AT robbertkrebbers.nl>
- To: Coq Club <coq-club AT inria.fr>
- Subject: [Coq-Club] quote tactic and polymorphic data structures
- Date: Mon, 11 Jan 2016 14:50:32 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mailinglists AT robbertkrebbers.nl; spf=None smtp.mailfrom=mailinglists AT robbertkrebbers.nl; spf=None smtp.helo=postmaster AT smtp1.science.ru.nl
- Ironport-phdr: 9a23:7qi7hhBK7yY2Tw4/jUC9UyQJP3N1i/DPJgcQr6AfoPdwSP78r8bcNUDSrc9gkEXOFd2CrakU1ayO6+jJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6MyZzvn8mJuLTtICxwzAKnZr1zKBjk5S7wjeIxxbVYF6Aq1xHSqWFJcekFjUlhJFaUggqurpzopM0r221qtvkg789NV7nhN+R9FOQATWduD2dgz8ry/TLHUAHHsnAbSyAdlgdCKwnD9hDzGJnr5HjUrO14jROdN8f7V6x8ei6v5a1mUgSg3CIONjo49m7Ti9dsl4pBpxirqgZjwJTZaouYLuE4eKeLLoBSfnZIQssED38JOYi7dYZaSrNZZes=
I was looking for some means to do some lightweight reification without the need for writing an OCaml plugin or the using Ltac/type classes/canonical structures (which are too slow), so I stumbled on the [quote] tactic. Unfortunately, I cannot get it to work for polymorphic data types like lists, see below.
Does anyone know whether I am doing something wrong, or whether [quote] just does not support my use case below.
======================================
Require Import Quote.
Inductive formula : Type :=
| f_nil : formula
| f_app : formula -> formula -> formula
| f_atom : index -> formula.
Fixpoint interp_f {A} (vm : varmap (list A)) (f:formula) : list A :=
match f with
| f_nil => nil
| f_app f1 f2 => interp_f vm f1 ++ interp_f vm f2
| f_atom i => varmap_find nil i vm
end.
Goal forall x : list nat, True.
intros.
quote interp_f in (x ++ x ++ nil)%list using (fun x => idtac x).
(* Yields nonsense *)
quote (@interp_f nat) in (x ++ x ++ nil)%list using (fun x => idtac x).
(* Fails with Syntax error: [prim:ident] expected after 'quote' (in [tactic:simple_tactic]). *)
- [Coq-Club] quote tactic and polymorphic data structures, Robbert Krebbers, 01/11/2016
- Re: [Coq-Club] quote tactic and polymorphic data structures, Gregory Malecha, 01/11/2016
Archive powered by MHonArc 2.6.18.