Skip to content

New unsafe pass to extract inductives to arbitrary constants#1238

Merged
mattam82 merged 1 commit intoMetaRocq:9.0from
mattam82:9.0-unsafe-ind-map
Feb 13, 2026
Merged

New unsafe pass to extract inductives to arbitrary constants#1238
mattam82 merged 1 commit intoMetaRocq:9.0from
mattam82:9.0-unsafe-ind-map

Conversation

@mattam82
Copy link
Member

@mattam82 mattam82 commented Feb 13, 2026

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 b is delayed using fun _ -> 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

@mattam82 mattam82 merged commit b24b884 into MetaRocq:9.0 Feb 13, 2026
3 checks passed
@mattam82 mattam82 deleted the 9.0-unsafe-ind-map branch February 13, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant