-
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
Agda 2.6.4 RC1 fails to terminate type checking #6759
Comments
By manual bisection, the function whose type checking seems to loop is |
Not sure if it is related, but I noticed an error in debug printing:
agda/src/full/Agda/TypeChecking/Rules/Def.hs Lines 752 to 755 in 8c4f28a
|
With
Turning the body of Looks like the occurs checker is looping:
|
My bisection run says: 2af2ff1 is the first bad commit
But I am not sure this is right, need to verify. Ok, this commit is bad in the sense that it exhibits the loop, but is it the first? Another bisect from v2.6.3 to this commit confirms, yes. (Ping @jespercockx .) |
What is weird about this bisection result is that |
It actually does use instance arguments. See |
@martinescardo: I made the mistake to grep in Instance resolution has gone through a change, which is skimpily described in the changelog as follows: Lines 284 to 287 in 84b6bb2
More information can be found in the issue and the PR:
It seems that other libraries had to be changed to work with the simplified instance resolution, so maybe a "continues to work without changes" cannot be expected for developments that use instance arguments. |
@jespercockx : Do you have time to look at this issue? It is blocking the next RC... |
I could try to take a look, but could you post the file that you used for bisection? That'd be a lot easier than starting from the TypeTopology library. |
This example I could try to reduce. However, it is very strange. I tested the whole of What's more, regarding the issue here, a very similar short function occurs in another file with the same shape as this one, and no errors occur. |
@jespercockx Thanks! I put the files used for bisection up here: |
Comparing the debug output between 2.6.3 and 2.6.4, here is what I can make of the situation:
Writing this down and noticing that you are using |
Good news: my idea seems to fix the issue. After a few hours of staring at debug output, actually implementing the fix only took a minute. I've made a PR at #6796. |
I wonder if a better solution that attacks the problem at its root would be to provide a flag that disables the normalization heuristic in the occurs checker. This wouldn't cause any regressions (like my fix in #6759 doesn), but would allow users who care more about performance than about powerful inference to turn off the part that makes Agda's typechecker slow. |
@jespercockx wrote:
One could experiment with this and see how larger developments are affected. I have no intuition how often normalization is needed in practice in the occurs check. |
Thanks for fixing this issue! |
Without normalisation there is presumably a risk that Agda's behaviour could be more brittle: replacing one piece of code with something definitionally equivalent could make the code stop working. We use normalisation in Perhaps we could have a broader discussion about these things. My opinion is that, given that a non-trivial definitional equality is one of the defining features of this kind of type theory, we should try to make most features respect definitional equality. |
…abled (agda#6796) When --lossy-unification is enabled, we already lose the guarantee that we only throw an error when a problem is really unsolvable in favor of taking the "obvious" solution. In this case the "obvious" solution is to promote the meta even if it is in a flexible position, so that is what we do. Commits: * [ fix agda#6759 ] Promote flexible metas if --lossy-unification is enabled * [ re agda#6759 ] Address comments
Agda 2.6.4 RC1 with
TypeTopology
(https://github.com/martinescardo/TypeTopology) fails to terminate in the modulesource/Iterative/Ordinals.lagda
.The whole module is syntax-highlighted, using
agda2-highlight-level 'interactive
, so it is difficult to see where in the file the problem is occurring.The text was updated successfully, but these errors were encountered: