Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] lesson learned about reflection: atoms and transparency

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] lesson learned about reflection: atoms and transparency


Chronological Thread 
  • From: "jonikelee AT gmail.com" <jonikelee AT gmail.com>
  • To: Guillaume Melquiond <guillaume.melquiond AT inria.fr>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] lesson learned about reflection: atoms and transparency
  • Date: Tue, 30 Jun 2020 23:10:54 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt1-f177.google.com
  • Ironport-phdr: 9a23:xqf54hSFJN0swdeW7NUgukz4WNpsv+yvbD5Q0YIujvd0So/mwa67ZBOFt8tkgFKBZ4jH8fUM07OQ7/m+HzRZqsjZ+DBaKdoQDkJD0Z1X1yUbQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYnbr+tQt2agMu4zf299IPOaAtUmjW9falyLBKrpgnNq8Uam4RvJrswxxfTvndEZutayGJ0KVmOmxrw+tq88IRs/ihNu/8t7dJMXbn/c68lUbFWETMqPnwv6sb2rxfDVwyP5nUdUmUSjBVFBhXO4Q/5UJnsrCb0r/Jx1yaGM8L4S7A0Qimi4LxwSBD0kicHNiU2/3/Rh8dtka9UuhOhpxh4w47JfIGYMed1c63Bcd8GQ2dKQ91cXDJdDIyic4QPDvIBPedGoIn7u1sOtga1CQ21CO/y1jNEmnr60Ksn2OojDA7GxhQtEdwOvnrKsdv7N6UdUe6ywqbH0TrNYOhb2Svk6IXSbhwsu+2AULB2fMHMyUcvDQTFjlCIpIDrPTOV0eINs2mY7+V+UeKglXAophp+ojiq3Mgsi43JipgJxVDD8CV1zps+KNq6SE58Z96kEZhQuD+eN4RoXMwvWG5ouCMgxb0HvZ63ZjQFyJMixxPGbfGMboeH7A75WumLPTd4mGxqeKi5hxuq7UWs1O/xW8aq3VtIrydLnNnCu2wN2hHX9MWKS+Vw81qh1DqTygze6/9ILF4pmKfFJJMt3qA9mJQPvEnAGiL7mEP7h7KVeEU84uWk9fjrb7H8qpKfN4J4kBzyP6UylsClHOg1MAoDU3CF9em9yLHv4Ej0TKhOg/Iql6TUv5HXKdgHqqO8DQJazogj5hOlADqpytsVn3wKIVFKdRKJgYjkPl/OL+7jAvqwhlmhlDlmyvHJM7DnH57DNGLMkK37crZ480NcyBQ8zdRY559MD7EOOvPzWkvouNzBEh81LhW4w+j6BNh/1I4SQ22PAqieMKPdtV+H+PgjLPWLZI8QoDr9Kv4l6ODyjXIhh1MRYa2k0YEUZX24BPhqPkSUbWb2jtscE2oHvBIyTOnwh12DVT5TaWyyX6U55jwjCoKmCoHDRoGugLOf2Ce0AINZa3tJClCJC3jodoGEV+0QZyKVJ89tiiYEWqS5S489yRGusxf3y795IerQ4y0YqJPj1N9z5+DIlBAy9Dl0AN+H026XVW10n2UIRyU33K9lu0B9xE2D27Big/NEDdxT++9JUgAiOJHAyOx6Esn+VR7FfteUU1mrWc6mADE0TtIp2dACeUd9G9O4jhDCxSWmGbEVl6bYTKAzp43B3nz1Ltt4xj7j2a04klghRMcHYWK7h6p7/hXWCsjMnkGAiqetc6g03SjX9W7Fw3DY729CVwslG6fCW3Eca0/boPz240rDS/mlDrFtel9DzsiDKaZOZ9DBglBPRfOlM9PbNTHi01ysDAqFk+vfJLHhfH8QiWCEUBBdzlIjuE2ePA17PR+P5mLTCDs0SwDqakLotPBi8Ta1FxBriQ6NaEJl2vy+/RtH3aXNGcNW5aoNvWIakxsxGV+829zMDN/Z/lhueaxdZZU251IVjDuF5Tw4BYSpKuVZvnBbax5+5hq82BB+C4EGms8v/isn

Guillaume, I think I see your point. I think you are advocating for a
style of reflection where one has to prove:

Theorem reflection_works:
forall (f : Sorted_formula),
(solve_sorted f = true) -> sfDenote atomics f

where solve_sorted performs the reflection, and can only access the
reified formula, not its denotation in any way. With the performance
advantage that it only needs to return a bool. That's not the style of
reflection I picked up from CPDT.

But I certainly see how it would be an improvement.

Also, it seems that any opaque theorems about real lists would be
used solely within the proof of reflection_works and not
within solve_sorted, which would only compute on reified lists.

I'll think about how to re-implement this in that style. Thanks.

Jonathan


On Tue, 30 Jun 2020 20:53:54 +0200
Guillaume Melquiond <guillaume.melquiond AT inria.fr> wrote:

> Le 30/06/2020 à 20:00, jonikelee AT gmail.com a écrit :
> > I've attached the now working reflection code as a stand-alone .v
> > file, so that you can judge if it does reflection properly.
>
> Your final theorem states:
>
> reflect_sorted :
> forall (A : Set) (ordA : Ordered A)
> (atomics : list (@Atom A)) (f : Sorted_formula),
> if solve_sorted atomics f then sfDenote atomics f else True
>
> Your decision procedure "solve_sorted" suffers from two flaws, in my
> opinion. First, it takes "atomics" as argument, that is, it has access
> to all the atoms and performs computations on them, instead of
> considering them as opaque. A proper decision procedure would only
> take the reified formula "f" as argument.
>
> Second, it does not return a value of type "bool" but a value of type
> "option P" with "P:Prop". In other words, it computes a large proof
> term of type "P" for naught. Sure, the return type becomes "bool" if
> you were to extract your procedure and run it outside of Coq, but you
> are running it inside Coq. (Hopefully, the laziness of Coq's
> conversion checker will avoid building the whole proof term, but that
> might require a lot of tweaking using the "Strategy" command.)
>
> To summarize, I see little hope that a function "solve_sorted" with
> such a signature will ever work in an efficient manner.
> Unfortunately, this signature is a direct consequence of your proof
> style, so I have no simple suggestion to provide.
>
> Best regards,
>
> Guillaume




Archive powered by MHonArc 2.6.19+.

Top of Page