Generalize incremental hom search to work for nonmonic matches and rules #72
+206
−49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The key computational challenge here is enumerating all epimorphisms.
The gist of this idea is that you work in an arrow schema, where the codom copy of the schema represents a set of equivalence classes for each part (but there are also morphisms between these sets equivalence classes - this is important for naturality!). We want to work up to isomorphism of the codomain but not the domain, so we add an attribute
_Fix :: Int
that bakes in the id of everything in the domain as real data.We initialize the tree search with the most refined partition, where the data in codom portion is identical to the data in the dom portion. The data in the domain portion never changes throughout the search, but we iteratively take pairs of equivalence classes and quotient them until we arrive at the terminal object.
Important for this complexity to not blow up is using the nauty hash, as pushouts are unique only up to isomorphism.