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

Declare compatibility constant as canonical gref for primitive projections #790

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

Tragicus
Copy link
Contributor

@Tragicus Tragicus commented Mar 4, 2025

As of now, we can not obtain a gref out of a primitive projection, although the compatibility constant is a canonical gref associated to it. This is useful when we want to turn a term into a cs-pattern (although I guess I could also add a clause to the latter predicate).

@gares
Copy link
Contributor

gares commented Mar 4, 2025

There is primitive-projection? already. The code is a bit different, and the documentation I wrote is not good.
I think it does what you want but only if the projection is also flagged as canonical.

Either you can close this PR and use the existing API (if it works for you) or we find a way to merge the two.

@Tragicus
Copy link
Contributor Author

Tragicus commented Mar 4, 2025

I missed primitive-projection?, thank you. The point is that I want for it to be used in term->gref.

@@ -510,6 +510,7 @@ coq.term->gref (global GR) GR :- !.
coq.term->gref (pglobal GR _) GR :- !.
coq.term->gref (app [Hd|_]) GR :- !, coq.term->gref Hd GR.
coq.term->gref (let _ _ T x\x) GR :- !, coq.term->gref T GR.
coq.term->gref (primitive (proj Proj _)) GR :- !, primitive-projection? Proj GR.
Copy link
Contributor

@gares gares Mar 4, 2025

Choose a reason for hiding this comment

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

Suggested change
coq.term->gref (primitive (proj Proj _)) GR :- !, primitive-projection? Proj GR.
coq.term->gref (primitive (proj Proj _)) (con C) :- coq.env.primitive-projection? Proj C, !.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am surprised I did not see any error. Is it not const instead of con?

@gares gares merged commit 5cd165a into LPCIC:master Mar 4, 2025
86 of 89 checks passed
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.

2 participants