Description
Our fixed-point computing relation graph_applyo
could be slower than necessary for a subset of problems that don't use its full relational capabilities (e.g. simply finding the unique fixed-point reduction/normal form of a ground term graph).
We could update the relevant relations (or make complementary ones) that take into account the groundedness of their terms and confluence of the rewrite rules. For instance, if the term to be reduced is completely grounded, the reduced term is simply a logic variable (i.e. we're simply asking for the reduction of a ground term graph), and the rules are confluent (or we're willing to assume they are), then we can use a short-circuited cond*
and avoid evaluating unnecessary goals—all without necessarily violating relation-ality. Since this is easily our primary use case, it's probably worth the effort.
The first roadblock I see in the approach above involves checking for groundedness. We can always create a relation that assumes as much, but we could also start tracking the logic variables in a meta graph/etuple
(and potentially use that info for other things, as well).
Broadly, we could address some more basic performance concerns with tabling and/or memoization, too.
Originally posted by @brandonwillard in #13 (comment)