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

Unification function #19

Open
Lysxia opened this issue Jul 7, 2017 · 2 comments
Open

Unification function #19

Lysxia opened this issue Jul 7, 2017 · 2 comments
Labels

Comments

@Lysxia
Copy link

Lysxia commented Jul 7, 2017

Does unbound have a unification function? If not, does that seem like a good addition? To be precise, I'm looking for a function such that, given two terms t0, t1, finds a substitution s such that substs s t0 `aeq` t1, if it exists.

@lambdageek
Copy link
Owner

Unbound itself does not have a unification function. It is of course possible to write one over terms built up with unbound.

I suspect that a complete first-order unification algorithm probably doesn't belong within unbound-generics itself (for the reason that there are a fair number of extensions that people often want on top of plain vanilla first-order unification - residual constraints, various extensions to deal with limited forms of higher-order terms, etc). That said we can probably have more primitive operations in unbound for the kinds of things that first order unification algorithms may want to do with terms. (Or maybe some of our binding forms are useful but too slow - we should think about making them more effective)

I wrote a fairly generic first-order unification algorithm for a project that I worked on a couple of years ago (https://github.com/ppaml-op3/insomnia/blob/master/src/Insomnia/Unify.hs) and maybe that's a useful starting point for you? (Note that I represented unification variables distinctly from unbound's Names - that seemed like the right choice at the time). However, if I had to do it over again, I probably should have used unification-fd

@Lysxia
Copy link
Author

Lysxia commented Jul 8, 2017

Thanks for the helpful answer! I can get by with a simple solution for the moment, but those references will certainly be useful.

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

No branches or pull requests

2 participants