Martin

John C. Martin · Fourth edition

Exercises

Exercise 3.1

In each case below, find a string of minimum length in {a,b}∗\{a,b\}^* not in the language corresponding to the given regular expression.

Exercise 3.2

Consider the two regular expressions

  1. Find a string corresponding to rr but not to ss.

  2. Find a string corresponding to ss but not to rr.

  3. Find a string corresponding to both rr and ss.

  4. Find a string in {a,b}∗\{a,b\}^* corresponding to neither rr nor ss.

Exercise 3.3

Let rr and ss be arbitrary regular expressions over the alphabet Σ\Sigma. In each case below, find a simpler equivalent regular expression.

  1. r(r∗r+r∗)+r∗r(r^*r+r^*)+r^*

  2. (r+Λ)∗(r+\Lambda)^*

  3. (r+s)∗rs(r+s)∗+s∗r∗(r+s)^*rs(r+s)^*+s^*r^*

Exercise 3.4

It is not difficult to show using mathematical induction that for every integer n≥2n\ge2, there are nonnegative integers ii and jj such that n=2i+3jn=2i+3j. With this in mind, simplify the regular expression (aa+aaa)(aa+aaa)∗(aa+aaa)(aa+aaa)^*.

Exercise 3.5

In each case below, give a simple description of the smallest set of languages that contains all the “basic” languages ∅\varnothing, {Λ}\{\Lambda\}, and {σ}\{\sigma\} (for every σ∈Σ\sigma\in\Sigma) and is closed under the specified operations.

  1. union

  2. concatenation

  3. union and concatenation

Exercise 3.6

Suppose ww and zz are strings in {a,b}∗\{a,b\}^*. Find regular expressions corresponding to each of the languages defined recursively below.

  1. Λ∈L\Lambda\in L; for every x∈Lx\in L, then wxwx and xzxz are elements of LL.

  2. a∈La\in L; for every x∈Lx\in L, wxwx, xwxw, and xzxz are elements of LL.

  3. Λ∈L\Lambda\in L; a∈La\in L; for every x∈Lx\in L, wxwx and zxzx are in LL.

Exercise 3.7

Find a regular expression corresponding to each of the following subsets of {a,b}∗\{a,b\}^*.

  1. The language of all strings containing exactly two aa’s.

  2. The language of all strings containing at least two aa’s.

  3. The language of all strings that do not end with abab.

  4. The language of all strings that begin or end with aaaa or bbbb.

  5. The language of all strings not containing the substring aaaa.

  6. The language of all strings in which the number of aa’s is even.

  7. The language of all strings containing no more than one occurrence of the string aaaa. (The string aaaaaa should be viewed as containing two occurrences of aaaa.)

  8. The language of all strings in which every aa is followed immediately by bbbb.

  9. The language of all strings containing both bbbb and abaaba as substrings.

  10. The language of all strings not containing the substring aaaaaa.

  11. The language of all strings not containing the substring bbabba.

  12. The language of all strings containing both babbab and abaaba as substrings.

  13. The language of all strings in which the number of aa’s is even and the number of bb’s is odd.

  14. The language of all strings in which both the number of aa’s and the number of bb’s are odd.

Exercise 3.8

  1. The regular expression (b+ab)∗(a+ab)∗(b+ab)^*(a+ab)^* describes the set of all strings in {a,b}∗\{a,b\}^* not containing the substring ‾x‾\underline{\qquad}x\underline{\qquad\qquad} for any xx. (Fill in the blanks appropriately.)

  2. The regular expression (a+b)∗(aa∗bb∗aa∗+bb∗aa∗bb∗)(a+b)∗(a+b)^*(aa^*bb^*aa^*+bb^*aa^*bb^*)(a+b)^* describes the set of all strings in {a,b}∗\{a,b\}^* containing both the substrings ‾\underline{\qquad} and ‾\underline{\qquad}. (Fill in the blanks appropriately.)

