Skip to content

[experiment] Special handling of root node in AcyclicGraph algorithm#22014

Draft
ppedrot wants to merge 4 commits intorocq-prover:masterfrom
ppedrot:acyclic-graph-explicit-root
Draft

[experiment] Special handling of root node in AcyclicGraph algorithm#22014
ppedrot wants to merge 4 commits intorocq-prover:masterfrom
ppedrot:acyclic-graph-explicit-root

Conversation

@ppedrot
Copy link
Copy Markdown
Member

@ppedrot ppedrot commented May 10, 2026

The most expensive kind of level constraint in the current algorithm is of the form "enforce u ≤ Set". Indeed the forward pass has to crawl basically the whole graph starting from Set, as all levels are above Set. This is the worst case for the complexity of our variant of of the Tarjan algorithm, which expects the graph to be sparse. Unfortunately, in practice such constraints seem to be commonplace in universe-polymorphic code.

To work around this issue, in this PR we try to handle Set in a special way by not storing it in the graph as a normal node. Instead we assume "Set ≤ u" implicitly everywhere, and we only keep a set of constraints "Set < u". We still have to perform a kind of forward pass to merge a level with Set, but we do so hopefully efficiently by leveraging the topological order maintained by the algorithm. We add in particular a map to quickly access nodes by their topological index.

@ppedrot ppedrot added request: full CI Use this label when you want your next push to trigger a full CI. kind: experiment labels May 10, 2026
@coqbot-app coqbot-app Bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label May 10, 2026
@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented May 10, 2026

@coqbot bench

@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented May 10, 2026

@SkySkimmer the bench died with a weird error in an unrelated script... Any idea what went wrong?

@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented May 10, 2026

Let's retry: @coqbot bench

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.

1 participant