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

Adapting to Coq PR #14598: adding explicit constr_expr/glob_constr node for projections #274

Conversation

herbelin
Copy link
Contributor

This PR adds code for the new node GProj. So that the examples involving the syntax t.(f) continue to work, I did not try to do better than simulating what was done when t.(f) was encoded with a GApp node, leading to reuse in_elpi_appl rather than, say, adding a new in_elpi_proj method.

Also adapting to lighter syntax of CAppExpl and CApp.

This has to be merged synchrounously with coq/coq#14598.

@@ -182,7 +182,11 @@ let rec gterm2lp ~depth state x =

| GEvar(_k,_subst) -> nYI "(glob)HOAS for GEvar"
| GPatVar _ -> nYI "(glob)HOAS for GPatVar"
(* | GProj _ -> nYI "(glob)HOAS for GProj" *)
| GProj ((ref,us),args,c) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure: is this node just about the projection syntax? (because I now have a way to represent primitive projections)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of coq/coq#14598, GProj strictly corresponds to the t.(f args) syntax. However, it is not clear to me what will then be the consensus about the role to give to the GProj, whether it matches CProj (i.e. the t.(f args) syntax) or the Proj kernel syntax (i.e. the "primitive" projections), or if t.(f args) and kernel-primitive get eventually identified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For instance, in coq/coq#14598, pretyping map GProj to Proj when the projection is registered as primitive and to App if not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I don't know what it implies for elpi. I guess it depends if the elpi way to represent primitive projections is about kernel Proj or about t.(f args).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For instance, in coq/coq#14598, pretyping map GProj to Proj when the projection is registered as primitive and to App if not.

ok, then I'll try to push a commit on top of yours

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I need #256 to go in first, then I'll rebase this one and add a few lines to it

… node.

Also adapting to lighter syntax of CAppExpl and CApp.
@gares gares force-pushed the coq-master+adapt-coq-pr14598-adding-proj-syntax-constructor branch from 8596213 to 60e535d Compare July 23, 2021 15:26
@gares
Copy link
Contributor

gares commented Jul 23, 2021

rebased, but I don't have the time to write down the code contracting a primitive projection today. I'll do it next week

@gares
Copy link
Contributor

gares commented Jul 24, 2021

done. I made:

  • x.(p) -> primitive (is p is a prim proj)
  • p x -> regular projection even if p is the compat constant
  • x.(@p params) -> regular

I'm not 100% sure about the last one, but tossing away something the user wrote seems wrong.

@herbelin
Copy link
Contributor Author

I'm not 100% sure about the last one, but tossing away something the user wrote seems wrong.

I'm not sure either. For instance, as of now, it is not forbidden to explicitly give the parameters of primitive projections.

Set Primitive Projections.
Record T A := {a:A}.
Check fun x => x.(a nat).
(* fun x : T nat => a _ x *)

@gares
Copy link
Contributor

gares commented Jul 24, 2021

That, in the code I wrote, would result into its compat constant(in elpi). The idea is: if you pass the params, the you are not talking about the primitive one. I don't know yet if this is a good rule.

@ppedrot
Copy link
Collaborator

ppedrot commented Aug 5, 2021

Please merge.

@gares gares merged commit 0a59948 into LPCIC:coq-master Aug 6, 2021
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.

None yet

3 participants