coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gregory Malecha <gmalecha AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] quote tactic and polymorphic data structures
- Date: Mon, 11 Jan 2016 14:46:49 -0800
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gmalecha AT gmail.com; spf=Pass smtp.mailfrom=gmalecha AT gmail.com; spf=None smtp.helo=postmaster AT mail-yk0-f169.google.com
- Ironport-phdr: 9a23:lPP8ChXvLedsJkKv8/Ay+m/SFyHV8LGtZVwlr6E/grcLSJyIuqrYZhOFt8tkgFKBZ4jH8fUM07OQ6PC+HzxZqs/d4TgrS99laVwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfTR8Kum9IIPOlcP/j7n0oM2NJVURz2PhMPtbF1afk0b4joEum4xsK6I8mFPig0BjXKBo/15uPk+ZhB3m5829r9ZJ+iVUvO89pYYbCf2pN4xxd7FTDSwnPmYp/4Wr8ECbFUrcrkcbB04Ri1JjBxXPpEXxWY60uS/nvMJ83jObNIv4V+Zndy6l6vJEUhLnjz0Wfxsw9GzcisU42K1eqRasrBx264HRaYCRcvF5e/WOLpshWWNdU5MJBGR6CYSmYt5KVrJZMA==
I'm not certain about the details of the quote plugin, but the Reify plugin in MirrorCore is programmable enough to do what you want to do and decoupled from the rest of the system enough that you can reify to any language that you would like.
On Mon, Jan 11, 2016 at 5:50 AM, Robbert Krebbers <mailinglists AT robbertkrebbers.nl> wrote:
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]). *)
gregory malecha
- [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.