Open samuelgruetter opened 2 years ago
I think that this is a plain undecidable problem from grammar theory. We may be able to implement an approximation but given how the grammar engine works that's not going to be easy...
This might be really (too?) difficult to implement
No, it is trivial to implement, since Coq has to detect this conflict anyway during rule factorization. But for some reason, someone forcefully disabled the warning in 9847448b5f9dbf32806decf676f415d584a2cddb.
@silene this is incomplete, the factorization of camlp5 is just a heuristic.
Sure, but it would fix the above test case, wouldn't it?
I think that this is a plain undecidable problem from grammar theory.
It is true that deciding the equality of context-free grammars is undecidable in general. But Coq's grammar, even with user notations, is not arbitrary at all. Otherwise, we would not be able to recognize it with Camlp5 in the first place. So, the undecidability argument does not really apply.
I don't recall the discussion, but I think we deemed it was not very important, but for sure now that we have finished the refactoring the warning can be enabled again.
That refactoring was really a PITA!
This might be really (too?) difficult to implement, but even if it ends as a wontfix, I thought it might be at least worth suggesting it: It would be useful if Coq warned when one notation makes another notation unreachable, like in the following example:
The desired behavior would be that when defining (or even more importantly, when importing) the second notation, Coq warned that this shadows the first notation. Would that be possible?
Coq version: 8.15-rc1