Skip to content

Conversation

@ejgallego
Copy link
Collaborator

@ejgallego ejgallego commented Jul 16, 2025

We introduce (lang rocq), a build mode for the Rocq Prover, previously known as "Coq".

The build mode is an exact copy of the (lang coq) mode, renaming the modules, data, and some global declarations. Also, the default implicit lib is now named Corelib.

(lang coq) should be considered deprecated / frozen, and eventually removed.

There are many cleanups and improvements possible, in particular we have done, in separate commits:

  • removed support for older legacy coq modes
  • removed support for legacy plugin handling
  • removed the need for coq-* shims

All of the tests have been ported and manually verified to work (a time consuming process) As of today, all test pass.

Future work:

  • support new extraction option (-output-directory)
  • improve composition with local rocq as in (lang coq), as of today the rocqworker is not injected as a dependency
  • nix CI + develop
  • forward port _RocqProject generation
  • forward port rocqdoc headers work
  • forward port per_module fixes
  • cosmetic, turn rocq into rocq compile for --display=short
  • [CI] Remove dependency on rocq-stdlib, only extraction tests need that

Closes #11572

Joint work with Li-yao Xia.

@rlepigre-skylabs-ai
Copy link

I just learned that you are working on this @ejgallego, that's great news!

There are several points that are IMO worth discussing before merging this PR:

Also, I'm happy to play a part in this if you want help.

@rlepigre-skylabs-ai
Copy link

Another candidate is going back to calling rocq dep on all files, instead of per-theory.

@ejgallego
Copy link
Collaborator Author

Hey @rlepigre-skylabs-ai !

I just learned that you are working on this @ejgallego, that's great news!

Indeed! Thanks a lot for your message. We got side-tracked by other stuff, but the idea is to merge this and #11945

There are several points that are IMO worth discussing before merging this PR:

Yes, we will forward port this in a separate PR.

  • To more easily support the above, should we remove per-module flags? (IMO they are kind of useless.)

IMHO we can just say that both can't work together, there are some folks trying to use this feature, so I'd like to keep it.

  • Similarly, should we enforce at most one theory stanza per directory? (I personally always do that, can't imagine this breaking too much stuff.)

This would certainly break a lot of stuff tho, what would we gain?

  • Should we sort out the .vos / .vok mess?

Happy to work on this but IMHO we can do in a separate PR.

Yes, we will also forward port this.

Also, I'm happy to play a part in this if you want help.

Absolutely, @Lysxia and I will send a mail soon to coordiante.

Another candidate is going back to calling rocq dep on all files, instead of per-theory.

This should be easy to do if we want, tho for some users it would mean a large performance regression. But IMHO unrelated to this PR which is to enable Rocq users no to have to depend on the coq-* compatibility wrappers.

@rlepigre-skylabs-ai
Copy link

This should be easy to do if we want, tho for some users it would mean a large performance regression. But IMHO unrelated to this PR which is to enable Rocq users no to have to depend on the coq-* compatibility wrappers.

I think this was originally due to performance issues in coqdep that have now kind of been fixed, but I could be wrong. For us, at this point, this would be a performance improvement I believe.

@ejgallego
Copy link
Collaborator Author

I think this was originally due to performance issues in coqdep that have now kind of been fixed, but I could be wrong.

Do you have pointer? The original performance problem is that in one rocqdep call per file, rocqdep will still scan the whole user-contrib tree. This has a huge impact in practice, even in fast systems like Linux.

For us, at this point, this would be a performance improvement I believe.

I'd be happy to make this configurable, the original Coq mode used this system so it is easy just to look at the commit and add back that code with a flag.

Once we have that we could test for numbers, but my original experiments showed a large overhead of repeated rocqdep calls.

@rlepigre-skylabs-ai
Copy link

Do you have pointer? The original performance problem is that in one rocqdep call per file, rocqdep will still scan the whole user-contrib tree. This has a huge impact in practice, even in fast systems like Linux.

I can't find anything, but I thought I had seen something in that line.

If that wasn't the case, then perhaps coqdep should be fixed to scan it more lazily, or we should try to push for getting rid of user-contrib entirely.

@SkySkimmer
Copy link

coqdep called by dune (ie with -boot) should not be scanning all user-contrib but only the parts which are mapped to a declared dependency

@rlepigre-skylabs-ai
Copy link

rlepigre-skylabs-ai commented Nov 20, 2025

Are we actually certain that duplicating everything is the right option to support rocq? It seems to me like we could keep the same language but allow for an alias, and make the change more gradual? That being said, it looks like a lot of work went into this PR already. I'm just worried that it's gonna be supper hard to get this in.

@ejgallego
Copy link
Collaborator Author

Are we actually certain that duplicating everything is the right option to support rocq?

I am.

It seems to me like we could keep the same language but allow for an alias, and make the change more gradual?

I tried that, but it is actually quite complex, a lot of cases to handle, a lot of different tests, conditional arguments. The breakage is far from trivial.

That being said, it looks like a lot of work went into this PR already. I'm just worried that it's gonna be supper hard to get this in.

What is your worry?

ejgallego and others added 6 commits November 20, 2025 16:44
We introduce `(lang rocq)`, a build mode for the Rocq Prover,
previously known as "Coq".

The build mode is an exact copy of the `(lang coq)` mode, renaming the
modules, data, and some global declarations. Also, the default
implicit lib is now named `Corelib`.

(lang coq): should be considered deprecated / frozen, and eventually
removed.

There are many cleanups and improvements possible, these will be done
in later commits.

All of the tests have been ported and manually verified to work (a
time consuming process) As of today, all test pass.

The test suite has been tested against Rocq 9.1, with the `coq`
compatibility package added.

Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
For now a copy of Coq's one, with minor updates.

Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
Not needed anymore as Rocq dropped support for non-findlib loading.

Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
This is smaller than expected, we still need to pass the native
options and warnings due to upstream.

Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
Beware both `rocq c --config` and `coqc --config` still output `COQ*`
variable names.

Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
@rlepigre-skylabs-ai
Copy link

What is your worry?

My main worry is asking everyone to move to a new language, for what appears to me to be not a good reason. We'll basically ask people to modify every single of their dune / dune-project files, which seems annoying.

@ejgallego
Copy link
Collaborator Author

My main worry is asking everyone to move to a new language, for what appears to me to be not a good reason. We'll basically ask people to modify every single of their dune / dune-project files, which seems annoying.

They'll have to do that anyways due to the several improvements in Rocq mode, we would have introduced a new (lang coq ) version anyways, so IMHO bumping (lang coq 0.10) to (lang coq 0.11) is not too far from changing it to (lang rocq 0.11).

@ejgallego ejgallego force-pushed the rocq_lang branch 2 times, most recently from e5f5338 to 4ac917c Compare November 20, 2025 18:31
@ejgallego ejgallego marked this pull request as ready for review November 20, 2025 18:31
ejgallego and others added 3 commits November 20, 2025 19:41
Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
We remove the need for installing coqc shims, and adapt the test suite
accordingly.

There is one mayor caveat and one minor caveat:

- the major caveat is that in builds composed with Rocq, dune will
  only search for `rocq`, but we don't inject a dependency on
  `rocqworker` which is also needed, but a private binary. This means
  that users should ensure manually `rocqworker` is built when using
  composed builds. We hope to fix this soon, in a different PR.

- the minor caveat is that with `--display=short` we just now display
  the `rocq` name, not `rocq compile` or `rocq dep`. This can be also
  fixed in a different PR.

Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
Co-authored-by: Li-yao Xia <[email protected]>
Signed-off-by: Emilio Jesus Gallego Arias <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rocq support in dune

3 participants