Skip to content

Equivalence/inclusion of DPAs: build the product once and store its edges - #158

Merged
leonbohn merged 2 commits into
mainfrom
perf/single-product-equivalence
Nov 9, 2026
Merged

leonbohn merged 2 commits into
mainfrom
perf/single-product-equivalence

Conversation

@leonbohn

@leonbohn leonbohn commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Part of the Spot comparison work (#143).

What

  • Equivalence of deterministic parity/Büchi automata searched two products, one per direction (product_lasso(.., (true,false)).or_else(.. (false,true))). It now builds the product once and searches both acceptances on it.
  • The product used to be lazy, so every refinement round of cycles::search recomputed all edge labels (BDD intersections on propositional alphabets). product_lasso now explores the product once (explore_product) into an NTS and searches that.

Measurements (gungraun, instructions, cargo bench --bench dpa)

bench before after
language_equivalent normalized_50 1 027 292 626 880 (-39 %)
language_equivalent complement_50 181 950 166 412 (-9 %)
included_in normalized_50 496 301 339 497 (-32 %)
included_in complement_50 181 949 160 672 (-12 %)
witness_not_subset_of / witness_inequivalence same as above same as above

These benches use CharAlphabet; on propositional alphabets (BDD intersections) the saving should be larger. Not yet measured against Spot (benches/versus, needs the Python build).

Checks

cargo fmt, clippy (default/no-default/all), doc, cargo hack --each-feature, tests in all three configurations pass. scripts/check stops at the MSRV step here because the Nix toolchain has no rustup (cargo +1.88); the Python crate was not built or tested.

@leonbohn leonbohn added the performance Runtime or memory performance label Nov 9, 2026
leonbohn added a commit that referenced this pull request Nov 9, 2026
…sitions (#159)

Part of the Spot comparison work (#143); cheaper alternative to the BDD
backend switch (#156) for few propositions.

## What

`PropExpression` stores expressions over at most 6 atomic propositions
as a 64-bit truth table (`Repr::Table`), larger ones as `Bdd`
(`Repr::Bdd`). The representation is canonical (table iff `num_aps <=
6`), so the derived `Eq`/`Hash` stay correct. `&`, `|`, `!`, `overlaps`,
`intersection` and matching are bit operations; equality/hash are
integer operations; clones do not allocate. `from_parts`, `from_bdd`,
`into_bdd`, `to_hoa_label` and `Display` convert to and from BDDs, so
the public API is unchanged.

**Behavior change:** for tables, `sat_vals()`/`symbols()` yield symbols
in ascending raw order. The BDD iteration order is not a function of the
set (don't-care variables vary differently), so it could not be kept; no
test depended on it. Noted in CHANGELOG.

## Measurements (gungraun, instructions, `cargo bench --bench dpa`,
HOA-based fixtures)

| bench | before | after |
|---|---|---|
| normalized_fixtures ltl | 5 493 570 | 1 517 740 (-72 %) |
| normalized_fixtures synthetic | 21 767 464 | 10 076 508 (-54 %) |
| complement_fixtures ltl | 5 592 064 | 1 569 234 (-72 %) |
| complement_fixtures synthetic | 22 217 532 | 10 407 320 (-53 %) |
| witnesses_fixtures ltl | 4 937 378 | 2 261 062 (-54 %) |
| witnesses_fixtures synthetic | 94 085 634 | 19 684 166 (-79 %) |

Independent of #158; the effects should add up. Not yet measured against
Spot (`benches/versus`).

## Tests

New: `truth_tables_agree_with_bdds` (all functions over 2 and a sample
over 3 propositions: symbols, `!`, `|`, overlap, intersection, matching
against the BDD operations),
`expressions_over_many_propositions_use_bdds`. fmt, clippy, doc, `cargo
hack --each-feature` and tests in all three feature configurations pass;
`scripts/check` stops at the MSRV step (no rustup in the Nix shell); the
Python crate was not built or tested.
@leonbohn leonbohn removed the performance Runtime or memory performance label Nov 9, 2026
@leonbohn
leonbohn merged commit 067f8c2 into main Nov 9, 2026
15 checks passed
@leonbohn
leonbohn deleted the perf/single-product-equivalence branch November 9, 2026 23:03
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