Skip to content

PropExpression: truth tables instead of BDDs for up to 6 atomic propositions - #159

Merged
leonbohn merged 1 commit into
mainfrom
perf/small-prop-expressions
Nov 9, 2026
Merged

leonbohn merged 1 commit into
mainfrom
perf/small-prop-expressions

Conversation

@leonbohn

@leonbohn leonbohn commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

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 added the performance Runtime or memory performance label Nov 9, 2026
@leonbohn
leonbohn merged commit fc17008 into main Nov 9, 2026
14 checks passed
@leonbohn
leonbohn deleted the perf/small-prop-expressions branch November 9, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Runtime or memory performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant