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 associative-commutative relations and the use of term walk groundedness #27

Conversation

brandonwillard
Copy link
Member

ground_order doesn't really order terms in a way that avoids infinite recursion in term_walko (e.g. when called by the kanren.assoccomm goals). There should be a way to handle this—at least better than it currently does.

@brandonwillard brandonwillard self-assigned this Feb 24, 2020
@brandonwillard brandonwillard force-pushed the fix_term_walk_groundedness branch from c8e9668 to 99c1ed9 Compare February 24, 2020 23:40
@brandonwillard brandonwillard added the enhancement New feature or request label Feb 25, 2020
@brandonwillard brandonwillard force-pushed the fix_term_walk_groundedness branch from dd5d898 to 74f2332 Compare February 26, 2020 22:47
This comes along with a warning/clarification to the assoccomm relations.
They have always walked the first argument, which, when used with the
old `ground_order` would only account for improperly ordered terms when
the second argument was fully ground (and the first wasn't).  However, it
would perform this check repeatedly, incurring a full-traversal cost
on every iteration.  This inefficiency has been rectified.

The new "shallow" ground order should accomplish the same--and more--by
reordering according to "groundness" only at next level of traversal.
The assoccomm goals need to be updated so that they properly use this
shallow ordering, though.
@brandonwillard brandonwillard force-pushed the fix_term_walk_groundedness branch from 4863fda to b20dbb2 Compare March 5, 2020 03:16
@brandonwillard
Copy link
Member Author

brandonwillard commented Mar 6, 2020

I've recently added a new test (an expected failure) that demonstrates how poorly the assoccomm goals perform.

The test creates a decently sized term graph containing assoc-comm operators and another one that differs only at the top-level (i.e. one graph starts with an add operator and the other a mul). This should be no problem, since the two cannot unify from the start due to the operator discrepancy. However, due to the way the assoccomm goals descend into all permutations, it takes too long to fail.

@brandonwillard brandonwillard force-pushed the fix_term_walk_groundedness branch from 4718256 to 41bbebd Compare March 7, 2020 23:19
@brandonwillard brandonwillard force-pushed the fix_term_walk_groundedness branch from 41bbebd to 09a8618 Compare March 7, 2020 23:25
@brandonwillard brandonwillard changed the title Fix term walk groundedness Fix associative-commutative relations and the use of term walk groundedness Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant