`#[primitive] HB.mixin` breaks the types of constants lifting mixin projections
Example:
From Coq Require Import ssreflect ssrfun.
From HB Require Import structures.
#[primitive]
HB.mixin Record AddMonoid_of_TYPE S := {
zero : S;
add : S -> S -> S;
addrA : associative add;
add0r : left_id zero add;
addr0 : right_id zero add;
}.
HB.structure Definition AddMonoid := { A of AddMonoid_of_TYPE A }.
Check addrA.
(*
addrA
: associative (AddMonoid_of_TYPE.add _ (AddMonoid.class ?s))
where
?s : [ |- AddMonoid.type]
*)
The type of addrA should be associative add.
Iirc there is a piece of code cleaning up the type. I guess it is broken if the primitive term constructors shows up
@gares Can you point out the part of the code declaring these constants and synthesizing their types? I have a rough idea of how to fix the issue.
clean-op-ty in structure.elpi is what I suspect messes up things.
https://github.com/math-comp/hierarchy-builder/blob/7d4f0958c37d6c006569892c742d7c7bb70279e1/HB/structure.elpi#L201-L237
Thanks. I believe that constructing the types of these constants from the declaration of the record type is much easier than doing so from the types of the projections. While the latter requires some replacements using copy (as we can see in clean-op-ty), the former should be just a matter of substitution.
I will take a closer look when I have some time.