A state machine is simply a system that exists in one of a number of states. That system changes states — it “transitions” — due to some input into the system, resulting in another state. In order to model a state machine’s transitions, you’ll need to keep track of the time (or order) of the events, otherwise Prometheux will not know how to apply the events in which order.
The expected output set of facts is:
Note that the order of output states is not guaranteed.
You may have noticed the addition of a variable alias Time = EventTime. This is currently necessary because using a variable that exists in a body predicate (EventTime on line 3) as both a filter (line 5) and as a variable in the head (line 2) has unintended consequences.To fix this, we simply add an alias to the head predicate (line 8), and assign it the same value (line 12).