Exercise 3.9

Show that every finite language is regular.

Exercise 3.10

  1. If LL is the language corresponding to the regular expression (aab+bbaba)∗baba(aab+bbaba)^*baba, find a regular expression corresponding to Lr={xr∣x∈L}L^r=\{x^r\mid x\in L\}.

  2. Using the example in part (a) as a model, give a recursive definition (based on Definition 3.1) of the reverse ere^r of a regular expression ee.

  3. Show that for every regular expression ee, if the language LL corresponds to ee, then LrL^r corresponds to ere^r.

Exercise 3.11

The star height of a regular expression rr over Σ\Sigma, denoted by sh(r)sh(r), is defined as follows:

  1. sh(∅)=0sh(\varnothing)=0.

  2. sh(Λ)=0sh(\Lambda)=0.

  3. sh(σ)=0sh(\sigma)=0 for every σ∈Σ\sigma\in\Sigma.

  4. sh((rs))=sh((r+s))=max⁡(sh(r),sh(s))sh((rs))=sh((r+s))=\max(sh(r),sh(s)).

  5. sh((r∗))=sh(r)+1sh((r^*))=sh(r)+1.

Find the star heights of the following regular expressions.

Exercise 3.12

For both the regular expressions in the previous exercise, find an equivalent regular expression of star height 1.

Exercise 3.13

Let cc and dd be regular expressions over Σ\Sigma.

  1. Show that the formula r=c+rdr=c+rd, involving the variable rr, is true if the regular expression cd∗cd^* is substituted for rr.

  2. Show that if Λ\Lambda is not in the language corresponding to dd, then any regular expression rr satisfying r=c+rdr=c+rd corresponds to the same language as cd∗cd^*.

Exercise 3.14

Describe precisely an algorithm that could be used to eliminate the symbol ∅\varnothing from any regular expression that does not correspond to the empty language.

Exercise 3.15

Describe an algorithm that could be used to eliminate the symbol Λ\Lambda from any regular expression whose corresponding language does not contain the null string.

Exercise 3.16

The order of a regular language LL is the smallest integer kk for which Lk=Lk+1L^k=L^{k+1}, if there is one, and ∞\infty otherwise.

  1. Show that the order of LL is finite if and only if there is an integer kk such that Lk=L∗L^k=L^*, and that in this case the order of LL is the smallest kk such that Lk=L∗L^k=L^*.

  2. What is the order of the regular language {Λ}∪{aa}{aaa}∗\{\Lambda\}\cup\{aa\}\{aaa\}^*?

  3. What is the order of the regular language {a}∪{aa}{aaa}∗\{a\}\cup\{aa\}\{aaa\}^*?

  4. What is the order of the language corresponding to the regular expression (Λ+b∗a)(b+ab∗ab∗a)∗(\Lambda+b^*a)(b+ab^*ab^*a)^*?

Exercise 3.17

† A generalized regular expression is defined the same way as an ordinary regular expression, except that two additional operations, intersection and complement, are allowed. So, for example, the generalized regular expression abb∅′∩(∅′aaa∅′)′abb\varnothing'\cap(\varnothing'aaa\varnothing')' represents the set of all strings in {a,b}∗\{a,b\}^* that start with abbabb and don’t contain the substring aaaaaa.

  1. Show that the subset {aba}∗\{aba\}^* of {a,b}∗\{a,b\}^* can be described by a generalized regular expression with no occurrences of ∗*.

  2. Can the subset {aaa}∗\{aaa\}^* be described this way? Give reasons for your answer.

Exercise 3.18

Figure 3.34 shows a transition diagram for an NFA. For each string below, say whether the NFA accepts it.

  1. abaaba

  2. abababab

  3. aaabbbaaabbb

Figure 3.34

Exercise 3.19

Find a regular expression corresponding to the language accepted by the NFA pictured in Figure 3.34. You should be able to do it without applying Kleene’s theorem: First find a regular expression describing the most general way of reaching state 4 the first time, and then find a regular expression describing the most general way, starting in state 4, of moving to state 4 the next time.

Exercise 3.20

For each of the NFAs shown in Figure 3.35, find a regular expression corresponding to the language it accepts.

Exercise 3.21

The following is the transition table for an NFA with states 1–5 and input alphabet {a,b}\{a,b\}. There are no Λ\Lambda-transitions.

qqδ(q,a)\delta(q,a)δ(q,b)\delta(q,b)
1{1,2}\{1,2\}{1}\{1\}
2{3}\{3\}{3}\{3\}
3{4}\{4\}{4}\{4\}
4{5}\{5\}∅\varnothing
5∅\varnothing{5}\{5\}
  1. Draw a transition diagram.

  2. Calculate δ∗(1,ab)\delta^*(1,ab).

  3. Calculate δ∗(1,abaab)\delta^*(1,abaab).

Exercise 3.22

A transition table is given for an NFA with seven states.

qqδ(q,a)\delta(q,a)δ(q,b)\delta(q,b)δ(q,Λ)\delta(q,\Lambda)
1∅\varnothing∅\varnothing{2}\{2\}
2{3}\{3\}∅\varnothing{5}\{5\}
3∅\varnothing{4}\{4\}∅\varnothing
4{4}\{4\}∅\varnothing{1}\{1\}
5∅\varnothing{6,7}\{6,7\}∅\varnothing
6{5}\{5\}∅\varnothing∅\varnothing
7∅\varnothing∅\varnothing{1}\{1\}

Find:

  1. Λ({2,3})\Lambda(\{2,3\})

  2. Λ({1})\Lambda(\{1\})

  3. Λ({3,4})\Lambda(\{3,4\})

  4. δ∗(1,ba)\delta^*(1,ba)

  5. δ∗(1,ab)\delta^*(1,ab)

  6. δ∗(1,ababa)\delta^*(1,ababa)

Exercise 3.23

A transition table is given for another NFA with seven states.

qqδ(q,a)\delta(q,a)δ(q,b)\delta(q,b)δ(q,Λ)\delta(q,\Lambda)
1{5}\{5\}∅\varnothing{4}\{4\}
2{1}\{1\}∅\varnothing∅\varnothing
3∅\varnothing{2}\{2\}∅\varnothing
4∅\varnothing{7}\{7\}{3}\{3\}
5∅\varnothing∅\varnothing{1}\{1\}
6∅\varnothing{5}\{5\}{4}\{4\}
7{6}\{6\}∅\varnothing∅\varnothing

Calculate δ∗(1,ba)\delta^*(1,ba).

Exercise 3.24

Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an NFA with no Λ\Lambda-transitions. Show that for every q∈Qq\in Q and every σ∈Σ\sigma\in\Sigma, δ∗(q,σ)=δ(q,σ)\delta^*(q,\sigma)=\delta(q,\sigma).

Exercise 3.25

It is easy to see that if M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) is an FA accepting LL, then the FA M′=(Q,Σ,q0,Q−A,δ)M'=(Q,\Sigma,q_0,Q-A,\delta) accepts L′L' (the FA obtained from Theorem 2.15 by writing L′=Σ∗−LL'=\Sigma^*-L is essentially M′M'). Does this still work if MM is an NFA? If so, prove it. If not, find a counterexample.

Exercise 3.26

In Definition 3.14, δ∗\delta^* is defined recursively in an NFA by first defining δ∗(q,Λ)\delta^*(q,\Lambda) and then defining δ∗(q,yσ)\delta^*(q,y\sigma), where y∈Σ∗y\in\Sigma^* and σ∈Σ\sigma\in\Sigma. Give an acceptable recursive definition in which the recursive part of the definition defines δ∗(q,σy)\delta^*(q,\sigma y) instead.

Exercise 3.27

