Skip to content

Finish WP5 of #143: Python extras, Spot differential tests, bug fixes - #150

Merged
leonbohn merged 13 commits into
mainfrom
python-finish-spot
Nov 9, 2026
Merged

leonbohn merged 13 commits into
mainfrom
python-finish-spot

Conversation

@leonbohn

@leonbohn leonbohn commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Finishes WP5 of #143 and adds differential tests against Spot (WP6); the bugs these tests found are fixed here.

Python bindings

  • to_dot() / _repr_svg_() for all classes (new DotStyle impls in Rust for DCA, DRA, DSA, DMA, the other parity variants and the nondeterministic classes).
  • Exact dualities: DBA.complement() -> DCA, DCA -> DBA, DRA <-> DSA (pairs swapped), DMA.complement(). DBA.streamlined().
  • Docs: Python section in the README, python/README.md (classes, HOA support, install from GitHub: pip install "git+https://github.com/leonbohn/automata#subdirectory=python"), python/ paragraph in CLAUDE.md. The PyPI release workflow is not used for now.

Differential tests against Spot

  • python/tests/test_spot_*.py (marker spot, skipped without Spot): HOA round trips, emptiness + witness, inclusion/equivalence with counterexamples, complement, conversions, on the benchmark fixtures and spot.randaut inputs; test_finite_words.py (no Spot) for DFA minimize / NFA determinize. ~25 s.
  • .github/workflows/python-spot.yml runs them in the flake's dev shell (manual, weekly, and on PRs touching src/automaton, src/ts/operations, src/hoa, python). Untested so far.

Bugs found by the tests (fixed, one commit each)

  • Products over PropAlphabet only paired edges with equal expressions, losing transitions: wrong Inclusion/Equivalence, DPA::prefix_partition, DFA union/intersection. Breaking for implementors of Expression: new required method intersection.
  • The HOA reader dropped state-based acceptance (State: 0 {0}).
  • DPA::give_rejected_word returned None for components reached via smaller priorities.
  • DFA/Moore/Mealy minimize kept unreachable states; it now removes them (states numbered in BFS order, initial = 0). Benchmark results for minimization may change.

Known

  • Parity edges without a color still raise AcceptanceError (one remaining xfail).

Checked with ./scripts/check (without the MSRV step) and 1326 pytest tests.

@leonbohn
leonbohn merged commit 9dd3bba into main Nov 9, 2026
14 checks passed
@leonbohn
leonbohn deleted the python-finish-spot branch November 9, 2026 16:13
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