Let $A\neq \emptyset$ be arbitrary set. Let us define a relation on $A$ in the following way: $R=\{(a;b;c)\in A^3| a=b \lor b=c\}$. Show that the clone of polymorphisms of $R$ denoted as $Pol(\{R\})$ is the clone of all operations of the form $(x_1;…;x_n)\mapsto g(x_i):A^n \rightarrow A$ for some $i \in \{1;2;…;n\}$ and some $g:A \rightarrow A$.
It is a routine exercise to show that such set of operation infact is a clone and any function of the form specified above is compatible with $R$. However, I struggle to show that any function $f:A^k \rightarrow A$ that is compatible with $R$ is of the form $f(x_1;…;x_n)=g(x_i)$ for some $i \in \{1;2;…;n\}$ and some $g:A \rightarrow A$.
My approach:
Firstly, choose $f$ compatible with $R$ of arity $k \in \mathbb{N}$. Pick $a$ from the set $A$ and define $g:A\rightarrow A; g(a):=f(a;a;…;a)$. Now I would like to show that $\exists i \in \{1;2;…;k\} \forall x_1,…,x_k \in A: f(x_1;…;x_{i-1};x_i;x_{i+1};…;x_k)=g(x_i)$.
If $A=\{a\}$, then it holds. However, I have no idea what to do if $|A|\geq 2$.
I was trying to deduce something by applying $f$ row-wise onto the matrices of the form (and other similar forms)
\begin{align} f\begin{bmatrix} a&a& \ldots &a& \ldots & a & a\\ a&a& \ldots &a&\ldots & a & a\\ a&a& \ldots & b & \ldots & a& a\end{bmatrix}=\begin{bmatrix}g(a)\\g(a)\\f(a;a;…;b;…;a;a)\end{bmatrix} \in R \end{align} but I have failed so far. (the row-wise application of $f$ is from the definition of compatibility - the columns are in $R$) Since I’ve been stuck on this for quite some time now, it is entirely possible that the function $g$ doesn’t work, but I have no better ideas.