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: [Coq-Club] Simplify after elaboration
- Date: Mon, 23 Mar 2020 21:56:41 -0400
- 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-wm1-f43.google.com
- Ironport-phdr: 9a23:+UWjIxLLT7UmH1jdmdmcpTZWNBhigK39O0sv0rFitYgXI/zxwZ3uMQTl6Ol3ixeRBMOAtKIC1rKempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBX660e/5j8KGxj5KRE9ZqGsQtaT3IyL0LWZ/ISbSAFVjnLparRraR6ysA/5t88MgIIkJLxnmTXTpX4dVP5bymRyNBq2lhLx7ce5tMps9i1Utvkh/uZPVKz7e+IzSrkOX2duCHw8+MC+7UqLdgCI/HZJFzxOykMZUTiA1wnzW9LKigW/s+N83CeAOsivFOI7XD2j6+FgTxq60X5bZQ58y3nej4lLtIweuAio/kUtzIvdYYXTP/17LPuEIIEqAFFZV8MUbBRvR4Oxa4xVUrgENOdc6pb4/h4A8UD4Cg6rC+fijDRPgy2u0A==
Hello --
I'm trying to write a notation that simplifies its argument. I wrote the following:
Notation "'[SIMPL]' x" := (ltac:(idtac x; let x := eval simpl in x in exact x))
(only parsing, at level 0, x at level 200).
Definition foo := [SIMPL] 1 + 1.
Print foo. (* := 2 *)
Definition foo := [SIMPL] 1 + 1.
Print foo. (* := 2 *)
Unfortunately, if there is an unbound identifier in the argument of [SIMPL], I get an error message saying "x not found". What I want to do, is perform the type checking, and get the usual error message if there is an error, and otherwise, reduce the term and exact the result. I was wondering if there is some way that I could do this with Ltac2, but I haven't been able to figure it out.
I know that if I'm defining a term, I can write something like:
Definition foo := Eval simpl in 1 + 1.
but I can't seem to do the same thing at the type level, e.g.
Definition foo : Eval simpl in 1 + 1 = 1 + 1.
Any pointers or suggestions would be greatly appreciated.
Thanks.
--
gregory malecha
- [Coq-Club] Simplify after elaboration, Gregory Malecha, 03/24/2020
- Re: [Coq-Club] Simplify after elaboration, Jason Gross, 03/24/2020
Archive powered by MHonArc 2.6.18.