Skip to content

Only check for overlaps in pairs that we haven't already checked#13

Merged
james-d-mitchell merged 6 commits into
james-d-mitchell:improve-knuth-bendix-2-squashfrom
Joseph-Edwards:improve-knuth-bendix-2-squash
Apr 17, 2026
Merged

Only check for overlaps in pairs that we haven't already checked#13
james-d-mitchell merged 6 commits into
james-d-mitchell:improve-knuth-bendix-2-squashfrom
Joseph-Edwards:improve-knuth-bendix-2-squash

Conversation

@Joseph-Edwards
Copy link
Copy Markdown

This PR adds code that reduces the duplicated work the overlap iterator needs to do. The idea of the revised KnuthBendix is as follows:

  1. Initialise a counter to represent the generation.
  2. Initialise a trie with the initial relations, where each node of the trie stores the generation in which it was added.
  3. While the system is not confluent:
    3.1. Find and store all the critical pairs $(u, v)$ where at least one of $u$ or $v$ was added in the current generation.
    3.2. Increment the generation.
    3.2. Process the critical pairs and add any relevant rules.

In particular, this assumes that every pair of relevant critical pairs is found, processed, and added for each generation. If we stop the critical-pair-detection process halfway through a generation, process and add any new relations, and then try to find more critical pairs, we will miss some pairs. In this sense, we aren't quite able to do what we could with the cursors, but it's a step in the right direction.

I'm not at all set on the name generation and, given the semigroup context, I'd actually be quite keen to change it but I couldn't think of a good one.

@Joseph-Edwards
Copy link
Copy Markdown
Author

Unfortunately, this doesn't really seem to have the speed-up we thought it would @james-d-mitchell

@codecov-commenter
Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@james-d-mitchell james-d-mitchell merged commit 0f22316 into james-d-mitchell:improve-knuth-bendix-2-squash Apr 17, 2026
51 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants