Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Using SerAPI in a plugin

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Using SerAPI in a plugin


Chronological Thread 
  • From: Talia Ringer <tringer AT cs.washington.edu>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Using SerAPI in a plugin
  • Date: Tue, 21 Sep 2021 18:44:49 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=tringer AT cs.washington.edu; spf=Pass smtp.mailfrom=tringer AT cs.washington.edu; spf=None smtp.helo=postmaster AT mx7.cs.washington.edu
  • Ironport-hdrordr: A9a23:1bMnIqFr+6bJVSVkpLqEj8eALOsnbusQ8zAXPidKKCC9E/b3qynApoV56faZskdyZJhCo7+90de7IU80nKQdieJ6AV7IZmXbUQWTQb1f0Q==
  • Ironport-phdr: A9a23:6/uwqRXZrkTwi9As6LpRyiV3u5LV8KxcVTF92vMcY1JmTK2v8tzYMVDF4r011RmVB92duqsP1rWempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffRlEiCC5bL9vIxm7rQfcvdQKjIV/Lao81gHHqWZSdeRMwmNoK1OTnxLi6cq14ZVu7Sdete8/+sBZSan1cLg2QrJeDDQ9LmA6/9brugXZTQuO/XQTTGMbmQdVDgff7RH6WpDxsjbmtud4xSKXM9H6QawyVD+/6apgVR3mhzodNzMh/27XhM5/gqJVrhyiuhJx3ZLbbZqPO/ZiZK7QZ88WSXZDU8tXSidPApm8b4wKD+cZI+hXtY39p1oUohCjGQesBeXvyjBWiX/swKY31PghERvH3AwmENIBrm7Uoc7pO6cJS+y0wrPHzS7Db/NX3zf955TIchcnof2WQ71/bNfRxFApGgjYgVqetZbrMCmJ1uQRrWeb9exgWPqyh2I7qw9/rCWjy8Mih4XUh48Yy17J+Cp3zog1O9C2R092bNq4HZZMtyyXK4R7TM0+TmxrpCo3yLMItJ2/cSULzpks2hDRa/uCc4eS4xLjUv6cITh5hHJ5eLK/mg29/VK8xe37U8m51ktBoCldktTUq3wA2ADf5tKaRvZy4EutwziC2xrO5uxLJU04jbTXJ4Ilz7IqlZcesV7PEjL3lUj3lqObeVso9+614Or9eLrmvIWTN4pshwH+LKsunsu/DPw9MgkBXWWX4/iz1Kb58Uz3WrpKlf02kqjfsJDVOcQboai5DxVL3Yk+9hazFzam0NIGknkbNF9JZR2Kg5TzN13TL/30E+2zjlq2nDt2yP3LOqXtApDXIXjClLfhc6x960lZyAcr0dBf/ZNUCrcOIP3tQE/8r8DXDgQjPw262ennE9V91oIYWWKAHq+ZN6XSvUWW6e0yPumAfJUVtyrlK/g5+/7uimc0lkMafamwxJcYdHS4Hul9LEiCenrtgtIBEX8QsQYkTezqjkeCUT9JaHqoUaI8/GJzNIXzBoDaA4upnbap3SGhH5QQaHoVJEqLFCLUfoGFUr82aSSdL9UpxiAeVL6uRpUJ3groqwbhy7thIfbT/GsVuY+1h4s93PHaiRxnrW88NM+ayWzYFwmce0sDXHkp1bt/oEpy1lCFl6V0nq4AfTSyz/ZZDUExLtjDxvd6Ctb9RgXHONqFVQT+Kj1JKToqCM042N8PZUlhHNPkgxzejXPCPg==

We got Dune and SerAPI working, and also Lymp so we can call out to machine learning models in Python. (Pyml and Py didn't work, and gave us mysterious errors.)

It's in a branch of coq-plugin-lib, in case anyone finds this in the future and needs to do something similar: https://github.com/uwplse/coq-plugin-lib/tree/sound

Talia

On Wed, Sep 8, 2021 at 4:15 PM Talia Ringer <tringer AT cs.washington.edu> wrote:
Just for the record for the future I guess, I couldn't get Dune working with the original plugin (even without SerAPI) because the plugin has many subdirectories, and I can't figure out a way to get the .v theory that loads the plugin to begin with to link to all of them. I can sort of hack it by adding a lot of "declare ML module" lines in the top-level theory for every subdirectory, but if I do that, coqdep gives me a number of warnings like "declared ML module contexts has not been found!" and then the build does not progress any further. I tried messing with the paths in a few different ways but couldn't figure anything out that got rid of the warning.

My work-in-progress is here: https://github.com/uwplse/coq-plugin-lib/tree/dune . I hope I figure it out at some point since this is a serious blocker for integrating a machine learning model into an existing plugin. Probably I will try to corner Emilio and talk him into a synchronous call :). But if anyone has encountered this before, I'd love to hear how you resolved it.

Talia

On Wed, Sep 8, 2021 at 12:43 AM Talia Ringer <tringer AT cs.washington.edu> wrote:
Thanks, this path looks really promising and I'll try it as soon as I get the chance.

On Tue, Sep 7, 2021, 7:55 PM Lasse Blaauwbroek <lasse AT blaauwbroek.eu> wrote:

With dune, Coq's libraries are split into sub-libraries, such as 'coq.plugins.ltac'. When you need to use a particular API file, you check which library it is in (by opening the dune file in the directory of that file), and add that library as a dep. The repo I linked does this with 'coq.plugins.ltac'.

On 08/09/2021 02:50, Talia Ringer wrote:
Thanks, with Dune though I can't even get my Coq plugin without SerAPI to load Constr, Environ, and other necessary modules. I have no idea what I'm supposed to depend on to get those.

On Tue, Sep 7, 2021 at 7:47 PM Lasse Blaauwbroek <lasse AT blaauwbroek.eu> wrote:

I have an example plugin that does exactly this here: https://github.com/LasseBlaauwbroek/serapi-example

I think I built this again 8.11 at the time, but I'm not sure (I didn't try to recompile the plugin before this email). Word of warning: Using SerAPI in a Coq plugin can be rather difficult due to its dependencies.

Lasse

On 08/09/2021 02:30, Talia Ringer wrote:
Hi all,

Have any of you gotten plugins that call out to SerAPI working, especially on Coq 8.9 (I am bound to 8.9 because of a dependency)? If so, I'd really love to see some example plugins. This is a major blocker for me and a student on a project.

I'm open to any build system at this point, but I haven't managed to get Dune working even without SerAPI---it gives me a bunch of errors failing to find Constr, Environ, and so on. The Dune tutorial didn't seem to address those errors. I don't know where to find the list of Coq libraries I can try to depend on from within a Dune project.

Without using Dune, using the normal _CoqProject and so on, I can get it to build if I build from source, which is already hacky. But then it fails to load:

File "./theories/Plib.v", line 1, characters 0-25:
Error:
while loading /home/talia/coq-plugin-lib/src/plib.cmxs:
error loading shared library: /home/talia/coq-plugin-lib/src/plib.cmxs: undefined symbol: camlPlib__Serapi_goals__anon_fn$5bcoq$2dserapi$2fserapi$2fserapi_goals$2eml$3a66$2c31$2d$2d47$5d_175_closure

Help with either of these paths would be strongly appreciated. 

Talia 



Archive powered by MHonArc 2.6.19+.

Top of Page