coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gregory Malecha <gregory AT bedrocksystems.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] lesson learned about reflection: atoms and transparency
- Date: Tue, 30 Jun 2020 11:37:43 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gregory AT bedrocksystems.com; spf=None smtp.mailfrom=gregory AT bedrocksystems.com; spf=None smtp.helo=postmaster AT mail-pg1-f178.google.com
- Ironport-phdr: 9a23:3X9n+xDE8jwJT1CACwXiUyQJP3N1i/DPJgcQr6AfoPdwSPX+ocbcNUDSrc9gkEXOFd2Cra4d1ayO6+u9CCRAuc/H7ClfNsQUFlcssoY/p0QYGsmLCEn2frbBThcRO4B8bmJj5GyxKkNPGczzNBX4q3y26iMOSF2kbVImbuv6FZTPgMupyuu854PcYxlShDq6fLh+MAi6oR/eu8ULgIZuMLo9xgfGrnZIf+ld2GdkKU6Okxrm6cq84Z5u/z5Mt/498sJLTLn3cbk/QbFEFjotLno75NfstRnNTAuP4mUTX2ALmRdWAAbL8Q/3UI7pviT1quRy1i+aPdbrTb8vQjSt871rSB7zhygZMTMy7XzahdZxjKJfpxKhugB/zovJa4ybKPZyYqXQds4dSmRcQ8ZRTDRBDZ2gYIsTAeQBOuNYoJP8p1sIsBCyAQahCefqxjJOm3T437A10/45HA7J0gwvHdIAvnrXotvoKqkdTfu4w7PUwTjZdf5axSvx5YrOfxs8of+MR7Vwcc/JxEcuDQPKkFqQqYv/PzKVy+8DtHKU7+5+Wu2zi24osRx6rz+gxsc2lIbJiYUVykrE9Chi24k6O8C3SFR8YdG4E5tQrCGbN5BqQsw8RmFoozw2xaEBuZ6+ZSUHzoksyBHDZfKdaYeI/g7jW/iLITd+nH9od7yyihmw/EW+yuDxSsq53UhXoidEjNXAqH4D2h7Q58aITvZw4Eiv1zaP2g3O9O1KLl44mLTGJ5M8wbM8ioQfvELeFSH4n0X2ibWZdkQi+uWw8evreLHmqYWEO497iwH+LqQumtGkDugiMwgOWG6W8vm/2r375UD1XqlGg/ksnqTasJ3WP9oXqrO5DgNPz4ou6RWyAjG729oCh3YHNkhKeBefgojpJV7OJPf4AO+6g1u2kTdrw+nKPqXuApnQN3TDnqrtcLR+5kJGxwozytdf551QCr4fOv78RkjxtNnAAh84NQy73frnBc1j2o8CXW+DGKyUPaPIvVOW++4iI/OAaJIXtTv+M/Ql4uThjX49mV8TZ6mp2p4XZWi3HvR8PUqZbn3sgs0BEGoRpQUxUvHliEeFUTFPZHayRKI95ionCI24CIfDXZqhj6CG3Ce+BpFWfHxJCkiQEXf0cIWJQ+sDaCWLIsN4jjMEUaWhRJQ62BG1tA76zqJnIfDO9i0Zs5Ljztl16PfJmRE87zwnR/iahmqKViR/mn4Cbz4wxqF250JnmXmZ1q0trOZVGttJ9rtsWwM3Pp7Vh7h1Ed39XRjQVt2EREyhSda9ECotQ9cqhdQJZhAuSJ2Zkhnf0n/yUPcunLuRCcloo/uNjUi0HN50zjP97IdkilAnRsVVMmj83vx1+gTJAIXKiFSCi6uvbuIX2yufrD7fn1rLh1lRVUtLaYuARWoWPBOEp9n1/ETJTKS/EqgqNxAHwsmHePMTN4/ZyG5eTfKmA+zwJmK8n2DqW0SNz7KIKZLlIiAThXqNTkcDlA8X8DCNMg1sXio=
It is a bit unfortunate that Coq's reduction mechanism works in this way, I too have often found that there are times that I would like to do lightweight computation using efficient reduction mechanisms. My understanding is that IPM suffers some of the same issues, you want to partition the hypotheses efficiently, but you don't want to compute inside them and it doesn't always make sense to go the full Atom route that Guillaume suggested above.
One thing that I've wanted for a while is the ability to control reduction with quoting and anti-quoting mechanisms a.la. meta programming. For example, something that would look roughly like this.
Compute List.rev ((QUOTE (List.rev []) :: QUOTE (a ++ b) :: nil) ++ []).
= [QUOTE (List.rev []); QUOTE (a ++ b)]
Note that QUOTE semantically acts as id, but for the purposes of reduction it blocks reduction of its "argument" (it really only allows substitutions). This would make it possible to write what you want without needing to introduce names. It also allows you to eliminate the required phase separation in standard reflective automation as mentioned by Guillaume (chapter 4, specifically 4.3, of my dissertation discusses some of these issues as well: https://gmalecha.github.io/publications/files/malecha-dissertation.pdf).
On Tue, Jun 30, 2020 at 4:00 AM Guillaume Melquiond <guillaume.melquiond AT inria.fr> wrote:
Le 29/06/2020 à 21:21, jonikelee AT gmail.com a écrit :
> I just learned an interesting lesson about writing decision
> procedures using reflection in Coq. It's probably one that others have
> encountered before - so "tl;dr" if this is a familiar refrain: functions
> used within reflection procedures are not the only elements where
> transparency (Defined vs. Qed) needs to be considered. Atoms matter,
> too.
You seem to be using a rather peculiar definition of reflection. Atoms
should be opaque, by definition. Or rather, since the ability to
distinguish atoms is critical for most decision procedures, atoms should
just be addresses (e.g., closed integers generated by a gensym
function). For example, a decision procedure on propositional logic will
manipulate terms of the following type:
Inductive term : Set :=
| Atom (n : nat)
| Neg (t : term)
| And (t1 t2 : term).
An object of type term is necessarily closed, unless your reification
procedure contains a bug. As a consequence, your computations should
never get stuck.
From reading your email, I am under the impression that your Atom
constructor takes an argument that comes directly from the original goal
or hypotheses. If so, this no longer qualifies as reflection.
Best regards,
Guillaume
--
Gregory Malecha
Mail: gregory AT bedrocksystems.com
BedRock
Systems Inc
UNBREAKABLE FOUNDATION
FOR
- [Coq-Club] lesson learned about reflection: atoms and transparency, jonikelee AT gmail.com, 06/29/2020
- Re: [Coq-Club] lesson learned about reflection: atoms and transparency, Guillaume Melquiond, 06/30/2020
- Re: [Coq-Club] lesson learned about reflection: atoms and transparency, Gregory Malecha, 06/30/2020
- Re: [Coq-Club] lesson learned about reflection: atoms and transparency, jonikelee AT gmail.com, 06/30/2020
- Re: [Coq-Club] lesson learned about reflection: atoms and transparency, Guillaume Melquiond, 06/30/2020
- Re: [Coq-Club] lesson learned about reflection: atoms and transparency, Abhishek Anand, 06/30/2020
- Re: [Coq-Club] lesson learned about reflection: atoms and transparency, Guillaume Melquiond, 06/30/2020
Archive powered by MHonArc 2.6.19+.