A recursive definition of palidrome over {a,b}

1.1k Views Asked by At

Can someone please explain how this recursive definition produces palindromes over $\{a,b\}$? For example, how can we get the string $abaaaba$ as a valid string?

Rule 1: $\epsilon$, $a$, and $b$ are in $PALINDROME$.

Rule 2: If $w \in PALINDROME$, then so are $awa$ and $bwb$.

Rule 3: No other string is in $PALINDROME$ unless it can be produced by rules $1$ and $2$.

1

There are 1 best solutions below

0
On BEST ANSWER

Since $a$ is in PALINDROME, so is $aaa$. Since $aaa$ is in PALINDROME, so is $baaab$. Since $baaab$ is in PALINDROME, so is $abaaaba$. This solves your question.