Fork me on GitHub
#off-topic
<
2018-06-27
>
Drew Verlee18:06:00

in a state machine, can the states always be reduced such that they are unique? To give some context, i’m having to write some if else logic and i’m curious if its always possible to reduce it so that the results of the branches are always unique, which i feel the above statement might be a formal way of expressing.

tbaldridge18:06:43

it depends how you define "unique"

tbaldridge18:06:06

I think you could have two states with duplicate logic, but with differing "next" states.

tbaldridge18:06:47

But it seems like you could de-dup based on a combination of decision logic and output edges

hiredman19:06:33

you may want to check out finite state transducers

hiredman19:06:26

finite state transducers add "outputs" to finite state machines

hiredman19:06:14

so state s1 getting event e1 and transitioning to s2 can have a different output from s3 getting event e1 and transitioning to s2

hiredman19:06:40

a state machine is a graph, if expressions form a tree, a graph can have cycles, so transforming a tree in to a graph can remove redundancy (if that is what you mean by unique)