-
Notifications
You must be signed in to change notification settings - Fork 10
Phase-1 matcher #483
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
base: main
Are you sure you want to change the base?
Phase-1 matcher #483
Conversation
a449c3b to
54ea9c3
Compare
54ea9c3 to
b716e46
Compare
Can you expand on this? This sounds like the current behavior (after #344) but maybe I am missing something. |
|
Mmh, you're right. That seems to be the current behavior as well. |
(This is still a bit off from merging. Posting here to describe some of the ideas and design decisions.)
This PR reimplements the matcher using a similar phase-1/phase-2 distinction we already internally use for type checking, utilizing uvars instead of substitions to represent the unifier. In the first phase we just run the unifier, and in only in the second phase do the actual type-checking and SMT queries happen. The API allows user code to skip the second phase entirely (it is returned as a continuation elaborator), so this new matcher can be used for the impure specs feature as well.
The new matcher is a lot stricter on mkeys; this is also with a future
pulse_patternfeature in mind.[@@@mkey]then effectively all arguments become mkeys. If the slprop is marked as[@@no_mkeys], then no arguments are mkeys. (I believe this is the current semantics, but not 100% sure.)For example, if you have a resource
x |-> 1and you need to solve fory |-> ?u, then this will reliably fail, even if you havepure (x == y)in the context. This is necessary because in the future we want to backtrack on this failure, and maybe insert a ghost lemma that turnsx |-> 1intoy |-> 1 ** trade (y |-> 1) (x |-> 1).Current state:
(fun a b c -> a) x y z(where the arguments are all local variables). I'm not sure why this happens, but it means we need to sprinkle a few more normalizer calls all over the place.Fixes #32.
Fixes #107.
Fixes #110.