Which of the following, if any, would be a correct substitute for the second part of Definition 3.14? Give reasons for your answer.

  1. δ∗(q,σy)=Λ(⋃{δ∗(r,y)∣r∈δ(q,σ)})\delta^*(q,\sigma y)=\Lambda\left(\bigcup\{\delta^*(r,y)\mid r\in\delta(q,\sigma)\}\right)

  2. δ∗(q,σy)=⋃{Λ(δ∗(r,y))∣r∈δ(q,σ)}\delta^*(q,\sigma y)=\bigcup\{\Lambda(\delta^*(r,y))\mid r\in\delta(q,\sigma)\}

  3. δ∗(q,σy)=⋃{δ∗(r,y)∣r∈Λ(δ(q,σ))}\delta^*(q,\sigma y)=\bigcup\{\delta^*(r,y)\mid r\in\Lambda(\delta(q,\sigma))\}

  4. δ∗(q,σy)=⋃{Λ(δ∗(r,y))∣r∈Λ(δ(q,σ))}\delta^*(q,\sigma y)=\bigcup\{\Lambda(\delta^*(r,y))\mid r\in\Lambda(\delta(q,\sigma))\}

Exercise 3.28

Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an NFA. This exercise involves properties of the Λ\Lambda-closure of a set SS. Since Λ(S)\Lambda(S) is defined recursively, structural induction can be used to show that Λ(S)\Lambda(S) is a subset of some other set.

  1. Show that if SS and TT are subsets of QQ for which S⊆TS\subseteq T, then Λ(S)⊆Λ(T)\Lambda(S)\subseteq\Lambda(T).

  2. Show that for any S⊆QS\subseteq Q, Λ(Λ(S))=Λ(S)\Lambda(\Lambda(S))=\Lambda(S).

  3. Show that if S,T⊆QS,T\subseteq Q, then Λ(S∪T)=Λ(S)∪Λ(T)\Lambda(S\cup T)=\Lambda(S)\cup\Lambda(T).

  4. Show that if S⊆QS\subseteq Q, then Λ(S)=⋃{Λ({p})∣p∈S}\Lambda(S)=\bigcup\{\Lambda(\{p\})\mid p\in S\}.

  5. Draw a transition diagram to illustrate the fact that Λ(S∩T)\Lambda(S\cap T) and Λ(S)∩Λ(T)\Lambda(S)\cap\Lambda(T) are not always the same. Which is always a subset of the other?

  6. Draw a transition diagram illustrating the fact that Λ(S′)\Lambda(S') and Λ(S)′\Lambda(S)' are not always the same. Which is always a subset of the other? Under what circumstances are they equal?

Exercise 3.29

Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an NFA. A set S⊆QS\subseteq Q is called Λ\Lambda-closed if Λ(S)=S\Lambda(S)=S.

  1. Show that the union of two Λ\Lambda-closed sets is Λ\Lambda-closed.

  2. Show that the intersection of two Λ\Lambda-closed sets is Λ\Lambda-closed.

  3. Show that for any subset SS of QQ, Λ(S)\Lambda(S) is the smallest Λ\Lambda-closed set of which SS is a subset.

Exercise 3.30

† Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an NFA. Show that for every q∈Qq\in Q and every x,y∈Σ∗x,y\in\Sigma^*,

δ∗(q,xy)=⋃{δ∗(r,y)∣r∈δ∗(q,x)}\delta^*(q,xy)=\bigcup\{\delta^*(r,y)\mid r\in\delta^*(q,x)\}

Exercise 3.31

Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an FA, and let M1=(Q,Σ,q0,A,δ1)M_1=(Q,\Sigma,q_0,A,\delta_1) be the NFA with no Λ\Lambda-transitions for which δ1(q,σ)={δ(q,σ)}\delta_1(q,\sigma)=\{\delta(q,\sigma)\} for every q∈Qq\in Q and σ∈Σ\sigma\in\Sigma. Show that for every q∈Qq\in Q and x∈Σ∗x\in\Sigma^*, δ1∗(q,x)={δ(q,x)}\delta_1^*(q,x)=\{\delta(q,x)\}. Recall that the two functions δ∗\delta^* and δ1∗\delta_1^* are defined differently.

Transcription note

Exercise 3.31 prints {δ(q,x)}\{\delta(q,x)\}. For an arbitrary string xx, the FA’s extended transition function gives {δ∗(q,x)}\{\delta^*(q,x)\}.

Exercise 3.32

Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an NFA accepting a language LL. Assume that there are no transitions to q0q_0, that AA has only one element, qfq_f, and that there are no transitions from qfq_f.

  1. Let M1M_1 be obtained from MM by adding Λ\Lambda-transitions from q0q_0 to every state that is reachable from q0q_0 in MM. (If pp and qq are states, qq is reachable from pp if there is a string x∈Σ∗x\in\Sigma^* such that q∈δ∗(p,x)q\in\delta^*(p,x).) Describe (in terms of LL) the language accepted by M1M_1.

  2. Let M2M_2 be obtained from MM by adding Λ\Lambda-transitions to qfq_f from every state from which qfq_f is reachable in MM. Describe in terms of LL the language accepted by M2M_2.

  3. Let M3M_3 be obtained from MM by adding both the Λ\Lambda-transitions in (a) and those in (b). Describe the language accepted by M3M_3.

Exercise 3.33

Give an example of a regular language LL containing Λ\Lambda that cannot be accepted by any NFA having only one accepting state and no Λ\Lambda-transitions, and show that your answer is correct.

Exercise 3.34

Can every regular language not containing Λ\Lambda be accepted by an NFA having only one accepting state and no Λ\Lambda-transitions? Prove your answer.

Exercise 3.35

Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an NFA, let mm be the maximum size of any of the sets δ∗(q,σ)\delta^*(q,\sigma) for q∈Qq\in Q and σ∈Σ\sigma\in\Sigma, and let xx be a string of length nn over the input alphabet.

  1. What is the maximum number of distinct paths that there might be in the computation tree corresponding to xx?

  2. In order to determine whether xx is accepted by MM, it is sufficient to replace the complete computation tree by one that is perhaps smaller, obtained by “pruning” the original one so that no level of the tree contains more nodes than the number of states in MM (and no level contains more nodes than there are at that level of the original tree). Explain why this is possible, and how it might be done.

Exercise 3.36

Let M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) be an NFA. The NFA M1M_1 obtained by eliminating Λ\Lambda-transitions from MM might have more accepting states than MM, because the initial state q0q_0 is made an accepting state if Λ({q0})∩A≠∅\Lambda(\{q_0\})\cap A\ne\varnothing. Explain why it is not necessary to make all the states qq for which Λ({q})∩A≠∅\Lambda(\{q\})\cap A\ne\varnothing accepting states in M1M_1.

