Skip to content

Support structures, mixins and factories declared as primitive records - #612

Open
mattam82 wants to merge 1 commit into
masterfrom
cs-primproj
Open

mattam82 wants to merge 1 commit into
masterfrom
cs-primproj

Conversation

@mattam82

@mattam82 mattam82 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #610

Support structures, mixins and factories declared as primitive records. Records are still non-primitive unless #[primitive] is given; this makes the ones declared with it usable as the others:

the terms HB declares use folded primitive projections, like the ones elaborated by Rocq (fold-projections, applied in log.coq.env.add-const*) (unfolded projections come from applying a delta step to a folded one);
parametrized mixin-src clauses typecheck the mixin argument which is necessary to fill in the types of primitive projections;
mixin-for, the non-forgetful inheritance check and HB.pack recognize a sort projection in its primitive form and not only as a constant.
This is the overlay for rocq-prover/rocq#22789, which makes canonical structure inference and unification treat all forms of a primitive projection alike. It does not activate #[primitive] which would otherwise break compatibility.

With rocq-prover/rocq#22789, canonical structure inference and
unification treat all forms of a primitive projection alike, so that
the records declared with #[primitive] can be used as the other ones:
- the terms HB declares use folded primitive projections, as the ones
  elaborated by Rocq (fold-projections, applied in log.coq.env.add-const*);
- clean-op-ty also rewrites operations used as primitive projections;
- parametrized mixin-src clauses typecheck the mixin argument;
- mixin-for, the non-forgetful inheritance check and HB.pack recognize a
  sort projection in its primitive form.

Records are still non-primitive unless #[primitive] is given.

Assisted by GenAI tools
@mattam82
mattam82 marked this pull request as draft December 4, 2026 10:55
@mattam82
mattam82 marked this pull request as ready for review December 4, 2026 10:55
@mattam82
mattam82 marked this pull request as draft December 4, 2026 17:47
@mattam82
mattam82 marked this pull request as ready for review December 4, 2026 17:47
@CohenCyril
CohenCyril marked this pull request as draft December 4, 2026 21:15
@CohenCyril
CohenCyril marked this pull request as ready for review December 4, 2026 21:15
@CohenCyril
CohenCyril marked this pull request as draft December 4, 2026 21:19
@CohenCyril
CohenCyril marked this pull request as ready for review December 4, 2026 21:19
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