CISC/CMPE 223, Winter 2023, State-transition diagrams 1 State-transition diagrams We introduce simple simulated machines that turn out to model exactly the class of regular languages. Before going to the formal definition we consider a couple of examples. This material is from Chapter 8 in the textbook. Example. An identifier can be defined as a string of letters and digits that begins with a letter. The states are depicted by circles and the transitions between states are indicated by arrows labeled by the corresponding tokens. A final state (or accepting state) is a double circle. The start state is indicated by an incoming arrow. · Token letter stands for any of the symbols a, ... , z, A, ... , Z. · Token digit stands for 0, 1, ... , 9. The set of identifiers is specified by the state-transition diagram in Figure ??. Figure 1: A state-diagram for specifying identifiers. Example. We design a "sequential lock" as described below. The lock has 1-bit sequential input. Initially, the lock is closed. If the lock is closed it will open when the last three input bits are "1", "0", "1", and then remains open. In other words, the state-transition diagram should accept exactly all strings that contain substring 101. The state-transition diagram will be constructed in class.
CISC/CMPE 223, Winter 2023, State-transition diagrams 2 What is a regular expression that denotes the same language? A state diagram describes a deterministic finite automaton (DFA), a machine that at any given time is in one of finitely many states, and whose state changes according to a predetermined way in response to a sequence of input symbols. Formally a deterministic finite automaton is defined as a five-tuple and the definition is below. Definition. A DFA is defined as a tuple M = (Q, ?, ?, s, F) where the components are as follows: · Q is the finite nonempty set of states · 2 is the input alphabet . 8 : Q > > > Q is the transition function · s E Q is the starting state . F C Q is the set of accepting states A finite state automaton (DFA) is conveniently depicted using a state diagram, that is, a directed graph. Especially when the set of states is small the operation of the machine is intuitively easier to understand based on a graphical representation. On the other hand, when we want to implement a DFA we use notation that lists all transitions, or a transition table as illustrated in the next example. Example. Consider the state diagram in Figure ??. Note that now we have added names for the states (qi, i = 1, 2, 3, 4). The state names are needed to write down explicitly the transition table (but the state names do not affect the operation of the state diagram).
CISC/CMPE 223, Winter 2023, State-transition diagrams 3 V 1 1 1 Figure 2: A state-transition diagram. In a formal notation this automaton can be specified as M = (Q,