3.9 Relating Enumerations
4.1.1 Stimulus Deletion
Suppose we have a complete and finite enumeration E : S∗→ R × S∗and we want to delete a stimulus x belonging to S. For any sequence u in the enumeration E that is mapped to r and reduced to v (i.e., u 7→
E r, u ⊲
Ev), one of the following three situations may occur:
i. u contains x;
ii. neither u nor v contains x;
iii. v but not u contains x.
In case (i) occurs u simply goes away, i.e., u does not belong to domE′ if E′ denotes the resulting enumeration. In case (ii) occurs we keep the mapping and the reduction for u the same in E′ as in E, i.e., we also have u 7→
E′ r, u ⊲
E′v. In case (iii) occurs we would still have u 7→E′ r, but would have to handle the reduction.
Since u ⊲
Ev, we know u and v take the system before deleting x to the same state from where future responses to the same non-empty stimulus sequence will not differ. This state
“remains” in the system after deleting x as it is still reachable by the same stimulus sequence u, except that the extension by x no longer exists. Suppose u ⊲
E′v′, then u is a candidate for v′. But if there exists another string that does not contain x and takes the system before deleting x to the same state as u does from the starting state, it should be more preferable than u.
Given u 7→
E′ r, u ⊲
E′ v′, consider the special case when r 6= ω and v′ = u. We need to extend u by every stimulus, say s, other than x. The extension is not arbitrary, though. It needs to agree with and be constrained by E. Suppose v 67→
E
ω, then we should map us in E′ to whatever vs is mapped to in E, and reduce us in E′ to whatever vs is reduced to in E. Suppose v 7→
E ω, then we should map us to ω and reduce us to v. In either case if the reduced value for us contains x, it must be changed and the same kind of thought as put in u needs to be followed in defining the reduced value for us in E′.
This motivates us to seek a solution by way of automaton. Not only intuitive, the automaton approach also provides a clean picture of all changes to be made to the system as a whole. Our strategy is to first extract the automaton from the enumeration, make all necessary changes to the automaton, and then translate the changes back. Given the mappings between enumeration and state machine in Sec. 3.3, the translations in both ways are straightforward and need not be explicitly spelled out. Algorithm 4.1 is given in the language of an enumeration.
Let us first reinforce the 1-to-1 correspondence between enumeration and state machine.
An unreduced sequence in an enumeration relates to a state of the corresponding enumer-ation Mealy machine in such a way that it is the first string in canonical order leading the automaton from the starting state to that state. We can think of the unreduced sequence as another name for its corresponding state. Meanwhile any string is a path from the starting state to some state of the automaton. When an unreduced sequence is treated as a path, the output associated with the last transition on the path is the output produced by the whole unreduced sequence, which in view of the enumeration is exactly the response that unreduced sequence is mapped to. Therefore depending on the output produced by the corresponding unreduced sequence of a state being legal or illegal, we can decide whether the unreduced sequence should or should not get extended in the enumeration.
The complete and finite enumeration E corresponds to an enumeration Mealy machine Φ(E). For now we imagine states are all named after their corresponding unreduced se-quences in E. Consider any non-empty sequence u in the enumeration that can be split into a prefix p and a symbol s (i.e., u = ps, where s ∈ S); if u 7→
E r and u ⊲
Ev then from state p there is an arc labeled with s associated with output r into state v.
Suppose we want to delete x from the stimulus set S. All arcs labeled with x will disappear, which may lead to the elimination of some states (together with their outgoing arcs) that are no longer reachable from the starting state. For the rest of the states a word (i.e., string) is computed for each that is the first string in canonical order taking the automaton from the starting state to that state. If the associated word produces ω as an output value, but the state was not previously a trap state, the outgoing arcs of the state need to be redirected to make it a trap state, according to Condition 4 in Def. 3.2. This may further render more states unreachable and getting removed from the resulting automaton.
The key to this problem then lies in determining which states of the old automaton remain in the new automaton and furthermore what they should be named after in the new automaton. These new names indicate unreduced sequences in the resulting enumeration E′, from which it is mechanical to construct E′. The partial function κ in Algorithm 4.1 is designed for this purpose. If an unreduced sequence u in E is defined for κ, the corresponding state remains in the new automaton, with κ(u) being an unreduced sequence in the resulting enumeration E′. Detailed explanation on the inductive definition of κ as well as on the construction of E′ from E and κ is put on a parallel with the algorithm itself in square brackets.
Algorithm 4.1. (Stimulus deletion algorithm)
Let E : S∗ → R × S∗ be in E. [E is a complete and finite enumeration.]
Let x ∈ S. [x is the stimulus to be deleted.]
Let U = {u : u ⊲ u}. [U contains all unreduced sequences in E.]
Define a partial function κ : U → (S − {x})∗ by:
[The range of κ should be the set of all unreduced sequences in E′.]
κ(λ) = λ [The starting state is for unreduced sequence λ in both E and E′.]
(u ∈ U, u 6= λ, (Au = {κ(p)s : ps ⊲ u, κ(p) ˆ67→ ω, s ∈ S − {x}}) 6= φ)
⇒ κ(u) = min (Au).
[For any unreduced sequence u in E other than λ, build a set Au of possible alternative names for state u. If no such names can be found, the state is eliminated, otherwise, the state remains in the new automaton and is named after the first qualified candidate min (Au) in canonical order.
Consider every incoming arc labeled with any stimulus s other than x from prefix state p into state u; if the prefix state remains in the new automaton (i.e. p is defined for κ) but not as a trap state (i.e., κ(p) ˆ67→
E
ω) so that the transition from p to u by s need not be redirected, then the new name for state p concatenated with s, κ(p)s, is a candidate for the new name for state u, κ(u), in E′.]
Define E′: (S − {x})∗ → R × (S − {x})∗ by: [E′ is the resulting enumeration.]
E′(λ) = (0, λ) [Define λ for E′.]
(E(u) = (ω, u), κ(u) ˆ67→
E
ω, s ∈ S − {x}) ⇒ E′(κ(u)s) = (ω, κ(u))
[Unreduced sequence u is mapped to illegal in E, hence is not extended in E.
The state for u remains in the new automaton but denotes an unreduced sequence κ(u) not mapped to illegal in E′. Every extension of κ(u) by a stimulus other than x needs to be mapped to illegal in E′.]
(E(us) = (r, v), κ(u) ˆ67→
E
ω, s ∈ S − {x}) ⇒ E′(κ(u)s) = (r, κ(v)).
[State u goes to state v by arc s other than x with output r in the old automaton. If state u remains in the new automaton (i.e., u is defined for κ) but not as a trap state (i.e., κ(u) ˆ67→
E
ω) so that the arc from u to v by s need not be redirected, then the extension of unreduced sequence κ(u) (the new name for state u) by s is mapped to r and reduced to unreduced sequence κ(v) (the new name for state v) in E′.]
The explanation is intended to give a high level intuition of the algorithm. Some asser-tions in the explanation are formally established in the proof of Algorithm 4.1.
Suppose E : S∗ → R × S∗ is in E, and x is in S. We use E.del(x) to denote the partial function E′ obtained by applying Algorithm 4.1 on E and x.
Theorem 4.1. E.del(x) ∈ E.
Theorem 4.1 ensures Algorithm 4.1 yields a complete and finite enumeration. Algo-rithm 3.1 for enumeration minimization can be applied afterwards if a complete, finite, and minimal enumeration is desired. No assumption is made in the stimulus deletion algorithm that warrants special attention.