Define a binary operation which is commutative but not associative for an alphabet.

114 Views Asked by At

Let $A = \{a,b\}$ be an alphabet.

Define a binary operation $\diamond: A^* \times A^* \rightarrow A^*$, which is commutative but not associative. Prove that your operation has the two properties.


My answer: I wanted to create an operation which compares two letters at the same index. If they are the same letters it will become $a$. And if they are different letters it will become $b$. If $|w_1| \neq |w_2|$ empty words would be used.

$\forall i \in \mathbb{N}$ $\forall w_1(i), w_2(i) \in A^*:\\ w_1(i) \diamond w_2(i) = \begin{cases} a, \text{if they are the same letters at i} \\ b, \text{if they are different letters at i}\end{cases}$

So I'm not quite sure how to define that.

For the prove wouldn't I have to take two random words out of $A^*$ and compare them:

Let $w_1(i), w_2(i) \in A^*$.

If anyone has an easier solution, that would be quite helpful.

1

There are 1 best solutions below

0
On BEST ANSWER

Your definition of $\diamond$ is not clear. I suppose that $w(i)$ denotes the $i$-th letter of $w$. But then, you should define $w_1 \diamond w_2$ (and not $w_1(i) \diamond w_2(i)$ as you do). Moreover, whatever definition you take, you should prove that it is commutative, but not associative.

One possibility would be to define $u \diamond v = a^{||u|-|v||}$ where $||u|-|v||$ is the absolute value of the difference between the lengths of $u$ and $v$. It is clearly commutative, but it is not associative, since $(a \diamond (a^2 \diamond a^3) = a \diamond a = 1$ but $(a \diamond a^2) \diamond a^3 = a \diamond a^3 = a^2$.