Exercise 3.37

In each part of Figure 3.36 is pictured an NFA. Use the algorithm described in the proof of Theorem 3.17 to draw an NFA with no Λ\Lambda-transitions accepting the same language.

Exercise 3.38

Each part of Figure 3.37 pictures an NFA. Using the subset construction, draw an FA accepting the same language. Label the final picture so as to make it clear how it was obtained from the subset construction.

Exercise 3.39

Suppose L⊆Σ∗L\subseteq\Sigma^* is a regular language. If every FA accepting LL has at least nn states, then every NFA accepting LL has at least ‾\underline{\qquad} states. (Fill in the blank, and explain your answer.)

Exercise 3.40

Each part of Figure 3.38 shows an NFA. Draw an FA accepting the same language.

Exercise 3.41

For each of the following regular expressions, draw an NFA accepting the corresponding language, so that there is a recognizable correspondence between the regular expression and the transition diagram.

Exercise 3.42

For part (e) of Exercise 3.41, draw the NFA that is obtained by a literal application of Kleene’s theorem, without any simplifications.

Exercise 3.43

Suppose M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) is an NFA accepting a language LL. Let M1M_1 be the NFA obtained from MM by adding Λ\Lambda-transitions from each element of AA to q0q_0. Describe (in terms of LL) the language L(M1)L(M_1).

