-
Notifications
You must be signed in to change notification settings - Fork 637
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
Printing Notation regressed compared to 8.7 #6764
Comments
Small example: Set Primitive Projections.
Record foo := Foo { foo_n : nat }.
Notation "'■' x" := (foo_n x%type) (at level 50).
Goal forall (f:foo), ■ f = ■ f. With 8.7, this prints what I typed ( |
Ah, you're right. I thought the |
Yes, the problem is that notation matching is completely unaware of primitive projections. The input term to be matched is pretyped to a primitive projection and then back to a Either we need to handle specially primitive projections in notation matching, or we need to also generate a notation rule for applied primitive projections. I don't know which one is better. |
We adapt the notation term interpretation to mimic what the pretyper does for primitive projections, i.e. checking whether it is a fully applied constant refering to an expanded primitive projection. Hopefully this is sane enough not to break more notation uses.
I have a potential patch at ppedrot/coq@189528e but it breaks due to pretyping being stupid in the handling of
On @RalfJung's example I get a pretype error saying that the hole cannot be inferred. |
I didn't follow how the input |
But I'm a bit worried that some other parts of the code could distinguish the |
Ultimately, I think my local solution is the best as it tries not to introduce ad-hoc code. Whether this is sane or not w.r.t. bug preservation is another story. |
Good to see this work in making primitive projections better and better! I have a few comments.
Again, I have no idea about whether we have a common view on the meaning to give to the PS: In line 366 here, couldn't there be the case of a projection with a functional type and more arguments coming after the main argument? |
I'd be glad if @mattam82 gave a comprehensive description of the uses of that flag, actually.
Yes, I thought about it but I wondered whether one could get around that by using explicit parentheses? I don't remember if we collapse |
Actually, I'm lost. We have two representations of Actually, I'm not sure that I understand very clearly how to interpret a non-fully-applied projection, nor if we should keep an explicit representation for projections with all its parameters which is distinct from the optimized form. For instance, let's consider the following cases
(For the record, in today's master, it does not use a notation at all in either cases.) Otherwise said, shouldn't there be a difference between |
@herbelin I think that the compatibility layer is the source of all this fuss. There shouldn't be a confusion between the primitive projection and the corresponding constant. I understand this would be a problem for porting code to primitive projections, but at the same time in the long run it'd save us a lot of ultimately nonsensical questions. The current situation regarding
|
@ppedrot: So, is the approach that you're proposing the following:
|
I think it would be nice to have an option for Another open question is: Is there a way to make |
BTW, related question: would you like the notation Or is your question strictly only about the compactness of the representation of projections and not about the introduction/destruction/reduction/eta rules which are associated to the type, i.e. not about whether these projections are primitive in the logical meaning of "primitive" (i.e. with surjective pairing as eta, without a proper |
Actually, do we really need to keep types without a compact representation of projections? Is it correct that the only incompatibility (in the "compatibility" mode) is with tactics counting or unfolding subterms occurring in the parameters of a projection? Or maybe also sometimes in how types are inferred when the arguments of a projection are implicit? So, in a context where efficiency matters for scaling, the |
Let me rephrase things once more differently. There are basically three independent design choices to do for types equipped with projections:
Currently, 3. is independent of 1. and 2., and this is precisely the point of @RalfJung's question and of @maximedenes's #6651 to tie 3. to either 1. or to 2. Currently, demanding a compact representation in 2. is not the default and this is precisely the point of @JasonGross's #6609 to always adopt a compact representation (a priori independently of the degrees of freedom 1. and 3.). |
I have not thought about that. I was coming mostly from the performance stand-point -- the reason we use primitive projections is because it makes things measurably faster; if we can't even see in the surface syntax whether we are actually applying that optimization, that would be problematic and it would make performance issues harder to debug. |
I didn't manage to fix this in time for the beta, sorry about that. If we don't come up with a better with, one easy thing we could do for the final version is to unplug the construction of |
Fixes coq#6764: Printing Notation regressed compared to 8.7
Fixes coq#6764: Printing Notation regressed compared to 8.7
Fixes coq#6764: Printing Notation regressed compared to 8.7
Fixes coq#6764: Printing Notation regressed compared to 8.7
@RalfJung can you confirm that the Iris problems are solved? |
Indeed @RalfJung it would be good to know if additional problems with IRIS do exist in 8.9 and |
As confirmed on gitter, this fixes the biggest problem. Our test suite still failed because backtraces for Is there an issue tracking getting this backported into 8.9? |
Great @RalfJung , it should be scheduled for backporting due to the milestone. |
This was an API breaking change so this is why it takes longer to backport. |
I am going to reopen this issue until a fix lands in 8.9. @gares what's the status of the backport? |
I made an overlay for elpi I think I made a pr... Dunno if someone wrote the overlay file |
https://github.com/LPCIC/coq-elpi/tree/overlay/8456?files=1 sorry I made a branch, dunno for the overlay file |
@Zimmi48 @ejgallego is that enough to get a backport started? |
I think I messed up things, the commit is already part of coq-master. |
I made a coq-v8.9 branch on master, since master compiles fine with 8.9, and cherry picked there the commit. So the coq-v8.9 branch should compile fine when CProj is removed. I don't get exactly the before #8852 part. Are you saying that the docker image for v8.9 does not contain elpi 1.1.0 ? |
Exactly. |
The elpi update is supposed to be in the backport queue, right? |
It is still in the backport queue indeed. But @silene was hoping he could avoid backporting it. That's the sense of his comment and mine here: #8456 (comment) |
I don't how much relevant elpi is, but I've just released the first version of coq-elpi and I'd like it (and its minor releases) to work on 8.9. If CI can only test an old version of the code, then I think there is no value in keeping elpi in the CI for 8.9. If on the contrary the image gets updated I'll happily push to the coq-v8.9 branch each minor fix I do in master (as I do from time to time on coq-master). |
^^ indeed, this was my understanding of the coq-elpi situation for 8.9. Either you drop it or you update it. |
That's fine with me. |
#8456 has been backported. |
Confirmed, Iris notation tests now pass on the 8.9 branch. Thanks all :) |
Version
git master
Operating system
Linux
Description of the problem
In the
gen_proofmode
branch of https://gitlab.mpi-sws.org/FP/iris-coq/, printing notations regressed compared to Coq 8.7. This is visible for example intheories/bi/update.v
: What used to be printed as(|==> P) ⊢ P
is now printed as(sbi_bi PROP).(bi_entails) (|==> P)%I P
.The relevant notation
⊢
is defined intheories/bi/interface.v
:bi_entails
is a primitive projection, so #6651 could be related. Or maybe this is caused by one of the recent scope handling changes?The text was updated successfully, but these errors were encountered: