A Course in Formal Languages, Automata and Groups (Instructor Solution Manual, Solutions) [1 ed.] 1848009399, 9781848009394

obtained thanks to https://t.me/HermitianSociety

255 65 250KB

English Pages 22 Year 2009

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

A Course in Formal Languages, Automata and Groups   (Instructor Solution Manual, Solutions) [1 ed.]
 1848009399, 9781848009394

Citation preview

Ian Chiswell

A Course in Formal Languages, Automata and Groups Solutions Manual

Springer

Solutions to the Exercises

Chapter 1 1. Yes, a derivation is S, aASb, abSbSb, abSbabb, ababbabb. 2. In a derivation starting with S, each use of the first production gives a word with a single occurrence of S, and the first time the second production is used, the derivation must terminate. Thus a derivation of a word consisting of letters in {a, b, c} must have the form S, a2 S, a4 S, . . . , a2n S, , a2n bc, where n ≥ 0. Thus LG = {a2n bc | n ≥ 0}. (This can be written as LG = {a2 }∗ {b} {c}, more briefly LG = {a2 }∗ bc.) 3. A transition diagram for a FSA recognising {(ab)n | n = 0, 1, 2, . . .} is b  ± 

/

/

l

+l

o a

a

4. And a transition diagram for {vaw | v, w ∈ {a, b}∗ } is

b 

 − 

a /

 + 

?

b

 ? a

a

1

2

5. (i) Yes. Let G = ({S, A}, {0, 1}, P, S),where P consists of S −→ 1S1, S −→ 0A, A −→ 1A1, A −→ 0. Then L = LG . (A derivation of a word in {0, 1}∗ must begin by using the first production a number of times, say m ≥ 0, then the second production, then the third n ≥ 0 times, then the last one, when it must terminate, so it is a derivation of 1m 01n 01m+n .) (ii) No. Otherwise RL would be of finite index by Theorem 1.7, which implies 1m 01n 0 RL 1m 01 p 0 for some n 6= p, where m, n, p ≥ 0. Then 1m 01n 01m+n RL 1m 01 p 01m+n , a contradiction since 1m 01n 01m+n ∈ L, but 1m 01 p 01m+n 6∈ L. 6. Let L1 = {ai bn cn | n ≥ 1, i ≥ 0}, L2 = {an bn ci | n ≥ 1, i ≥ 0}. Then L2 is contextfree by Example (4), p.3, and L1 is, by reversing the productions used for L2 , and interchanging a and c. That is, L1 = LG , where G = ({S, A}, {a, b, c}, P, S) and P consists of S −→ aS, S −→ A, A −→ bAc, A −→ bc. But L1 ∩L2 = {an bn cn | n ≥ 1} and this is not context-free (see the example after Lemma 1.9, p.14).

Chapter 2 1. (a) Let fn (x1 , . . . , xn ) = max{x1 , . . . , xn }, x = (x1 , . . . , xn ). Then fn (x) = max{ fn−1 (x1 , . . . , xn−1 ), xn } = f2 ( fn−1 (x1 , . . . , xn−1 ), xn ) = f2 ( fn−1 (π1n (x), . . . , πn−1,n (x)), πnn (x)) and it suffices by induction on n to show f2 is primitive recursive. But ( π12 (x, y) if x ≥ y f2 (x, y) = , hence f2 is primitive recursive. π22 (x, y) if x < y (b) In (a), replace max by min and swap x ≥ y, x < y in the definition of f2 . x

(c) Let P(x) be the predicate “x is prime”. Then f (x) = ∑ χP (t). t=0

2. The predicate P1 (x, y) = (∀z ≤ min{x, y})(¬(z|x) ∨ ¬(z|y) ∨ (z = 1)) is primitive recursive and says that x, y are relatively prime provided x, y are non-zero. Put P2 (x, y) = P1 (x, y) ∧ (xy 6= 0). Then P2 is primitive recursive, hence so is RP(x, y) = P2 (x, y) ∨ (x = 1) ∨ (y = 1) (x, 0 are relatively prime if and only if x

x = 1). Also, ϕ(x) = ∑ χP2 (x,t), so ϕ is primitive recursive. t=0

3. (a) Suppose J(m, n) = J(m0 , n0 ). Put k = m + n, k0 = m0 + n0 , If k < k0 then k + 1 ≤ k0 , so

3

k0 (k0 + 1) − (k + 1)k ≥ (k + 1)(k + 2) − (k + 1)k = 2(k + 1) > 2m so J(m0 , n0 ) ≥ 21 k0 (k0 +1) > J(m, n) (= 12 k(k +1)+m), a contradiction. Similarly k > k0 is impossible, so k = k0 . Since J(m, n) = J(m0 , n0 ), m = m0 , hence n = n0 and J is one-to-one. If l ∈ N, choose k ∈ N such that 12 k(k + 1) ≤ l with k as large as possible. Then l < 21 k(k + 1) + (k + 1) = 12 (k + 1)(k + 2). Let m = l − 21 k(k + 1), so m ∈ N and m < k + 1, hence m ≤ k. Put n = k − m, so n ∈ N. Then J(m, n) = l, so J is onto. Now s(m, n) = m + n is primitive recursive, hence so is f (m, n) = s(m, n).(σ ◦ s)(m, n). Since J(m, n) = quo(2, f (m, n)) + m, J is primitive recursive. (b) K(r) is the least value of m such that there exists n with J(m, n) = r, indeed it is the only value of m for which such an n exists, since J is bijective. Clearly m, n ≤ J(m, n) for all values of m and n, hence K(r) = (µm ≤ r)(∃n ≤ r)(J(m, n) = r) showing that K is primitive recursive. Similarly L(r) = (µn ≤ r)(∃m ≤ r)(J(m, n) = r) is primitive recursive. 4. Clearly J1−1 = J1 is primitive recursive, and we have seen J2−1 is primitive recursive. For n ≥ 2, if y = Jn+1 (x1 , . . . , xn+1 ), then y = J(x1 , Jn (x2 , . . . , xn+1 )), so x1 = K(y) and Jn (x2 , . . . , xn+1 ) = L(y), hence (x2 , . . . , xn+1 ) = (Jn−1 ◦L)(y). Thus −1 Jn+1 = (K, K1 ◦ L, . . . , Kn ◦ L), where K1 , . . . , Kn are the coordinate functions of Jn−1 . It follows by induction on n that Jn−1 is primitive recursive for all n. Putting n = 2 gives J3−1 = (K, K ◦ L, L ◦ L). 5. Suppose a1 , . . . , ak are distinct elements of Nn , and f (ai ) = bi (where bi ∈ N) for 1 ≤ i ≤ k, and f (x) is undefined for x 6∈ {a1 , . . . , ak }. ( bi if x = ai , i.e |x − ai | = 0, for some i with 1 ≤ i ≤ k Let g(x) = 0 otherwise. Then g is primitive recursive, being obtained from constant functions using a definition by cases. Now let h(x) = µy(|x − a1 | . . . |x − ak | = 0) a partial recursive function. Then h(ai ) = 0 for 1 ≤ i ≤ k and h(x) is undefined for x 6∈ {a1 , . . . , ak }. Therefore f (x) = g(x) + h(x) is partial recursive. question

6. For n = 1, F(x, 0) = π11 (x), and F(x,t + 1) = f (F(x,t)) = h(x,t, F(x,t)) where h = f ◦ π33 , so F is obtained by primitive recursion, hence F ∈ C . For

4

n > 1, Jn ◦ f ◦ Jn−1 is in C by Question 4, since C is closed under composition. Let G be its iterate, so G ∈ C by the case n = 1. Claim: G(x,t) = Jn F(Jn−1 (x),t) for x ∈ N, t ∈ N. The proof is by induction on t. for t = 0, G(x, 0) = x = Jn F(Jn−1 (x), 0) since F(Jn−1 (x), 0) = Jn−1 (x). Assume it is true for t. Then G(x,t + 1) = Jn f Jn−1 (G(x,t)) = Jn f Jn−1 (Jn F(Jn−1 (x),t)) = Jn ( f (F(Jn−1 (x),t))) = Jn F(Jn−1 (x),t + 1), as required. Since Jn is bijective, F(y,t) = (Jn−1 ◦ G)(Jn (y),t) for all y ∈ Nn , t ∈ N, showing F is in C . 7. Let H be the iterate of h, so H is primitive recursive by (the easy case of) . Question 6. Then ϕ(x,t, r) = H(x,t − r), which is obtained from H and known primitive recursive functions by composition. 8. Put G(x,t, 0) = k(ht (x))

.

G(x,t, r + 1) = f (ht −(r+1) (x), G(x,t, r)) so G is obtained from known primitive recursive functions by composition and primitive recursion, using Question 7, hence G is primitive recursive. Claim: for t ≥ r, G(x,t + 1, r) = G(h(x),t, r). The proof is by induction on r. For r = 0, G(x,t + 1, 0) = k(ht (hx)) = G(h(x),t, 0). Assume the claim is true for r, and t ≥ r + 1. Then

.

G(x,t + 1, r + 1) = f (h(t+1) −(r+1) (x), G(x,t + 1, r)) = f (ht−r (x), G(h(x),t, r)) (induction hypothesis)

.

= f (ht −(r+1) (h(x)), G(h(x),t, r)) = G(h(x),t, r + 1) (by definition of G) as required. Now define g(x,t) = G(x,t,t), so g is primitive recursive. Then g(x, 0) = k(x), and g(x,t + 1) = G(x,t + 1,t + 1) = f (x, G(x,t + 1,t)) = f (x, G(h(x),t,t)) = f (x, g(h(x),t)). 9. T1 = P1 R∗ LP0 . The effect on the tape description is u01a 01c+1 0 −→ u01a 01c 1 −→ u1a 01c 0. u01a 001c −→ u01a 011c −→ ∗ P1

L

R

P0

10. T2 = L∗ P1 RP0 R∗ R∗ P1 L∗ . (u01a 01b 01c −→ u01a 01b 01c −→ u01a 11b 01c −→ u01a+1 01b−1 01c −→ ∗ ∗ P1

L

RP0

R

u01a+1 01b−1 01c −→ u01a+1 01b−1 01c 0 −→ u01a+1 01b−1 01c 1 −→ ∗ ∗ R

u01a+1 01b−1 01c+1 .)

P1

L

11. Let T = LTest{RT1 , RT2 } and let T3 be obtained from T by identifying the halting state of RT2 with the initial state of T . (All machines in the product RT2

5

have halting states, so RT2 has one.) Started on tape description u01a 01b 0, T3 follows the computation of LRT2 (i.e. of T2 ) b times, resulting in tape description u01a+b 001b , then follows the computation of LRT1 , which has the same effect as T1 , resulting in tape description u01a+b 01b 0; then T3 halts. 12. T4 = L∗ P1 R∗ LP0 . Here, the effect on the tape description is u01a 01b 0 −→ u01a 11b 0 −→ u01a+b+1 0 −→ u01a+b 1 −→ u01a 01b 0 −→ ∗ ∗ L

u01a+b 0.

P1

L

R

P0

13. Clearly T5 = T3k−1 T4 will work. 14. Let T 0 = L∗ L Test{R, RR∗ T5 } and obtain T6 by identifying the halting state of RR∗ T5 with the initial state of T 0 . Since x1 , . . . , xn > 0, T6 performs the computation of L∗ LRR∗ T5 (n − 1) times, resulting in tape description 001x1 +x2 k+...+xn k

n−1

0.

Then T6 performs L∗ LR and halts in some state, say h, with tape description n−1 01x1 +x2 k+...+xn k . Note that this works if n = 0, and h is a halting state for T6 .

Chapter 3 1. We assume A = {a1 , . . . , an } where n > 0 (the case n = 0 is easy, as noted in the text). The variables x, y, z are used below to define certain functions, and range over all elements of N. It is a supplementary exercise to verify in detail the claims below that certain functions and predicates are primitive recursive. (a) Let q be an integer greater than 1. If r ∈ N, r can be written as r = s1 + s2 q + . . . + sk qk−1 , where 0 ≤ s j < q for 1 ≤ j ≤ k (by using the division algorithm and induction on r). Putting s j = 0 for j > k, the s j are uniquely determined. For define Q : N3 → N by primitive recursion: Q(x, y, 0) = x Q(x, y, z + 1) = quo(y, Q((x, y, z)).

.

and put F(x, y, z) = rem(y, Q(x, y, z − 1)), so F is a primitive recursive function. Then the reader can check that s j = F(r, q, j) for j ≥ 1. It follows that ϕ1 is one-to-one. Now choosing k as small as possible, k is the least integer m such that such that r < qm , and k ≤ r (by induction on r). Define a primitive recursive function M : N2 → N by M(x, y) = µ z ≤ x(x < yz ), so k = M(r, q). Now put m(r) f (x, z) = F(x, n+1, z), m(x) = M(x, n+1). Thus r = ∑ j=1 f (r, j)(n+1) j−1 .

6

From the definition of ϕ1 r ∈ ϕ1 (A∗ ) ⇔ f (r, j) > 0 for 1 ≤ j ≤ m(r) and the right-hand side is a primitive recursive predicate. Hence ϕ1 is a G¨odel numbering. Also, ϕ2 is one-to-one by unique factorisation into primes and r ∈ ϕ2 (A∗ ) ⇔ log2 (r)

(0 < log p j (r) ≤ n for 1 ≤ j ≤ log2 (r)) ∧ r = 2

log2 (r) log (r) p



pj

j

! .

j=1

The right-hand side is a primitive recursive predicate, hence ϕ2 is a G¨odel numbering. m(r) f (r, j) Define g : N → N by g(r) = 2m(r) ∏ j=1 p j . Then g ◦ ϕ1 = ϕ2 and g is primitive recursive. If X ⊆ A∗ and ϕ1 (X) is r.e. then ϕ2 (X) = g(ϕ1 (X)) is r.e. by Lemma 3.3(2). log (r) Now define g0 : N → N by g0 (r) = ∑ j=12 log p j (r)(n + 1) j−1 . Then g0 is primitive recursive and g0 ◦ ϕ2 = ϕ1 , so similarly ϕ2 (X) r.e. implies ϕ1 (X) is r.e.. Thus ϕ1 (X) is r.e. if and only if ϕ2 (X) is r.e. Applying this to A∗ \ X and using Lemma 3.8, ϕ1 (X) is recursive if and only if ϕ2 (X) is recursive. (b) Suppose r = s1 n + . . . + sk nk where 1 ≤ s j ≤ n. Then r = n((s1 − 1) + (s2 − 1)n + . . . + (sk − 1)nk−1 ) + (n + . . . + nk ) so r − (1 + . . . + nk−1 ) = (s1 − 1) + (s2 − 1)n + . . . + (sk − 1)nk−1 n and 0 ≤ s j − 1 < n, hence s j = G(r, j, k) for 1 ≤ j ≤ k, where   . z −. 1 G(x, y, z) = F quo(n, x) − ∑i=0 ni , n, y + 1 and F is defined as in part (a). (This follows from part (a) if n > 1, and is easily seen to be true for n = 1, when s j = 1 for 1 ≤ j ≤ k and k = r.) Note that G is a primitive recursive function. Because of the inequalities satisfied by the s j , n + n2 + . . . + nk ≤ r ≤ n2 + . . . + nk+1 < n + n2 + . . . + nk+1 j and k ≤ r, so if we put N(x) = µ z ≤ x(x < ∑z+1 j=1 n ), and H(x, y) = G(x, y, N(x)), then k = N(r) and s j = H(r, j) for 1 ≤ j ≤ N(r). It follows that ϕ10 is 1-1. It is left to the reader to check that 1 ≤ H(x, y) ≤ n for all values of x and y. Hence

7 N(r)

r ∈ ϕ10 (A∗ ) ⇔ r =

∑ H(r, j)n j

j=1

and the right-hand side is a primitive recursive predicate, so ϕ10 is a G¨odel numbering. . N(r) Define h : N → N by h(r) = ∑ j=1 H(r, j)(n + 1) j − 1 , so h is primitive recursive and h ◦ ϕ10 = ϕ1 . m(r) Also define h0 ; N → N by h0 (r) = ∑ j=1 f (r, j)n j , where f and m are the functions defined in part (a). Then h0 is primitive recursive and h0 ◦ ϕ1 = ϕ10 . As in part (a), ϕ1 , ϕ10 have the same recursive and recursively enumerable subsets. (c) Take a new bijection {1, . . . , n} → A, say i 7→ bi , and let ϕ 2 be the function defined in the same way as ϕ2 but using this bijection. In view of (a) and (b), it suffices to show that ϕ2 and ϕ 2 define the same recursively enumerable and recursive subsets. Now bi = aσ (i) for some permutation σ of {1, . . . , n}. Define f : N → N by ( σ (i) if 1 ≤ i ≤ n f (i) = i otherwise a primitive recursive and bijective map. Define g : N → N by g(r) = 2log2 (r)

log2 (r)



f (log p (r))

pj

j

.

j=1

Then g ◦ ϕ 2 = ϕ2 . Similarly defining f 0 , g0 using σ −1 instead of σ (so f 0 = f −1 ), g0 ◦ ϕ2 = ϕ 2 . As before, ϕ2 , ϕ 2 have the same recursively enumerable and recursive subsets. (d) It is enough to show that ϕ2 (B∗ ) is recursive, in view of (a) and (b), and in view of (c), we can choose the bijection {1, . . . , n} → A such that B = {a1 , a2 , . . . , as }, where 0 ≤ s ≤ n. Then r ∈ ϕ2 (B∗ ) ⇔ (r ∈ ϕ2 (A∗ )) ∧ (log p j (r) ≤ s for 1 ≤ j ≤ log2 (r)) ⇔ (r ∈ ϕ2 (A∗ )) ∧ (∀ j ≤ log2 (r)(( j = 0) ∨ (log p j (r) ≤ s)) and the right-hand side is a primitive recursive predicate. 2. The TM’s are constructed as follows (in all cases, q0 is the initial state). R: has set of states Q = {q0 , q} and transitions q0 aqaR (0 ≤ a ≤ r − 1). L: defined similarly, replacing R by L in the transitions. e Q = {q0 , q, q0 , h}, transitions R: q0 aq0 aR (a 6= 0), q0 0q0R, qaq0 aR (a 6= 0), q0q0 0R, q0 ahaL

8

where 0 ≤ a ≤ r − 1. e defined similarly, interchanging L and R in the transitions. L: P1 (i): Q = {q0 , q1 , . . . , qi } with transitions q0 aq1 1R, q1 aq2 1R, . . . , qi−1 aqi 1R where 0 ≤ a ≤ r − 1. P0 (i): defined similarly, replacing 1 by 0 in the transitions. Test {T0 , T1 , . . . , Tr−1 }: first rename the states of T0 , . . . , Tr−1 so they have no states in common, and let pi denote the initial state of Ti . The states of Test {T0 , T1 , . . . , Tr−1 } are the states of every Ti , together with some new states denoted by p00 , . . . , p0r−1 and q0 , where q0 is the initial state. The transitions of Test {T0 , T1 , . . . , Tr−1 } are the transitions of every Ti , together with the transitions q0 ap0a aR, p0a bpa bL, (for 0 ≤ a, b ≤ r − 1). 3. Suppose L, L0 are r.e. languages, so L = LG , L0 = LG0 for some type 0 grammars G = (VN ,VT , P, S), G0 = (VN0 ,VT0 , P0 , S0 ), by Theorem 3.12. By Lemma A.1 in Appendix A, we can assume all productions in P and P0 are either of the form α −→ β where α, β are strings of non-terminal symbols, or of the form A → a, where A is a non-terminal symbol and a is a terminal symbol. We can also assume VN ∩ VN0 = 0. / Choose a new symbol S00 not occurring in the symbols 0 00 of G, G , and let G be the grammar (VN ∪ VN0 ∪ {S00 } ,VT ∪ VT0 , P00 , S00 ), where P00 = P ∪ P0 ∪ {S00 −→ SS0 } . Then LG00 = L L0 ; the proof is left to the reader.

Chapter 4 1. First, we use Lemma 4.6 to convert the set of productions to S −→ AA|b A −→ aA|BBB|b B −→ b (The set U in the proof of Lemma 4.6 is {(S, S), (A, A), (B, B), (S, B), (A, B)}.) Now, using the procedure in the first part of the proof of Theorem 4.7, we add a new variable C and convert the set of productions to S −→ AA|b A −→CA|BBB|b B −→ b C −→ a

9

Then using the second part of the proof, we add a new variable D and convert the productions to S −→ AA|b A −→CA|BD|b B −→ b C −→ a D −→ BB Giving the required grammar in Chomsky normal form. 2. First, we convert to Chomsky normal form, as in the previous exercise. Lemma 4.6 gives the set of productions S −→ SA|a A −→ Ab|a B −→ Ab Now B is clearly a useless symbol and we can omit it and the last production (this is in accordance with the procedure of Lemma 4.5). Applying the procedure of Theorem 4.7 to the resulting grammar gives the productions S −→ SA|a A −→ AC|a C −→ b where C is a new variable, and so a grammar in Chomsky normal form. Use the procedure in the proof of Theorem 4.10, putting A1 = S, A2 = A and A3 = C. Three new variables, B1 , B2 and B3 are added. The procedure in the first two paragraphs of that proof give the following set of productions. S −→ a|aB1 B1 −→ A|AB1 A −→ a|aB2 B2 −→C|CB2 C −→ b (Thus B3 is not needed and can be omitted.) The final part of the proof then gives the following set of productions, and so the required grammar in Greibach Normal Form.

10

S −→ a|aB1 B1 −→ a|aB1 |aB2 |aB2 B1 A −→ a|aB2 B2 −→ b|bB2 C −→ b (The S, A, C-productions are in the required form and the B1 , B2 -productions are converted using Lemma 4.8.) Note that, as before, we can remove the variable C and the production C −→ b. 3. If a step in a G-derivation from S to a terminal string uses the production A −→ uv, it can be replaced by two steps using the productions A −→ uC and C −→ v in succession. Doing this for each such step results in a G0 -derivation from S to the same terminal string. hence LG ⊆ LG0 . If a step in a rightmost G0 -derivation from S to a terminal string uses the production A −→ uC, then after this step C is the rightmost variable and the next step must use the production C −→ v. These two steps can be replaced by a single step using A → uv. Doing this repeatedly results in a derivation from S to the same terminal string, with no use of A −→ uC, and therefore no occurrence of C, as this is the only production of G0 with an occurrence of C on the righthand side. Therefore the derivation does not use the production C −→ v, so is a G-derivation. Hence LG0 ⊆ LG . The last part is proved similarly, but by considering leftmost derivations. 4. (a) If there is a production of the form A −→ uBv with u 6= ε 6= v, add a new variable C (one for each such production) and replace the production by the two productions A −→ uC and C −→ Bv. This gives a grammar generating L by Exercise 3 (with v replaced by Bv). Repeating this for every such production gives the required grammar. (b) Proceed as in the proof of Lemma 4.17, beginning with a grammar in the form of part (a) generating L. The procedure of Lemma 4.1 gives a grammar in the same form generating L \ {ε} with no ε productions, and then applying the procedure of Lemma 4.6 gives a grammar in the same form with, additionally, no productions A −→ B, where B is a variable, generating L \ {ε}. If A → v is a production, where v = x1 . . . xn (n ≥ 2) is a string of terminals, add new variables B1 , . . . , Bn−1 and replace this production by the productions A −→ x1 B1 , B1 −→ x2 B2 , . . . , Bn−2 −→ xn−1 Bn−1 , Bn−1 −→ xn . If a production has the form A −→ vB, proceed similarly, but the last production should be Bn−1 −→ xn B. If a production has the form A −→ Bv, the production should be replaced by the productions

11

A −→ Bn−1 xn , Bn−1 −→ Bn−2 xn−1 , . . . , B2 −→ B1 x2 , B1 −→ Bx1 . As in the proof of Lemma 4.17, the new grammar generates L by Exercise 3. (In the final case, the new variables are added one by one by first adding Bn−1 and replacing A → Bv by A −→ Bn−1 xn and Bn−1 −→ Bx1 . . . xn−1 and so on.) Repeating this for every production not in the required form gives the desired grammar. (c) Applying the procedure in parts (a) and (b) to the grammar in Example (3), p.3, leads to the grammar G = ({A, B, S} , {0, 1} , P, S) where P consists of the productions S −→ 0A|0B A −→ S1 B −→ 1 in the required form, generating {0n 1n | n > 0}. An alternative is to replace P by the set of productions consisting of S −→ 0A A −→ B1|1 B −→ 0A 5. Let G be a linear grammar of the form in Exercise 4(b) generating L \ {ε}, and let k be the number of variables of G. If T is a parsing tree with yield a terminal string w, and the maximum level of a vertex is l, then |w| = l. This is easily proved by induction on l. (The right-hand side of a production has length at most 2. If l = 1, the minimum possible, the root has a single successor with label w ∈ VT .) Put p = k + 1. If z ∈ L and |z| ≥ p, then z ∈ LG and there is an S-tree T (S being the start symbol) with yield z. From the previous paragraph, if l is the maximum level of a vertex of T , then l ≥ k + 1. Let v0 be the root, and let v0 , v1 , . . . , vl be the vertices of a path from v0 to a vertex of level l. Only vl can have a terminal as label, so two of the k + 1 vertices v0 , . . . , vk must have the same label, say vr and vs both have label A, where 0 ≤ r < s ≤ k. Then vr is the root of a subtree of T which is an A-tree, say T1 , and vs is the root of a subtree of T1 which is also an A-tree, say T2 . Let w be the yield of T2 . Removing T2 from T1 (except for vs ) gives an A-tree T10 with root vr and yield vAx for some v, x, and the yield of T1 is vwx. Now vr must have two successors, corresponding to a production A −→ aB or A −→ Ba, where B is a variable and a is a terminal. For otherwise vr+1 would be a leaf, which is impossible as r + 1 ≤ s < l. Both successors are in T10 , hence |vAx| ≥ 2, so v, x are not both ε.

12

Further, vs has level s, so the maximum level of a vertex of T2 is l − s. Hence |w| = l − s. The yield of T is uvwxy = z and |z| = l, so |uvxy| = s ≤ k < p. Also, the tree obtained by removing T1 from T (except for vr ) is an S-tree with yield uAy. It follows from Lemma 4.2 that

.

S −→ uAy, G

.

A −→ vAx, G

and

.

A −→ w

.

G

.

and it follows by induction on i that S −→ uvi Axi y, hence S −→ uvi wxi y, for all G

i ≥ 0.

G

6. A context-free grammar generating L = {0m 1m 0n 1n | m, n > 0} is G = ({A, B, S} , {0, 1} , P, S) where P consists of the productions S −→ AB A −→ 0A1|01 B −→ 0B1|01 Suppose L is linear, and let p be as in the previous exercise. Choose m, n > p; then 0m 1m 0n 1n = uvwxy as in the Pumping Lemma, and |u|, |y| ≤ |uvxy| ≤ p, so u = 0k , y = 1l for some non-negative integers k, l ≤ p. Then vwx = 0m−k 1m 0n 1n−l and m − k > 0, n − l > 0. If v has a prefix of the form 0m−k 1, then uv2 wx2 y is not in L, contrary to the Pumping Lemma, since it has more than two occurrences of subwords of the form 01. Hence v = 0i for some i ≥ 0. Similarly, considering subwords of the form 10, x has no suffix 01n−l , so x = 1 j for some j ≥ 0. Since v, x are not both ε, uv2 wx2 y = 0m+i 1m 0n 1n+ j with at least one of i, j non-zero, so this word is not in L, a contradiction. Hence L is not linear. A more direct solution is possible. Suppose G is a linear grammar generating L, with start symbol S. Consider a derivation of a word 0m 1m 0n 1n in L from S. Initially, words in this derivation will have the form 0r A1s , where A is a variable, r, s ≥ 0. Eventually, either a letter 0 will appear to the right of the variable (after 1 has appeared n times on the right), or a letter 1 will appear to the left of the variable (after 0 has appeared m times on the left). Let the variable when one of these occurs be Am,n . Thus, for all pairs (m, n),

. . or (2) S −→ 0 1A

. . −→ 1

either (1) S −→ 0r Am,n 01n , Am,n −→ 0m−r 1m 0n−1 , for some r ≥ 0 m

s m,n 1 ,

Am,n

Also, at least one of the following is true:

m−1 n n−s

0 1

, for some s ≥ 0.

13

(a) infinitely many values of n occur in the pairs (m, n) for which (1) holds (b) infinitely many values of m occur in the pairs (m, n) for which (2) holds. If (a) holds, then since there are only finitely many variables, there are pairs (m, n), (m0 , n0 ) and natural numbers r, r0 such that n 6= n0 , Am,n = Am0 ,n0 and

.

.

0

0

0

0

S −→ 0r Am,n 01n , Am0 ,n0 −→ 0m −r 1m 0n −1 .

.

0

0

0

0

0

0

0

0

It follows that S −→ 0m −r +r 1m 0n 1n , a contradiction since 0m −r +r 1m 0n 1n 6∈ L. 0 0 0 0 Similarly, if (b) holds, then S −→ 0m 1m 0n 1n −s +s for some m, m0 , n0 , s, s0 with 0 m 6= m , a contradiction. Hence no such grammar G exists.

.

Chapter 5 1. (a) From xyx = yxy we obtain the consequence x2 yx2 = xyxyx, hence using the other relation, y7 = xyxyx = yxy2 x, so y6 = xy2 x. Since y6 = x4 , we conclude that x4 = xy2 x, hence x2 = y2 , so y3 = y2 which implies y = 1. Now from xyx = yxy it follows that x2 = x, so x = 1. (b) It follows that yx = x2 y and from xyx−1 = y2 we obtain xy2 = x2 yx−1 = y, hence xy = 1, so yx = x2 y implies yx = x, hence y = 1. Then xy = 1 implies x = 1. (c) Firstly, x2 yx−2 = xy2 x−1 = y4 , hence y4 = (zxz−1 )y(zx−1 z−1 ) = zx(zy)x−1 z−1 = z(xzx−1 )(xyx−1 )z−1 = z(xzx−1 )y2 z−1 = zx−1 zy2 z−1 = zx−1 z−1 z2 y2 z−1 = x−2 z2 y2 z−1 so y2 = x−2 z2 y2 z−1 y−2 = x−2 z2 z−4 = x−2 z−2 , giving x2 y2 z2 = 1. It follows that x2 (xyx−1 )z2 = 1, so x3 y(x−1 z2 ) = 1, hence x3 yzx−1 = 1, which implies x2 yz = 1. Together with x2 y2 z2 = 1, this gives y2 z2 = yz, so yz = 1. Then from x2 yz = 1 we obtain x2 = 1, so zxz−1 = x2 = 1, hence x = 1. Now xyx−1 = y2 implies y = 1, and then yzy−1 = z2 implies z = 1 (or just use the observation that the relations are unchanged by cyclic permutation to conclude y = z = 1). 2. The proof, as indicated in the hint, is by induction on n. Let Gn be the group with the given presentation. It is true for n = 2 since G2 is cyclic of order 2, as is S2 .

14

(Indeed, it is true for n = 1 as the empty presentation presents the trivial group.) Assume n > 2 and Gn−1 ∼ = Sn−1 . By Lemma 5.2 there is a homomorphism Gn → Sn sending xi to the transposition (i, i + 1) for 1 ≤ i ≤ n − 1, which is surjective as these transpositions generate Sn (an easy exercise). Hence it suffices to show |Gn | ≤ n!. By Lemma 5.2, there is a surjective homomorphism Gn−1 → H sending xi to xi for 1 ≤ i ≤ n − 2, hence |H| ≤ (n − 1)!. It is therefore enough to show (Gn : H) ≤ n. This will follow if we can show that any coset of H is in the set T = {H, Hxn−1 , Hxn−1 xn−2 , . . . , Hxn−1 xn−2 . . . x2 x1 } and to do this it suffices to show that if Hy ∈ T , then Hyxi±1 ∈ T for 1 ≤ i ≤ n − 1. Since xi = xi−1 , we need to show that Hxn−1 . . . xi x j ∈ T for 1 ≤ i ≤ n, 1 ≤ j ≤ n − 1. ( Here Hxn−1 . . . xi is to be interpreted as H when i = n.) To do this, first note that xi x j = x j xi if |i − j| > 1 and x j−1 x j x j−1 = x j x j−1 x j for 1 < j ≤ n − 1. If i = j then Hxn−1 . . . xi x j = Hxn−1 . . . xi+1 ∈ T . If i < j then Hxn−1 . . . xi x j = Hxn−1 . . . x j x j−1 x j x j−2 . . . xi = H(xn−1 . . . x j+1 )x j−1 (x j x j−1 x j−2 . . . xi ) = Hx j−1 (xn−1 . . . xi ) = Hxn−1 . . . xi ∈ T

since j − 1 ≤ n − 2, so x j−1 ∈ H. Finally, if j < i, there are two cases. If j = i − 1, then Hxn−1 . . . xi x j = Hxn−1 . . . xi xi−1 ∈ T. If j < i − 1 then Hxn−1 . . . xi x j = Hx j xn−1 . . . xi = Hxn−1 . . . xi ∈ T since j ≤ n − 2, so x j ∈ H. 3. Once again, let Gn be the group with the given presentation and use induction on n. It is true for n = 3 since G3 is cyclic of order 3, as is A3 . Assume n > 3 and Gn−1 ∼ = An−1 . By Lemma 5.2, there is a surjective homomorphism Gn → An sending x1 to the 3-cycle (1, 2, 3), and xi to (1, 2)(i + 1, i + 2) for 2 ≤ i ≤ n − 2, hence it suffices to show |Gn | ≤ 21 n!. (To see that these elements generate An , let K be the subgroup they generate. Show that there exists σi ∈ K such that σi (i) = n for 1 ≤ i ≤ n. If τ ∈ An , and τ(n) = i, then σi τ ∈ An−1 . One can then use induction on n.) There is a surjective homomorphism Gn−1 → H sending xi to xi for 1 ≤ i ≤ n−3, hence |H| ≤ 12 (n − 1)! and it is enough to show (Gn : H) ≤ n. Let  T = H, Hxn−2 , Hxn−2 xn−3 , . . . , Hxn−2 xn−3 . . . x2 x1 , Hxn−2 xn−3 . . . x2 x12 .

15

It suffices to show T xi = T for 1 ≤ i ≤ n − 2. (Since xi permutes the cosets of H, and T is finite, it follows that xi acts as a permutation of T , with inverse xi−1 , so T xi±1 = T . As in the previous exercise, it follows that any coset of H is in T .) The relations imply xi x1 = x1−1 xi and xi x1−1 = x1 xi for i > 2, so Hxn−2 . . . xi x1 = Hxn−2 . . . xi+1 x1−1 xi = Hxn−2 . . . x1 xi+1 xi = . . . = Hx1±1 xn−2 . . . xi = Hxn−2 . . . xi for i > 2. The remaining cosets Hxn−2 . . . x2 , Hxn−2 . . . x2 x1 and Hxn−2 . . . x2 x12 are clearly permuted by x1 , and it follows that T x1 = T . Next, we show that T x2 = T . For i > 3, the relations imply xi x2 = x2−1 xi−1 = x2 xi , so Hxn−2 . . . xi x2 = Hx2 xn−2 . . . xi = Hxn−2 . . . xi . Also, Hxn−2 . . . x3 and Hxn−2 . . . x3 x2 are interchanged by x2 . The relations (x1 x2 )3 = x22 = x13 = 1 imply that x2 x1 x2 = x1−1 x2 x12 , hence Hxn−2 . . . x2 x1 x2 = Hxn−2 . . . x1−1 x2 x12 = Hx1±1 xn−2 . . . x2 x12 = Hxn−2 . . . x2 x12 since xi x1 = x1−1 xi for i ≥ 3. Further, the relations imply x2 x12 x2 = x1 x2 x1 , so Hxn−2 . . . x2 x12 x2 = Hxn−2 . . . x3 x1 x2 x1 = Hx1±1 xn−2 . . . x2 x1 = Hxn−2 . . . x2 x1 . It remains to show T x j = T for j > 2. For j < i − 1, Hxn−2 . . . xi x j = Hxn−2 . . . xi as x j commutes with xn−2 , . . . , xi and x j ∈ H. Right multiplication by x j interchanges Hxn−2 . . . x j and Hxn−2 . . . x j+1 . For 2 ≤ i < j, note that the relations imply x j x j−1 x j = x j−1 x j x j−1 for j > 2, so Hxn−2 . . . xi x j = Hxn−2 . . . x j x j−1 x j . . . xi = Hxn−2 . . . x j−1 x j x j−1 . . . xi = Hx j−1 xn−2 . . . xi = Hxn−2 . . . xi . Finally, since x12 = x1−1 , x1 x j = x j x12 and x12 x j = x j x1 , so Hxn−2 . . . x1 x j = Hxn−2 . . . x j x12 = Hx j−1 xn−2 . . . x12 = Hxn−2 . . . x2 x12 and Hxn−2 . . . x12 x j = Hxn−2 . . . x2 x j x1 = Hx j−1 xn−2 . . . x2 x1 = Hxn−2 . . . x1 (using x j x j−1 x j = x j−1 x j x j−1 as in the previous case). This completes the proof. 4. Let f : F(X) → G be the extension of the inclusion mapping X → G to a homomorphism. Assume (a) and α : X → H is a mapping, where G is a group. Then α has e : F(X) → H by Lemma 5.5. Then a unique extension to a homomorphism α α f −1 is the unique extension of α to a homomorphism G → H hence (a) implies (b).

16

Assume (b). Let α : X → F(X) be the inclusion map, β : G → F(X) the extension of α to a homomorphism.Then if g ∈ G is represented by the non-empty reduced word u, β (g) = u 6= 1 by Lemma 5.4, so g 6= 1. Hence (b) implies (c). Finally the condition on reduced words in (c) implies that f : F(X) → G has trivial kernel, and if X generates G then f is onto. Hence (c) implies (a). 5. First, suppose F is a free group with basis X, and V is a vector space over Z/2Z with basis X. The inclusion mapping X → V extends to a homomorphism F → V of groups. The kernel contains F 2 , so there is an induced homomorphism F/F 2 → V , which is a linear mapping of vector spaces. It follows that the natural projection mapping F → F/F 2 is injective on X and the image of X is a Z/2Z basis for F/F 2 . Hence |X| is the dimension of F/F 2 over Z/2Z. Now an isomorphism from F1 to F2 induces an isomorphism of vector spaces F1 /F12 → F2 /F22 , so they have the same dimension, hence |X1 | = |X2 |. Conversely, suppose f : X1 → X2 is a bijective map. Then viewed as a mapping X1 → F2 , by Lemma 5.5, there is an extension to a homomorphism fe : F1 → F2 . Similarly, putting g = f −1 , g has an extension to a homomorphism ge : F2 → F1 . Now both ge fe and idF1 extend the inclusion mapping X1 → F1 to a homomorphism F1 → F1 , so by Lemma 5.5, ge fe = idF1 . Similarly, fege = idF2 , hence fe is an isomorphism. 6. Let X be a basis for F and let Y be a finite set of generators for F. For y ∈ Y , let uy be a word in (X ±1 )∗ representing y. Let X1 be the finite subset of X consisting of all elements x ∈ X which occur in uy (either as x or as x−1 ) for some y ∈ Y . Then Y is a subset of the subgroup of F generated by X1 hence F is generated by X1 . By Question 4, no non-empty reduced word in (X ±1 )∗ represents the identity element of F, so no non-empty reduced word in (X1±1 )∗ represents the identity element. Again by Question 4, X1 is a finite basis for F. (It follows easily that X = X1 .) 7. Take a reduced word in (Y ±1 ), say u1 . . . un , where u j = xi j ye j x−i j (i j ∈ N, e j = ±1), which represents an element g of F. The reduced word in {x, y}±1 representing g has the form xi1 ye1 v1 ye2 v2 . . . vn−1 yen x−in , where each vi is a power of x or x−1 , possibly empty. This follows by induction on n. Now use Question 4 to finish the proof. 8. Suppose F is free with basis X. Let Fx be the subgroup of F generated by x. Then Fx is infinite cyclic by Lemma 5.4, and the inclusion maps Fx → F, for x ∈ X, extend uniquely to a homomorphism x∈X Fx → F. This is an isomorphism by Lemma 5.4 and the normal form theorem for free products. (Alternatively, the inclusion mapping X → x∈X Fx extends uniquely to a homomorphism F → x∈X Fx ; show that this is the inverse map.) Conversely, assume F = i∈I Fi , where Fi is infinite cyclic for i ∈ I. For i ∈ I, choose a generator xi of Fi and let X = {xi | i ∈ I}. Then F is free with basis X. For given α : X → H, where H is a group, there is a homomorphism αi : Fi → H given by αi (xin ) = α(xi )n for n ∈ Z. Now the αi have a unique extension to a e : F → H, and α e is the unique extension of α to a homomorhomomorphism α phism, as required.





∗ ∗

17

9. (a) Part of the Cayley graph for a free group with basis {x, y} is drawn below.

O /

/

y2

O O

O /

yx−1 O

/

/

O /

x−2 O

O /

xy

O O

/

O

O /

x−1 y

/ yx

y

/

/

x−1

/

/

x−1 y−1 O

/

/

O

y−1 x−1

O

/

/

y−1

/

/ O

xy−1 O

O /

O

x

1

O

/

y−2 O

O

O y−1 x

O x2 O

/

/

/ O

/

The vertices are represented by the intersections of the lines, which are labelled with the vertex represented. The arrows indicate edges with labels x or y, the horizontal arrows having label x and the vertical arrows label y. (The graph is a tree, which follows from the normal form theorem for free groups.) If Fn is the finite subgraph whose vertex set is the set of all vertices at distance less than or equal to n from the vertex 1, and the edges having their endpoints in this set, then removing this set of edges leaves a graph with 4.3n−1 infinite components. (For the definition of distance in this context, see p.109.) It follows that the free group of rank 2 has infinitely many ends. (b) We can take the free abelian group to be Z × Z with basis {x, y}, where x = (1, 0) and y = (0, 1). The Cayley diagram is partly drawn on the next page.

18

O

O

/

O

/

O

/

O

/

O

/

O

/

O

/ /

(−1, 1)

(1, 1)

O

O

/

/

/

(0, 0)

O

O

(1, 0)

/

O

O

/

(−1, −1)

O

O

/

(−1, 0)

/

/

(0, 1)

O /

/

(1, 2)

/

O

(0, −1)

/

O

(1, −1)

O

As in part (a), the intersections of the lines represent the vertices (the set of vertices is the set of points in the plane R2 with integer coordinates). As before, the horizontal arrows have label x and the vertical ones have label y. (Usually one would use additive notation for this group, but in multiplicative notation, for example, (1, 2) = xy2 = y2 x.) Removing the edges of a finite subgraph always leaves a single infinite component, so the free abelian group of rank 2 has one end. (c) Let x = (1, 2, 3), y = (1, 2). The entire Cayley graph is drawn on the next page. Here the group and the graph are finite, so the number of ends is zero. The six vertices are represented by the vertices of the triangles, which as before are labelled with the group element they represent. The edges labelled x are represented by the arrows on the sides of the triangles, and edges labelled y are represented by arrows on the thicker, curved lines. (Any choice of 3-cycle and transposition will give a graph with this shape.)

19

yx2 

O

x2  

1 

y

_ _

x /

_

?  /

yx

Appendix C 1. Suppose B is countable. Then there is a surjective mapping f : N → B. Writing bn+1 for f (n), we can write B in a list B = {b1 , b2 , . . .}. By definition, we can write b1 = 0.a11 a12 a13 . . . b2 = 0.a21 a22 a23 . . . .. .. . . bi = 0.ai 1 ai 2 ai 3 . . . .. .. . . where ai j is either 0 or 1, for all integers i, j ≥ 1. Define ai = 1 − aii for i ≥ 1, then put b = 0.a1 a2 a3 . . ., an element of B since ai is either 0 or 1 for all i. Therefore b = bi for some i, which is impossible as the decimal expansions of b and bi differ in the ith position (ai 6= aii ), a contradiction. Hence B is uncountable. 2. Suppose A is primitive recursive. Then the function f : N2 → N defined by f (x, y) = A(x, y) + 1 is also primitive recursive. Hence there exists k ∈ N such that, for all x, y ∈ N, f (x, y) ≤ A(k, max{x, y}). Take x = y = k, to obtain A(k, k) + 1 ≤ A(k, k), a contradiction. (For more on Ackermann’s function, see [5, §3.6.2].)

http://www.springer.com/978-1-84800-939-4