Exercise 3.44

Suppose M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) is an NFA accepting a language LL.

  1. Describe how to construct an NFA M1M_1 with no transitions to its initial state so that M1M_1 also accepts LL.

  2. Describe how to construct an NFA M2M_2 with exactly one accepting state and no transitions from that state, so that M2M_2 also accepts LL.

Exercise 3.45

Suppose MM is an NFA with exactly one accepting state qfq_f that accepts the language L⊆{a,b}∗L\subseteq\{a,b\}^*. In order to find NFAs accepting the languages {a}∗L\{a\}^*L and L{a}∗L\{a\}^*, we might try adding aa-transitions from q0q_0 to itself and from qfq_f to itself, respectively. Draw transition diagrams to show that neither technique always works.

Exercise 3.46

In the construction of MuM_u in the proof of Theorem 3.25, consider this alternative to the construction described: Instead of a new state quq_u and Λ\Lambda-transitions from it to q1q_1 and q2q_2, make q1q_1 the initial state of the new NFA, and create a Λ\Lambda-transition from it to q2q_2. Either prove that this works in general, or give an example in which it fails.

Exercise 3.47

In the construction of McM_c in the proof of Theorem 3.25, consider the simplified case in which M1M_1 has only one accepting state. Suppose that we eliminate the Λ\Lambda-transition from the accepting state of M1M_1 to q2q_2, and merge these two states into one. Either show that this would always work in this case, or give an example in which it fails.

Exercise 3.48

In the construction of M∗M^* in the proof of Theorem 3.25, suppose that instead of adding a new state q0q_0, with Λ\Lambda-transitions from it to q1q_1 and to it from each accepting state of Q1Q_1, we make q1q_1 both the initial state and the accepting state, and create Λ\Lambda-transitions from each accepting state of M1M_1 to q0q_0. Either show that this works in general, or give an example in which it fails.

Transcription note

Exercise 3.48 prints q0q_0 in its final sentence although the proposed construction names q1q_1 as its initial state. The wording above preserves that distinction in the source.

Exercise 3.49

Figure 3.39 shows FAs M1M_1 and M2M_2 accepting languages L1L_1 and L2L_2, respectively. Draw NFAs accepting each of the following languages, using the constructions in the proof of Theorem 3.25.

  1. L2∗∪L1L_2^*\cup L_1

  2. L2L1∗L_2L_1^*

  3. L1L2∪(L2L1)∗L_1L_2\cup(L_2L_1)^*

Exercise 3.50

Draw NFAs with no Λ\Lambda-transitions accepting L1L2L_1L_2 and L2L1L_2L_1, where L1L_1 and L2L_2 are as in Exercise 3.49. Do this by connecting the two given diagrams directly, by arrows with appropriate labels.

Exercise 3.51

Use the algorithm of Theorem 3.30 to find a regular expression corresponding to each of the FAs shown in Figure 3.40. In each case, if the FA has nn states, construct tables showing L(p,q,j)L(p,q,j) for each jj with 0≤j≤n−10\le j\le n-1.

Exercise 3.52

Suppose MM is an FA with the three states 1, 2, and 3, and 1 is both the initial state and the only accepting state. The expressions r(p,q,2)r(p,q,2) corresponding to the languages L(p,q,2)L(p,q,2) are shown in the table below. Write a regular expression describing L(M)L(M).

Exercise 3.53

Suppose Σ1\Sigma_1 and Σ2\Sigma_2 are alphabets, and the function f:Σ1∗→Σ2∗f:\Sigma_1^*\to\Sigma_2^* is a homomorphism; i.e., f(xy)=f(x)f(y)f(xy)=f(x)f(y) for every x,y∈Σ1∗x,y\in\Sigma_1^*.

  1. Show that f(Λ)=Λf(\Lambda)=\Lambda.

  2. Show that if L⊆Σ1∗L\subseteq\Sigma_1^* is regular, then f(L)f(L) is regular. (f(L)f(L) is the set {y∈Σ2∗∣y=f(x) for some x∈L}\{y\in\Sigma_2^*\mid y=f(x)\text{ for some }x\in L\}.)

  3. Show that if L⊆Σ2∗L\subseteq\Sigma_2^* is regular, then f−1(L)f^{-1}(L) is regular. (f−1(L)f^{-1}(L) is the set {x∈Σ1∗∣f(x)∈L}\{x\in\Sigma_1^*\mid f(x)\in L\}.)

Exercise 3.54

Suppose M=(Q,Σ,q0,A,δ)M=(Q,\Sigma,q_0,A,\delta) is an NFA. For two (not necessarily distinct) states pp and qq, we define the regular expression e(p,q)e(p,q) as follows: e(p,q)=l+r1+r2+⋯+rke(p,q)=l+r_1+r_2+\cdots+r_k, where ll is either Λ\Lambda (if δ(p,Λ)\delta(p,\Lambda) contains qq) or ∅\varnothing, and the rir_i’s are all the elements σ\sigma of Σ\Sigma for which δ(p,σ)\delta(p,\sigma) contains qq. It’s possible for e(p,q)e(p,q) to be ∅\varnothing, if there are no transitions from pp to qq; otherwise, e(p,q)e(p,q) represents the “most general” transition from pp to qq.

If we generalize this by allowing e(p,q)e(p,q) to be an arbitrary regular expression over Σ\Sigma, we get what is called an expression graph. If pp and qq are two states in an expression graph GG, and x∈Σ∗x\in\Sigma^*, we say that xx allows GG to move from pp to qq if there are states p0,p1,…,pmp_0,p_1,\ldots,p_m, with p0=pp_0=p and pm=qp_m=q, such that xx corresponds to the regular expression e(p0,p1)e(p1,p2)⋯e(pn−1,pn)e(p_0,p_1)e(p_1,p_2)\cdots e(p_{n-1},p_n). This allows us to say how GG accepts a string xx (xx allows GG to move from the initial state to an accepting state), and therefore to talk about the language accepted by GG. It is easy to see that in the special case where GG is simply an NFA, the two definitions for the language accepted by GG coincide. It is also not hard to convince yourself, using Theorem 3.25, that for any expression graph GG, the language accepted by GG can be accepted by an NFA.

We can use the idea of an expression graph to obtain an alternate proof of Theorem 3.30, as follows. Starting with an FA MM accepting LL, we may easily convert it to an NFA M1M_1 accepting LL, so that M1M_1 has no transitions to its initial state q0q_0, exactly one accepting state qfq_f (which is different from q0q_0), and no transitions from qfq_f. The remainder of the proof is to specify a reduction technique to reduce by one the number of states other than q0q_0 and qfq_f, obtaining an equivalent expression graph at each step, until q0q_0 and qfq_f are the only states remaining. The regular expression e(q0,qf)e(q_0,q_f) then describes the language accepted. If pp is the state to be eliminated, the reduction step involves redefining e(q,r)e(q,r) for every pair of states qq and rr other than pp.

Describe in more detail how this reduction can be done. Then apply this technique to the FAs in Figure 3.40 to obtain regular expressions corresponding to their languages.

Transcription note

The path in Exercise 3.54 is indexed through pmp_m, but the final factor is printed with nn. Consistent indexing gives e(p0,p1)⋯e(pm−1,pm)e(p_0,p_1)\cdots e(p_{m-1},p_m).