-2

I have a finite alphabet Σ and Σ* refers to the set of all finite strings over Σ.

1) Given x, y ∈ Σ* we say that x is a prefix of y if ∃z ∈ Σ* y = xz. If x is a prefix of y and y is a prefix of x what is the relationship between x and y?

I'm assuming it is a direct relationship because as x goes up so does y, but I'm not sure if that's correct.

2) For this part we assume that Σ = {a, b}. We write #a(x) for the number of occurrences of the letter a in the word x and similarly for #b. We claim that ∀x ∈ Σ*, ∃y, z ∈ Σ* such that x = yz ∧ [#a(y) = #b(z)].

Is this true? Prove or disprove.

1 Answers1

1

For your first question, if $x$ is a prefix of $y$ then there is a $z$ such that $y=xz$. Similarly, if $y$ is a prefix of $x$ then $x=yw$ for some $w$. Then $$ y=xz=ywz $$ and if we remove the characters in $y$ from both sides sequentially, we conclude that $wx=\epsilon$, the empty string, so $w=x=\epsilon$ and hence $y=x$.

Rick Decker
  • 15,016
  • 5
  • 43
  • 54