-
Notifications
You must be signed in to change notification settings - Fork 37
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
Non deterministic pruning anomaly #101
Comments
I would need to investigate a bit more to tell you exactly why this error happens at compilation time, but the real problem is that your term contain expressions outside the pattern fragment, and Elpi does not like them. It usually tolerates them, so there is probably something buggy in your example (thanks for reporting), but you can hardly win if you play this game. May I ask what you are trying to use Elpi for? The fatal error says that Elpi will not prune unless the result is deterministic. It will not remove an eigenvariable from the arguments of a unification variable unless there is only one way of doing it, and stuff like |
I want to solve a set of constraints (that may fall outside the pattern fragment, but the same error occurs even with the Here is a more realistic example (the previous example was a simplification of the first two constraints):
The problematic constraint is the commented one. What surprises me further (since you say this is a compilation error) is that this sometimes works depending on where in the list of constraints I place the problematic one (for example it works if placed first or last in the list). I realize the proper way to do this is probably to use elpi's builtin constraint solver, but I haven't figured out how to use it yet :). |
I'm sorry the doc in ELPI.md is not very clear, but you can write With this declaration it fails (I have no clue if the result is OK, but at least it does not abort):
|
Sorry, I was not running
but if I just give
then the result is the expected one, I guess:
|
OK, this says sucess:
You can look at a "readable" trace by running (a.elpi is the file)
|
Thanks for pointing this out!
with
|
I see. Something still escapes me, but this one
works |
Anyway, sooner or later terms outside the pattern fragment are going to give you problems. |
I found the following trick, which works very nicely for me:
Basically, I externally inspect the terms, and replace applications of the form
It is also interesting to reverse the order of the constraints so that
Thank you for your help! |
I think you found a very lightweight encoding to work around the limitations of Elpi. Bravo! |
FTR: Your pattern_args is not 100% correct, all arguments must be names, but also distinct. I should really provide a builtin for that check. (Maybe it's not needed in your case because input terms are already validating that condition). |
While trying to write a unifier to solve problems such as
I get the error
Why does this happen without even having defined
unif
?The simpler example
((foo Y), (foo (X Y)))
similarly giveselpi version is 1.13.1
The text was updated successfully, but these errors were encountered: