Skip to content

Declare structures, mixins and factories as primitive records by default - #613

Draft
mattam82 wants to merge 2 commits into
math-comp:masterfrom
mattam82:cs-primproj-default
Draft

mattam82 wants to merge 2 commits into
math-comp:masterfrom
mattam82:cs-primproj-default

Conversation

@mattam82

@mattam82 mattam82 commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Declare structures, mixins and factories as primitive records by default. Records are primitive unless #[primitive=no] is given.

Stacked on #612: the first commit is the one of #612; only the last commit is new here. tests/hnf.v.out changes because the parameter of the primitive projection f.y is now printed as _.

Do not merge yet: this is incompatible with the released versions of Rocq and rocq-elpi.

As a result, this PR's CI on the docker images of Rocq 9.1, 9.2 and 9.3 is expected to fail. It can be merged once HB requires a Rocq version with rocq-prover/rocq#22789 and a rocq-elpi release with LPCIC/coq-elpi#1143.

The proof scripts that depended on the non-primitive records in math-comp (math-comp/math-comp#1691) and analysis (math-comp/analysis#2181) are already adapted and work with both.

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
Records are now primitive unless #[primitive=no] is given.

tests/hnf: the parameter of the primitive projection f.y is printed
as "_".

Requires rocq-prover/rocq#22789.

Assisted by GenAI tools
@CohenCyril
CohenCyril marked this pull request as ready for review December 4, 2026 08:01
@CohenCyril
CohenCyril marked this pull request as draft December 4, 2026 08:02
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