Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record fields are not visible from outside the module if the record is universe polymorphic #402

Closed
ecranceMERCE opened this issue Nov 18, 2022 · 2 comments · Fixed by #404

Comments

@ecranceMERCE
Copy link
Collaborator

I try to declare the following record with Coq-Elpi in a module Test:

Record Rec : Type := BuildRec { f : Type }.
From elpi Require Import elpi.
Set Universe Polymorphism.

Elpi Command x.
Elpi Query lp:{{
  coq.env.begin-module "Test" none,
  Decl = record "Rec" {{ Type }} "BuildRec" (field [] "f" {{ Type }} (_\ end-record)),
  % @univpoly! =>
    coq.env.add-indt Decl _,
  coq.env.end-module _.
}}.

Print Module Test.
Check Test.f.

The Print command gives this:

Module Test := Struct
  Record Rec : Type := BuildRec { f : Type }.
  Definition f : forall _ : Rec, Type.
End

and the Check succeeds.

Now uncomment the option to make the record polymorphic and boom:

Module Test := Struct Record Rec@{u u0} : Type := BuildRec { f : Type }. End

The field f is not exported and the Check now fails.

cc @CohenCyril

@ecranceMERCE
Copy link
Collaborator Author

The bug is even present without opening a module. Actually, it is just that a polymorphic record declaration through Coq-Elpi does not export the fields.

Elpi Query lp:{{
  @univpoly! =>
    coq.env.add-indt (record "R" {{ Type }} "BuildR" (field [] "a" {{ Type }} (a\ end-record))) _.
}}.
Fail Check a.

(commenting the option makes the Check valid)

@gares
Copy link
Contributor

gares commented Nov 20, 2022

I guess the field (the projection) is not generated for some bug. The projection is a regular constant synthesized by coq, I guess it does not typecheck because of the bug....

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 a pull request may close this issue.

2 participants