subttle / regular

Finite Automata and Regular Expressions for Regular Languages in Haskell
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link

Transition Monoid for DFA? #9

Open subttle opened 5 years ago

subttle commented 5 years ago

Is there a good way to represent the transition semigroup/monoid for DFA? I can think of a way to put all the induced functions q → q into a list for a given DFA q s but I'm not sure that would be helpful just yet.

This could come in handy for that later:

transition ∷ (Finite q, Finite s) ⇒ DFA q s → s → (q → q)
transition (DFA δ _ _) σ = \q → δ (q, σ)

transitions ∷ (Finite q, Finite s) ⇒ DFA q s → [s] → (q → q)
transitions m w = \q → delta' m (q, w)
subttle commented 5 years ago

TODO: consider Endo's instances for Semigroup and Monoid.