These have package visibility to test the law that for all Expr, the node they evaluate to is unique
These have package visibility to test the law that for all Expr, the node they evaluate to is unique
Apply the given rule to the given dag until the graph no longer changes.
apply the rule at the first place that satisfies it, and return from there.
ensure the given literal node is present in the Dag Note: it is important that at each moment, each node has at most one id in the graph.
ensure the given literal node is present in the Dag Note: it is important that at each moment, each node has at most one id in the graph. Put another way, for all Id[T] in the graph evaluate(id) is distinct.
After applying rules to your Dag, use this method to get the original node type.
After applying rules to your Dag, use this method to get the original node type. Only call this on an Id[T] that was generated by this dag or a parent.
Returns 0 if the node is absent, which is true use .
Returns 0 if the node is absent, which is true use .contains(n) to check for containment
Return the number of nodes that depend on the given Id, TODO we might want to cache these.
Return the number of nodes that depend on the given Id, TODO we might want to cache these. We need to garbage collect nodes that are no longer reachable from the root
This finds the Id[T] in the current graph that is equivalent to the given N[T]
This throws if the node is missing, use find if this is not a logic error in your programming.
This throws if the node is missing, use find if this is not a logic error in your programming. With dependent types we could possibly get this to not compile if it could throw.
Convert a N[T] to a Literal[T, N]