Only allow universe level comparisons to fail with type-in-type#21531
Only allow universe level comparisons to fail with type-in-type#21531coqbot-app[bot] merged 6 commits intorocq-prover:masterfrom
Conversation
I'd say this always holds. |
|
The better question would be what to do with Type ≤ Prop ? |
|
This one should probably fail, even though that's not what we've been doing so far. Allowing this we can probably get into trouble with the rules for impredicativity, leading to SR breakage. It's not because we're inconsistent that we don't care about other good metatheoretical properties! |
|
I think we should disallow |
|
That should be what happens in this PR, and most errors in the test suite are due to this (some are due to Type ≤ SProp not holding) |
|
I don't really care about the tests but I'm mostly concerned about the legendary type-in-type development known as UniMath. Let's @coqbot run full ci |
|
Tested locally, Unimath compiles after the minor overlay (fixes a test) |
11123db to
3a5105b
Compare
|
This was in draft because it needs discussion, but it can actually still get reviewed at the same time. |
|
The changes seem desirable to me. There are probably a few places that are still behaving weirdly in the upper layers with type-in-type, but the kernel changes are a net improvement. |
|
I went over all calls to type_in_type in the codebase and hopefully made them all align with the new semantics. In practice, the only remaining calls are in UGraph and UState, the rest is all about printing whether the flag is set. |
|
3a5105b to
4a135b0
Compare
|
@JasonGross the lean importer will need some adaptation to this PR, not entirely sure how. One possibility is to have a new flag in rocq to unset the problematic checking elimination, separate from universe checking. @ppedrot suggested generating the recursor with guard checking off and a dummy unit argument, ie |
4a135b0 to
aed195a
Compare
|
I added a typing flag for backwards compatibility of plugins (it's not accessible from the outside). |
|
|
||
| type t | ||
|
|
||
| val set_ignore_constraints : bool -> t -> t |
There was a problem hiding this comment.
I know we already don't do that with UGraph, but I think this is an API defect: this function should be one-off, i.e. of type t -> t so that there is no way to go back to a state where we check constraints again. After setting it all hell breaks loose and invariants are obliterated.
There was a problem hiding this comment.
Hmm, should have turned my tongue seven times in my mouth: we do want to be able to set the flag locally, so no, the API is fine. That said I have no idea what it means in the semantics.
There was a problem hiding this comment.
I can't see it be worse than how type-in-type currently behaves, which is the best we can hope for.
|
@coqbot run full ci |
|
@coqbot merge now |
|
@ppedrot: Please take care of the following overlays:
|
Adapt to rocq-prover/rocq#21531 (stricter type-in-type)
Adapt to rocq-prover/rocq#21531 (stricter Type in Type)
Discussion is needed on what to do with Prop ≤ Type
Fixes: #20241 #20667
Related: #15270 #16620 #21351
Overlays