Repository navigation
re #5448: check that clause target type is usable at modality - #6236
Conversation
|
I've optimistically put this in the 2.6.3 milestone, in the hopes that there's enough time to sneak it in. But don't let it hold anyone up. |
nad
left a comment
There was a problem hiding this comment.
Great!
The current text in the changelog that describes the new flag --cubical-compatible should also be updated, perhaps along with some text in the user manual.
|
@Mergifyio rebase |
|
(need a CI run with new std-lib commit to make sure nothing is broken) |
✅ Branch has been successfully rebased |
491c712 to
c0a0615
Compare
|
|
||
| Note: when --without-K is enabled, the target type must be usable | ||
| at the modality in which the function was defined, since it is used | ||
| to compute substitutions in Cubical Agda. |
There was a problem hiding this comment.
I think we should avoid mentioning Cubical Agda in the error message for --without-K. When --without-K is used we do not actually "compute substitutions in Cubical Agda", so the text might be misleading. Note that I'm currently not aware of anything that would go wrong if we removed this restriction for --without-K. However, the proof sketch that we use to motivate the current implementation suggests something like this restriction, and the proof sketch is for a language with cubical features.
By the way, what does "the modality in which the function was defined" mean?
There was a problem hiding this comment.
It's the attribute attached to the function's name:
@0 subst : (A : Set) (@0 : A → Set) {x y : A} → x ≡ y → P x → P y
subst ... = {! P x has to be usable @0 !}Anyway, I can't think of a good wording for the Note: in the --without-K case, and I don't want to skip the check entirely because it contradicts "--cubical-compatible = --without-K + internal cubical code generation", since --cubical-compatible would (by design, rather than by a bug) reject more programs than --without-K
There was a problem hiding this comment.
How about because in univalent type theory, substitution is computed by cases on the predicate?
There was a problem hiding this comment.
How about
because in univalent type theory, substitution is computed by cases on the predicate?
That may or may not be true, depending on how "univalent type theory" is defined.
Perhaps we can just skip (parts of) the explanation when --without-K is used.
andreasabel
left a comment
There was a problem hiding this comment.
Thanks, awesome!
Great if you can change the printing of relevances in the error message.
... so that the irrelevance modality isn't confusable for punctuation anymore. Also fixes up punctuation in the error message
11a8b3a to
12c3f44
Compare
andreasabel
left a comment
There was a problem hiding this comment.
Wow, that looks awesome!!
Implements the check for #5448, which at current
masteronly happens with the--cubical-compatibleflag, eagerly (during LHS checking).Because of how
transpXclauses are generated (they use the RHS type, though with the unification substitutions represented as paths, in a relevant argument), checking that the RHS type is usable at the required modality will reject exactly the same definitions that--cubical-compatiblewould. With the benefit that the user doesn't have to see internal Cubical Agda code.Consider:
The error you get with
--without-Kis as follows. When--cubicalis used, the note mentions "used for computing transports" and "in Cubical Agda" more specifically, and--cubical-compatiblehas yet a third wording.