-
Notifications
You must be signed in to change notification settings - Fork 339
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
Standard library Data.Nat.DivMod
fails with cubical error, even though no --cubical
is used
#5611
Comments
Someone could design a way to get a better error message when this check fails. |
Here's a fixed variant of the code: /-mono-≤ :
∀ {m n o p} .⦃ _ : NonZero o ⦄ .⦃ _ : NonZero p ⦄ →
m ≤ n → o ≥ p → m / o ≤ n / p
/-mono-≤ {m = m} {n = n} {o = o} m≤n o≥p = helper o≥p refl
where
helper :
∀ {o′ p} .⦃ _ : NonZero p ⦄ →
o′ ≥ p → o ≡ o′ → m / o ≤ n / p
helper (s≤s o≥p) refl = divₕ-mono-≤ 0 m≤n o≥p |
As I wrote this particular piece of code a few months back, I'm a bit confused about what is wrong with it. I take it from the discussion, that Agda 2.6.3 is more strict about irrelevant arguments in some manner? But why is it throwing a |
You can get more information by using agda/src/full/Agda/TypeChecking/Irrelevance.hs Lines 384 to 394 in d8145b9
However, the variable |
Code that uses |
Wow, so when you use |
There's the discussion in #5266 |
Switching back to here, in agda/agda-stdlib#1614 @gallais writes:
Which I strongly agree with! The code as is, isn't "wrong" per se right? It's that the new check introduced in feb4fe4 isn't granular enough? At the very least, @Saizan is right that we need a better error message. Ideally one without cubical code in, but at the very least one which says which modality is the problem? |
This check was introduced to address problems related to By the way, is irrelevance known to be compatible with Cubical Agda? |
There might be some devil in the details, since no one explicitly looked into it afaict, but it would make sense in the cubical sets model as a strict version of propositional truncation, which is known to work. The The check is required for Types are however Maybe we can make --experimental-irrelevance not --safe with --without-K ? |
I don't think |
Here is the check that @Saizan added: agda/src/full/Agda/TypeChecking/Coverage/Cubical.hs Lines 881 to 887 in feb4fe4
I set the relevance part of @Saizan, what is the status of your changes related to inductive families? You put them on the
agda/src/full/Agda/Interaction/Options/Base.hs Lines 348 to 367 in 2976b59
|
The status is still as described in #3733, the inductive families can be used but there's interactions with termination and positivity checking that are not resolved, meaning those checks are likely accepting definitions that should not be. It did not get any worse than 2.6.2, though fewer people might have been inclined to use inductive families with cubical before these changes. |
@Saizan wrote:
Turning on those checks should be fairly easy, right? However, I guess that we might get more problems like that discussed in this ticket. Have you tried this? @MatthewDaggitt wrote:
The idea is that it should be possible to import code that uses |
Doing just the naive thing of letting termination and positivity check look at the extra generated clauses I was getting a lot of rejected definitions in the standard library, so that doesn't seem advisable without more work put into improving the checks. |
@andreasabel, what do you think? |
I have not followed the discussion, maybe this is something for the next dev meeting. Even if we release 2.6.2.1, we can still release 2.6.3 at any time suitable (even on the same day, if you will). However, I think that if we release 2.6.3 now, we might soon have to re-release because of #5659. So I think I prefer releasing 2.6.2.1 now with a more conservative feature set, and release 2.6.3 soon (after maybe a bit more testing). |
I tried to replace this code with the following code (more or less as discussed above, except that I suspect that the last time I only changed the second definition of let mod =
setRelevance Irrelevant $ -- See #5611.
getModality $ fromMaybe __IMPOSSIBLE__ $ scTarget old_sc
-- we follow what `cover` does when updating the modality from the target.
applyModalityToContext mod $ do
unlessM (asksTC hasQuantity0) $ do
reportSDoc "tc.cover.trxcon" 20 $ text "testing usable at mod: " <+> pretty mod
addContext cTel $ usableAtModality mod rhs With this change the master branch of the standard library is accepted. @Saizan, does this look fine to you? In that case I'll prepare a pull request. The change leads to error messages involving irrelevance, even if no irrelevance is used. For instance, for
The new error message includes
The error message reflects what is going on, so that is perhaps fine. |
Lifted from #5605 (comment):
I suppose this is a regression in 2.6.3, because the
master
of the std lib is supposed to build with 2.6.2.The text was updated successfully, but these errors were encountered: