Skip to content

Property and metamorphic test suite (2/4) - #24

Merged
Autoplectic merged 3 commits into
sofic-correctness-2from
sofic-property-tests
Oct 7, 2026
Merged

Autoplectic merged 3 commits into
sofic-correctness-2from
sofic-property-tests

Conversation

@Autoplectic

Copy link
Copy Markdown
Member

Stacked on #23 (base sofic-correctness-2); retarget to main once #23 merges.

Tests

tests/test_properties_*.py — property and metamorphic tests built on the sofic.testing strategies and tests/oracles.py:

  • Shifts: entropy, covers, Parry measure, SFT/TMC/sofic invariants; serialization round trips; viz output.
  • Generators/inference: word distributions vs brute force, ε-machine construction, anatomy identities, filtering/smoothing normalization, learners.
  • Automata: DFA/NFA operations and minimizers vs brute force, Büchi lassos, Wheeler order/index, VPA/NWA operations and decisions, transducers, active/passive learners.
  • Examples: every factory validates and satisfies its documented values.

Fixes the suite found

  • Fischer cover raises on reducible shifts instead of returning one terminal component; Parry measure drops transient states.
  • TikZ handles newlines in labels.
  • EpsilonMachine.from_hmm handles more than 26 causal states.
  • word_probability no longer returns 0 below 1e-15; conditional_word_probability no longer divides by zero there.
  • backward(normalize=True) normalizes the final row.
  • complete() no longer reuses an accepting trap left by a complement (double complement returned the wrong language).
  • reverse_is_finite decides finiteness of the reverse mixed states, which is sufficient but not necessary for a finite reverse ε-machine (alternating biased coins fails it with a 2-state reverse machine). New experimental reverse_epsilon_machine_is_finite() implements a merge-reachability criterion; from_time_reversed/to_bidirectional warn when numeric belief merging returns a truncation of an infinite reverse machine.
  • markov_order / is_definite document that they assume a minimal presentation.
  • YAML uses libyaml's C loader/dumper when available.

Gates

pytest -n 8: 1780 passed, 15 skipped. ruff check / ruff format --check clean. Fresh sphinx-build -W clean.

Adds tests/test_properties_*.py: shifts, generators, inference, automata
(DFA/NFA, Büchi, Wheeler, VPA/NWA, transducers, learners), serialization, viz
and examples, checked against brute-force oracles and invariants.

Fixes found by the suite: Fischer cover on reducible shifts, Parry measure
transient states, TikZ newlines, from_hmm beyond 26 causal states,
word_probability below 1e-15, backward(normalize=True) final row, complete()
reusing an accepting trap after complement. reverse_is_finite is documented as
mixed-state finiteness; experimental reverse_epsilon_machine_is_finite decides
the recurrent question, and reversal warns on numeric truncation. YAML uses
libyaml's C loader/dumper when available.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ryan James and others added 2 commits October 7, 2026 08:09
Two closed joint classes matched the forward/reverse marginals and tied on the
anatomy gap up to round-off; exact float comparison picked the wrong one on
x86-64 (E = 1.0 instead of the brute-force 1.5), failing CI on Linux and Windows.

Co-authored-by: Cursor <cursoragent@cursor.com>
The test matrix installed only the test extra, so every sympy-dependent test
was skipped. Install symbolic across the matrix, and keep a single Ubuntu job
without it so optional-dependency guards stay covered.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Autoplectic
Autoplectic merged commit 80a9030 into sofic-correctness-2 Oct 7, 2026
47 of 48 checks passed
Autoplectic added a commit that referenced this pull request Oct 7, 2026
Property and metamorphic test suite (2/4, landing #24 on main)
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