Skip to content

Leave subset pairs unexplored once a smaller set is met - #31

Merged
alexvbrdn merged 1 commit into
mainfrom
subset-drop-dominated-pairs
Nov 22, 2026
Merged

alexvbrdn merged 1 commit into
mainfrom
subset-drop-dominated-pairs

Conversation

@alexvbrdn

@alexvbrdn alexvbrdn commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What this changes

subset skipped a pair (x, Y) when (x, Y') had been met for some Y' ⊆ Y, but explored a pair queued before such a Y' was met. The sets of a state are met in the order of the words that reach them, not smallest first, so on a(a|b){n} ⊆ (a|b)*a(a|b){n} each of the 2^n sets met before the smallest was explored. A queued pair is left unexplored once its state has been met with a smaller set, which leads to every counterexample it leads to.

a(a|b){20} ⊆ (a|b)*a(a|b){20} takes 11 µs instead of 33 s, and the other benchmarked patterns of the family 13 to 470 times less time. The other subset benchmarks take up to 12% more time.

Checklist

  • cargo fmt --all --check and cargo clippy --all-targets -- -D warnings pass
  • cargo test and cargo test --no-default-features pass
  • New public items are documented
  • A test covers the change
  • CHANGELOG.md is updated under ## [Unreleased]
  • The change builds on Rust 1.88, or the MSRV bump is intentional and noted

`subset` skipped a pair (x, Y) when (x, Y') had been met for some Y' ⊆ Y,
but explored a pair queued before such a Y' was met. The sets of a state
are met in the order of the words that reach them, not smallest first, so
on a(a|b){n} ⊆ (a|b)*a(a|b){n} each of the 2^n sets met before the
smallest was explored. A queued pair is left unexplored once its state has
been met with a smaller set, which leads to every counterexample it leads
to.

a(a|b){20} ⊆ (a|b)*a(a|b){20} takes 11 µs instead of 33 s, and the other
benchmarked patterns of the family 13 to 470 times less time. The other
subset benchmarks take up to 12% more time.
@alexvbrdn alexvbrdn self-assigned this Nov 22, 2026
@alexvbrdn
alexvbrdn merged commit c33acab into main Nov 22, 2026
9 checks passed
@alexvbrdn
alexvbrdn deleted the subset-drop-dominated-pairs branch November 22, 2026 15:11
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.

1 participant