-
Notifications
You must be signed in to change notification settings - Fork 337
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
[ fix #6867 ] Only consider arguments with @0 for forcing if --erasure is on #6870
Conversation
063ec4a
to
480260b
Compare
10b3f82
to
73995fb
Compare
@jespercockx : The CI failure for the user manual could point to a real problem, try |
Consider me slightly annoyed by the fact that a missing newline was causing Sphinx to reject the file. Also, when I first pushed I ran |
This time I don't think it's my fault anymore:
and
|
I am at it, see |
@jespercockx wrote:
The former only checks the Agda content of the user manual, only the latter builds the docs. |
3f8a8ff
to
a4af9a5
Compare
…asure is on
a4af9a5
to
ac74325
Compare
Since 2.6.4 has been released, I will merge this soon unless there's any complaints. |
With your change in place the termination checker rejected some of my code. How does forcing interact with termination checking? Here is a test case: {-# OPTIONS --erased-cubical --erasure #-}
open import Agda.Builtin.List
open import Agda.Builtin.Unit
data D : Set where
c : List D → D
mutual
data P : D → Set where
c : ∀ xs → Q xs → P (c xs)
Q : List D → Set
Q [] = ⊤
Q (x ∷ _) = P x
mutual
F : ∀ x → P x → Set₁
F .(c xs) (c xs q) = G xs q
G : ∀ xs → Q xs → Set₁
G [] _ = Set
G (x ∷ _) p = F x p This code is rejected, but it is accepted if one of the following changes is made:
|
I'm not familiar enough with the termination checker to say for sure, but the only change that my patch introduces is that the |
Arguments with types like agda/src/full/Agda/Termination/TermCheck.hs Lines 503 to 507 in 1354c8a
agda/src/full/Agda/Termination/TermCheck.hs Lines 590 to 598 in 1354c8a
Furthermore, when agda/src/full/Agda/Termination/TermCheck.hs Lines 248 to 265 in 1354c8a
agda/src/full/Agda/Termination/TermCheck.hs Lines 405 to 423 in 1354c8a
It appears that without your change in place Agda does not treat My original code is more in the style of |
Ah I see. For forced arguments, there is some code that moves dot patterns internally to the forced position. So if the argument is forced, then internally the pattern instead becomes F (c xs) (c .xs q) = G xs q With my change, the argument to Ideally we would solve this by making the termination checker less sensitive to syntactic details such as the position of a dot pattern. However, this might be tricky in the case of Cubical Agda. |
This could be considered for 2.6.4.1. |
This implements my suggested fix for #6867: when
--erasure
is on, we only consider arguments to be forced if they have a@0
annotation. This is because forced arguments need to be reconstructible from the type, but the type lives at modality@0
.