Skip to content
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

🐛🕳 Debug holes #14

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

🐛🕳 Debug holes #14

wants to merge 9 commits into from

Conversation

jonsterling
Copy link
Contributor

@jonsterling jonsterling commented Jul 13, 2022

Resolves #13

@jonsterling jonsterling changed the title Debug holes 🐛🕳 Debug holes Jul 13, 2022
@jonsterling jonsterling marked this pull request as ready for review July 14, 2022 08:11
@jonsterling
Copy link
Contributor Author

jonsterling commented Jul 15, 2022

So what is very strange is that the "bug" I fixed in 61c28eb seems to not be detectable...

Consider the following example:

def _ : univ -> univ -> univ := ?

The correct output is:

Unleashed hole _.0 : VirPi (TpULvl,    
                            VirPi (Univ Var 0,
                                   VirPi (Univ Var 1, Univ Var 2))) 

I would expect that before fixing the bug, it would have incorrectly printed the following output, since the goal quotation would be happening in the environment containing only the ambient level variable:

Unleashed hole _.0 : VirPi (TpULvl,    
                            VirPi (Univ Var 0,
                                   VirPi (Univ Var 1, Univ Var 0))) 

But nonetheless, it behaved correctly. What is going on?

Edit: In fact, the behavior remains the same even when I remove all the with_top_env!

@mmcqd
Copy link
Collaborator

mmcqd commented Jul 16, 2022

@jonsterling The behavior you're observing makes sense and is not a bug. First note that the two inner VirPis should be Pis, your printer just printed Pi as VirPi. In this example:

def _ : univ -> univ -> univ := ?

The goal is univ -> univ -> univ (not univ!) and the context contains only the blessed_ulvl. So quote_ctx gives the empty list, and with_top_env is actually a noop! The env is already the top_env. If you change the test to

def _ : univ -> univ -> univ = x => ?

Then the old code gives

Unleashed hole _.0 : VirPi (TpULvl,    
                            Pi (Univ Var 0, Pi (Univ Var 0, Univ Var 1))) 

Which is wrong in the way we would expect. The goal type is univ -> univ, which gets quoted in the top_env to

Pi (Univ Var 0, Univ Var 1)

With the new code, we get the correct result

Unleashed hole _.0 : VirPi (TpULvl,    
                            Pi (Univ Var 0, Pi (Univ Var 1, Univ Var 2))) 

This actually produces this error

Fatal error: exception Invalid_argument("result is Error _")

for unknown reasons lol, but it happens after the hole getting printed so it's not because of the aforementioned stuff.

@jonsterling
Copy link
Contributor Author

oh wow, you are so right!

Copy link
Contributor

@favonia favonia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Holes don't work
3 participants