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

fix ucanonicalization bugs #496

Closed
wants to merge 1 commit into from

Conversation

basil-cow
Copy link
Contributor

@basil-cow basil-cow commented Jun 6, 2020

some small bugs

@shepmaster
Copy link
Member

Is "ucanonicalization" a typo or a fancy compiler term?

@bjorn3
Copy link
Member

bjorn3 commented Jun 6, 2020

I think @Areredify means universe canonicalization.

@basil-cow
Copy link
Contributor Author

basil-cow commented Jun 7, 2020

@shepmaster bjorn3 is right, ucanonicalization stands for universe canonicalization: basically, after goal canonicalization (that replaces bound inference variables with their values) we do universe canonicalization that remaps universes to their "canonical" representation, so that if the same subgoal is encountered with slightly different universes, we can use cached result instead of recomputing it. Consider

goal {
   forall<T1> {
      forall<T2> {
          Implemented(S<T2>: Trait)
      }
   }
}


goal {
   forall<T1> {
      Implemented(S<T1>: Trait)
   }
}

These goals are almost the same, except when pursuing the Implemented subgoal, the first will look like Implemented(S<!2_0>: Trait) and second will look like Implemented(S<!1_0>: Trait). We, of course, want to reuse the first goal when proving the second goal because they are almost the same. After ucanonicalizing they will both look like Implemented(S<!1_0>: Trait) (or Implemented(S<!0_0>: Trait), don't remember which one is it), which allows for caching.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

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

Do you have an example of a regression test(s)?

@basil-cow
Copy link
Contributor Author

Uhh, sure

@basil-cow
Copy link
Contributor Author

Hmm, I am no longer sure that this is a bug

@basil-cow
Copy link
Contributor Author

closing in favor of #512

@basil-cow basil-cow closed this Jun 10, 2020
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.

4 participants