write a recursive definition of strings

127 Views Asked by At

How would I construct a recursive definition for a function f, on strings over the alphabet {a,b,c} such that f(x) returns the same string expect every occurrence of b is replaced by c.

1

There are 1 best solutions below

0
On

$f:\{a,b,c\}^n \to \{a,b,c\}^n$

Defined by $f(\alpha_1,...,\alpha_n) =(\alpha_1*\mathbb{1}_{\alpha_1 \neq b}+c\mathbb{1}_{\alpha_1 = b},...,\alpha_n*\mathbb{1}_{\alpha_n \neq b}+c\mathbb{1}_{\alpha_n = b})$