New unsafe pass to extract inductives to arbitrary constants#1238
Merged
mattam82 merged 1 commit intoMetaRocq:9.0from Feb 13, 2026
Merged
New unsafe pass to extract inductives to arbitrary constants#1238mattam82 merged 1 commit intoMetaRocq:9.0from
mattam82 merged 1 commit intoMetaRocq:9.0from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It allows to remap constructors to arbitrary kernames and the eliminator to a specific kername. The eliminator is applied to: the discriminee, then all branches in order, where each constant branche
bis delayed usingfun _ -> lift 1 0 b.For e.g. CertiCoq's backend to work with this (https://github.com/CertiCoq/certicoq/blob/b7f62a11e4f3f368307185d048cb2ea2f48c3497/theories/Compiler/pipeline.v#L26), one must declare the kernames first as axioms (in Rocq) of the right arity, and the use the Extract Constant machinery to map them to C code. The rocq-verified-extraction backend is more lenient I think (does not need to computer arities). The MetaRocq compilation pipelines should, I guess, enforce the dependency of the term to erase to contain these axioms somehow, so that they don't disappear at the erasure phase. I'm not sure how to interface that cleanly. For the Agda/Lean frontends they just need to have these constants in the global environment they produce for this to work I guess.
Supersedes #1237