Repository navigation
Add sofic.algebra: Krohn-Rhodes theory, holonomy decomposition, and DeDeo (2011) tools - #33
Merged
Merged
Conversation
Transformation semigroups, Green's relations, syntactic monoids and star-freeness, the holonomy decomposition as a verifiable cascade product, Krohn-Rhodes complexity bounds and prime factors, and hooks on automata, unifilar HMMs / epsilon-machines, and sofic shifts. Following DeDeo (2011): effective theories from truncated cascades, random-map representations of probabilistic automata, walks over semigroup elements, and an irreversibility / dissipation information split. Also language varieties, minimal ideals and synchronization, Schutzenberger groups, and belief-map semigroups of HMMs. Co-authored-by: Cursor <cursoragent@cursor.com>
Compute holonomy group orders and recognize T_n by closing small permutation groups directly, falling back to sympy only for very large groups. Skip the tests that need sympy group objects when it is not installed. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
sofic.algebra, a new subpackage for Krohn-Rhodes theory on any deterministic presentation in sofic: DFAs, unifilar automata, unifilar HMMs / ε-machines, and sofic shifts.Core
TransformationSemigroup: enumerated only when needed, a shortest word for every element, a size cap, and aSINKstate to complete partial maps.syntactic_monoid,is_star_free, and language varieties: piecewise testable, locally testable, definite, group, and commutative languages.holonomy_decomposition(Egri-Nagy & Nehaniv), computed from the generators alone. ItsCascadeProductchecks that it emulates the original machine.krohn_rhodes_complexity, returningComplexityBounds(lower, upper, exact), andprime_decomposition.transition_semigroup()/krohn_rhodes_complexity()on automata,MealyHMM, andSoficShift. New shift invariantsfactor_syntactic_monoidandfactor_krohn_rhodes_complexity. Wheeler-presentation failures now say whether the language is star-free.DeDeo, "Effective Theories for Circuits and Automata" (Chaos 2011)
effective_theory(k)/CascadeProduct.truncate(k): coarse-grained machines on overlapping superstates. This reproduces Fig. 4b, using Fig. 4a rebuilt from the arXiv TeX source.independent_random_maps(Eq. 2),coupled_random_maps(correlated failures), andrandom_maps: probabilistic automata rewritten as random choices of deterministic maps.element_walkandclassify_elements, which reproduce Figs. 5, 6, and 8. In Fig. 8 the walk on A_4 has period 3, so it is uniform only when averaged over a period.walk_information: splits the information lost about the initial state into irreversibility and dissipation. This split is original and uncited.Other
holonomy_information: splits C_mu across the holonomy levels. Original, uncited.projective_semigroup/mixed_state_semigroup: belief-map semigroups of HMMs.Limitations
projective_semigroupenumerates up to a cap. When it closes, that proves finiteness; hitting the cap is inconclusive.Test plan
uv run pytest: 2169 passed, 17 skippedtests/test_algebra_*.py: hypothesis properties (cascade emulation, truncation commutes with every input, Green's classes partition, the information split adds up) and known values (T_n, Z_n, Egri-Nagy & Nehaniv Examples 7.1 and 7.2, DeDeo figures)ruff check,ruff format --check,ty(clean on new code), module doctests-j autobuild hits an unrelated EOFError)