1 Introduction

Starting from Mal’cev’s description of congruence permutability as in [16], the problem of characterizing properties of classes of varieties as Mal’cev conditions has led to several results. In [17] Pixley found a strong Mal’cev condition defining the class of varieties with distributive and permuting congruences. In [10] Jónsson shows a Mal’cev condition characterizing congruence distributivity, in [7] Day shows a Mal’cev condition characterizing the class of varieties with modular congruence lattices.

These results are examples of a more general theorem obtained independently by Pixley [18] and Wille [21] that can be considered as a foundational result in the field. They proved that if \(p \le q\) is a lattice identity, then the class of varieties whose congruence lattices satisfy \(p \le q\) is the intersection of countably many Mal’cev classes. [18] and [21] include an algorithm to generate Mal’cev conditions associated with congruence identities.

These researches have also led to the problem of studying equations where the variables run not only over the congruence lattices but in possibly strictly larger sets as the lattices of all tolerances or of all compatible reflexive relations. Results about this problem can be found in [6, 8, 9, 12, 14, 15, 20].

Let R and T be two binary relations on a set A. Then we define the k-fold relational product, in symbols \(\circ ^{(k)}\), of R and T by:

$$\begin{aligned} R \circ ^{(k)} T&= \{(a,b) \in A^2 \mid \exists c_0,\dots c_k \in A \text { s.t. } c_0 = a, c_k = b,\\&\quad (c_{i}, c_{i+1}) \in R \text { for }i\text { even}, (c_{i}, c_{i+1}) \in T \text { for }i\text { odd}\} \end{aligned}$$

We denote by \(\circ \) the 2-fold relational product of two relations and we denote by \(R+T = \bigcup _{i\in {\mathbb {N}}}R\circ ^{(i)}T\).

The aim of this paper is to study the relationship between congruence equations and compatible reflexive relation equations. We denote by \(\mathrm {Crr}({\mathbf {A}})\) the set of all compatible reflexive relations of \({\mathbf {A}}\). Let \({\mathbf {A}}\) be an algebra and let p and q be terms for the language \(\{\wedge , +, \circ \}\), where \(\wedge \) is the set-theoretical intersection. Then we say that \({\mathbf {A}}\) satisfies the compatible reflexive relation equality (inequality) \(p \approx q\) \((p \le q)\) if and only if \(\mathrm {Crr}({\mathbf {A}})\) satisfies \(p \approx q\) \((p \le q)\). Let \(\mathcal {V}\) be a variety. Then we say that \(\mathcal {V}\) satisfies \(p \approx q\) \((p \le q)\) if and only if every algebra in \(\mathcal {V}\) satisfies \(p \approx q\) \((p \le q)\). These equations are of interest since Mal’cev conditions are often express in term of this type of equations.

In Section 4 we study the connection between Mal’cev conditions and compatible reflexive relation inequalities. We provide a self-contained proof of an algorithm, claimed by Tschanz [19, pages 273–274] without a proof and similar to the one of Pixley–Wille [18], which allows us to compute a Mal’cev condition described by the property of satisfying a particular compatible reflexive relation equation.

Theorem 1.1

Let p and q be two n-ary terms for the language \(\{\wedge , \circ , +\) \(\}\) with p \(+\)-free. Then the class of varieties such that \(p \le q\) holds in \(\mathrm {Crr}(A)\) for all \(A \in \mathcal {V}\) is a Mal’cev class. Furthermore, if q is \(+\)-free then the class of varieties such that \(p \le q\) holds in \(\mathrm {Crr}(A)\) for all \(A \in \mathcal {V}\) is a strong Mal’cev class.

Our contribute will be the proof of this theorem that provides several examples of descriptions of Mal’cev conditions.

In Section 5 we give a characterization of an interesting set of equations which describe the same Mal’cev condition when considered with variables that run over the set of all compatible reflexive relations or over the congruence lattices.

In [13] it has been shown that, under a weak assumption on the term p, a variety satisfies the congruence identity \(p(\alpha _1,\dots , \alpha _n) \le q(\alpha _1,\dots ,\alpha _n)\) if and only if it satisfies the tolerance identity \(p(T_1,\dots ,T_n\) \() \le q(T_1,\dots ,T_n)\), provided we restrict the set of the variables to run over the representable tolerances, i.e. tolerances of the form \(R \circ R^{-1}\) where R is a compatible reflexive relation.

Our main result, Theorem 5.1, provides a sufficient criterion to check whether an inequality \(p \le q\) describes the same Mal’cev condition considered as compatible reflexive relation inequality and as congruence inequality. The hypothesis of this theorem is quite restrictive for p and q but, in Section 5, we provide two examples showing that is quite difficult to extend this hypothesis.

2 Notation

Let \({\mathbf {A}}\) be an algebra and let \(X \subseteq A^2\). We denote by \(\mathrm {Crg}_{{\mathbf {A}}}(X)\) the compatible reflexive relation generated by the set of pairs X. Let R and L be two binary relations on A. Furthermore, we denote by \(\mathrm {Eqv}(R)\) the equivalence relation generated by a relation R.

Let p be a term for the language \(\{\wedge ,+,\circ \}\). Let \(k \in {\mathbb {N}}\). We denote by \(p^{(k)}\) the \(\{\wedge ,\circ \}\)-term obtained from p substituting any occurrence of \(+\) with the k-fold relational product \(\circ ^{(k)}\).

We denote by [n] the set \(\{i \in {\mathbb {N}}\mid 1 \le i \le n\}\) and by \([n]_0\) the set \([n] \cup \{0\}\).

3 Labelled graphs and regular terms

In order to show the main results we recall the definition of a regular term introduced in [13]. Let p be a term for the language \(\{\circ ,\wedge \}\). We define inductively the set \(L_p\) and \(R_p\) of variables on the left and right side of p respectively.

  1. (i)

    If \(p = X_i\) is a variable, then \(L_p = \{X_i\}\) and \(R_p = \{X_i\}\);

  2. (ii)

    if \(p = q \circ r\), then \(L_p = L_q\) and \(R_p = R_r\);

  3. (iii)

    if \(p = q \wedge r\), then \(L_p = L_q \cup L_r\) and \(R_p = R_q \cup R_r\).

Definition 3.1

The class of regular terms is the smallest class of \(\{\circ , \wedge \}\)-terms that:

  1. (1)

    contains all the variables;

  2. (2)

    contains \(p = q \circ r\) whenever q and r are regular and \(R_q \cap L_r = \emptyset \);

  3. (3)

    contains \(p = q \wedge r\) whenever q and r are regular, \(L_q \cap L_r = \emptyset \), and \(R_q \cap R_r = \emptyset \).

Hence examples of regular terms are \(X \wedge (Y \circ Z)\) and \(X \wedge (Y \circ X \circ Y)\). Instead, \(X \circ X\) and \(X \wedge (Y \circ Z \circ X)\) are not regular. We can see that the majority of the known Mal’cev conditions given by congruence equations can be characterized by a congruence equation of regular terms.

The definition of a regular term can be better understood by means of the notion of the labelled graph associated with a term as in [2,3,4,5], and [12]. We show how to build the labelled graph associated with a \(\{\circ ,\wedge \}\)-term p.

Definition 3.2

Let S be a set of labels. Then a labelled graph is a directed graph (VE) with a labelling function \(l :E \rightarrow S\).

We denote by \((v_1,v_2)\) an edge connecting the vertex \(v_1\) to \(v_2\). Following [12], let p be a \(\{\wedge ,\circ \}\)-term. We start with the graph \({\mathbf {G}}_1(p)\) having an edge \((y_1,y_2)\), labelled with p, connecting two vertices \(y_1\) and \(y_2\).

Starting from \({\mathbf {G}}_1(p)\) we build a finite sequence of graphs \({\mathbf {G}}_1(p), \dots , \) \({\mathbf {G}}_l(p) = {\mathbf {G}}(p)\) such that for all \(i \in [l]\) we select an edge \((y_j,y_k)\), connecting vertices \(y_k\) and \(y_j\), from \({\mathbf {G}}_i(p)\) labelled with a term w that is not a variable. Then we have two cases:

if \(w = u \wedge v\), then \({\mathbf {G}}_{i+1}(p)\) is obtained from \({\mathbf {G}}_i(p)\) by replacing the edge \((y_j,y_k)\) labelled w with two edges \((y_j,y_k)\) labelled u and v respectively, and both connecting the same vertices.

If \(w = u \circ v\), then \({\mathbf {G}}_{i+1}(p)\) is obtained from \({\mathbf {G}}_i(p)\) by introducing a new vertex \(y_t\) and replacing the edge labelled w with two edges \((y_j,y_t)\) and \((y_t,y_k)\), labelled u and v respectively, and connecting the same vertices in serial through the new vertex. The sequence ends when all the edges are labelled with variables.

We can observe that a term is regular if in its graph, all the edges adjacent to any given vertex are labelled differently.

We denote by \(Y = \{y_1 ,\dots , y_m\}\) the set of vertices and we denote by capital letters the variables of p labelling the graph \({\mathbf {G}}(p)\). The main reason to introduce \({\mathbf {G}}(p)\) is stated in [5, Proposition 3.1] and in Claim 4.8 of [12]. The latter can be generalized to tolerances as in [13, Proposition 2.1] and also to relations in general.

Proposition 3.3

Let \({\mathbf {A}}\) be an algebra, let \(R_i \subseteq A \times A\), for \(1 \le i \le n\), and let p be a \(\{\circ ,\wedge \}\)-term. Then:

  1. (1)

    Let \(Y \rightarrow A:y_s \mapsto a_s\) be an assignment such that for all edges \((y_i, y_j)\) with label \(X_k\) of \({\mathbf {G}}(p)\), we have \((a_i,a_j) \in R_k\). Then \((a_1, a_2) \in p(R_1,\dots ,\) \(R_n)\).

  2. (2)

    Conversely, given any \((a_1, a_2) \in p(R_1,\dots ,R_n)\), there is an assignment \(Y \rightarrow A :y_s \mapsto a_s\) extending \(y_1 \mapsto a_1\), \(y_2 \mapsto a_2\) such that \((a_i,a_j) \in R_k\) whenever \((y_i, y_j)\) is an edge labelled with \(X_k\) of \({\mathbf {G}}(p)\), where \((y_1,y_2)\) is the only edge of the graph \({\mathbf {G}}_1(p)\).

4 The Algorithm

In this section we show the Algorithm in [18] and [21] and we then modify the last part of it in order to obtain a Mal’cev condition describing the class of varieties that satisfy the compatible reflexive relation equation \(p \le q\).

Let \(p \le q\) be an equation for the language \(\{\wedge , \circ \}\). Let \({\mathbf {G}}(p)\) and \({\mathbf {G}}(q)\) be obtained from p and q (Definition in Section 2) with the procedure in Section 3. Then we define the sets of pairs:

$$\begin{aligned} \begin{aligned} T_s(p)&:= \{(x_i,x_j) \mid (y_i,y_j) \text { is an edge of } {\mathbf {G}}(p) \text { with label } X_s \};\\ Tt_s(q)&:=\{(t_i,t_j) \mid (y_i,y_j) \text { is an edge of } {\mathbf {G}}(q) \text { with label } X_s\}, \end{aligned} \end{aligned}$$
(4.1)

where the elements \(\{t_1,\dots ,t_l\}\) of the pairs in \(Tt_s(q)\) are m-ary terms with \(t_1 = \pi _1^m\) and \(t_2 = \pi _2^m\) in the variables \(\{x_1,\dots ,x_m\}\), m is the number of vertices in \({\mathbf {G}}(p)\), and where \(\pi _i^m\) is the m-ary term \(x_i\).

Algorithm 4.1

Let \(p \le q\) be an equation for the language \(\{\wedge , \circ \}\). Let \({\mathbf {G}}(p)\) and \({\mathbf {G}}(q)\) be obtained from p and q with the procedure in Section 3. Let us consider \(T_s(p) \) and \(Tt_s(q) \) as in (4.1).

Next we define \(\mathrm {Eq}(p \le q)\) as the set of all equations of the form:

$$\begin{aligned} t_i(x_{i_1},\dots ,x_{i_m}) \approx t_j(x_{i_1},\dots ,x_{i_m}) \end{aligned}$$

such that \((t_i,t_j) \in Tt_s(q)\) and the vector of indices \((i_1,\dots ,i_m) \subseteq {\mathbb {N}}^n\) satisfies \(i_d = \mathrm {min}(i \mid (x_{i}, x_d) \in \mathrm {Eqv}(T_s(p))) \) for all \(d \in [m]\). This means that the variables that are in the equivalence relation generated by the pairs in \(T_s(p)\) are collapsed.

We modify the last part of the Algorithm in [18, 21] in order to obtain a set of equations \(\mathrm {Eq}^{R}(p \le q)\) that characterizes the Mal’cev condition describing the class of varieties which satisfy \(p \le q\) over the set of all compatible reflexive relations.

Algorithm 4.2

Let \(p \le q\) be an equation for the language \(\{\wedge , \circ \}\). Let \({\mathbf {G}}(p)\) and \({\mathbf {G}}(q)\) be obtained from p and q with the procedure in Section 3. Let us consider \(T_s(p) \) and \(Tt_s(q) \) as in (4.1).

Let c(s) be the cardinality of \(T_s(p)\) and let us set an order of these pairs \(\{(y_{i_t},y_{j_t})\}_{1 \le t \le c(s)} = T_s(p)\). We define \(\mathrm {Eq}^{R}(p \le q)\) as the set of all equations of the form:

$$\begin{aligned} t_{(i,j,s)}(x_1,\dots ,x_m,y_{i_1},\dots ,y_{i_{c(s)}})&\approx t_i(x_1,\dots ,x_m) \\ t_{(i,j,s)}(x_1,\dots ,x_m,y_{j_1},\dots ,y_{j_{c(s)}})&\approx t_j(x_1,\dots ,x_m), \end{aligned}$$

such that \((t_i,t_j) \in Tt_s(q)\), \(t_{(i,j,s)}\) is an \((m + c(s))\)-ary term.

Note that the c(s)! ways to generate the equations given by \((t_i,t_j) \in Tt_s(q)\) and \(T_s(p)\) in the Algorithm 4.2 give different terms \(t_{(i,j,s)}\)s but equivalent conditions, up to reordering of the variables.

Lemma 4.3

Let \(p(X_1,\dots ,X_n)\) be an m-ary regular \(\{\circ ,\wedge \}\)-term and let the set \(\{T_i(p)\}_{1 \le i \le n}\) be obtained with the Algorithm 4.2. Let \(V = \{y_1,\dots ,y_m\}\) be the set of vertices of \({\mathbf {G}}(p)\). Then for all \(i \in [n] \) the equivalence relation on V generated by the pairs in \(T_i(p)\) is composed by classes of cardinality at most 2.

Proof

The proof follows from the definition of regular term since in a graph of a regular term there cannot be two adjacent edges labelled with the same variable. \(\square \)

The next lemma is the main ingredient to prove Theorem 5.1. Indeed, this allows us to understand some properties fulfilled by Mal’cev conditions described by congruence inequalities with at most one occurrence of \(\circ \) in the right hand side of the equation.

Let \({\varvec{a}}\) be a vector and let R be an irreflexive and antisymmetric relation over the set of all components of \({\varvec{a}}\) which generates an equivalence relation with classes of at most 2 elements. This means that \(\mathrm {Eqv}(R)\) is associated with a graph whose edges are disjoint and undirected. Let us denote by \({\varvec{a}}^{(R,l)}\) and \({\varvec{a}}^{(R,r)}\) the vectors such that if \((({\varvec{a}})_i,({\varvec{a}})_j) \in R\), then \(({\varvec{a}}^{(R,l)})_i = ({\varvec{a}}^{(R,l)})_j = ({\varvec{a}})_i\), \(({\varvec{a}}^{(R,r)})_i = ({\varvec{a}}^{(R,r)})_j = ({\varvec{a}})_j\). If \(({\varvec{a}})_i\) does not occur in pairs of R, then \(({\varvec{a}}^{(R,l)})_i = ({\varvec{a}}^{(R,r)})_i = ({\varvec{a}})_i\).

Lemma 4.4

Let pq be terms for the language \(\{\circ ,\wedge \}\), with p regular. Let \((t_i,t_j) \in Tt_k(q)\) with \(k \in {\mathbb {N}}\). Then the following equations are logical consequences of \(\mathrm {Eq}(p \le q)\):

$$\begin{aligned}&t_i({\varvec{x}}^{(T_k(p),l)}) \approx t_j({\varvec{x}}^{(T_k(p),l)})\\&t_i({\varvec{x}}^{(T_k(p),r)}) \approx t_j({\varvec{x}}^{(T_k(p),r)}). \end{aligned}$$

The next lemma is what allows us to characterize conditions described by compatible reflexive relation equations and is an equivalent statement for compatible reflexive relations of what is also called Mal’cev argument [1, Lemma 12.1].

Lemma 4.5

Let \(\mathcal {V}\) be a variety of type \({\mathcal {F}}\) and let \({\mathbf {F}}_{\mathcal {V}}({\overline{X}})\) be the free algebra generated by \({\overline{X}} = \{{\overline{x}}_1,\dots ,{\overline{x}}_n\}\) in \(\mathcal {V}\). Let \(N \subseteq {\overline{X}}^2\backslash \Delta _{{\overline{X}}}\) where \(\Delta _{{\overline{X}}}\) is the diagonal of \({\overline{X}}^2\), let \(\{(k_i,z_i)\}_{i \in I} \subseteq {\overline{X}}^2\) be such that \(\{({\overline{k}}_i,{\overline{z}}_i)\}_{i \in I} = N\), and let \(K = \mathrm {Crg}_{{\mathbf {F}}_{\mathcal {V}}({\overline{X}})}(N)\). Let \(p, q \in T(X)\) be such that \((p^{{\mathbf {F}}_{\mathcal {V}}({\overline{X}})}({\overline{x}}_1,\dots ,{\overline{x}}_n),q^{{\mathbf {F}}_{\mathcal {V}}({\overline{X}})}({\overline{x}}_1,\) \(\dots ,{\overline{x}}_n)) \in K\). Then there exists \(t \in T(X \cup Y)\) with \(Y = \{y_1,\dots ,y_m\}\) and such that the equations:

$$\begin{aligned} p(x_1,\dots ,x_n)&\approx t(x_1,\dots ,x_n,k_1,\dots ,k_m)\\ q(x_1,\dots ,x_n)&\approx t(x_1,\dots ,x_n,z_1,\dots ,z_m) \end{aligned}$$

hold in \(\mathcal {V}\).

With these tools we are ready to show an analogon of the Pixley–Wille algorithm [18, 21] for equations concerning compatible reflexive relations, which was claimed in [19, pages 273–274] without a proof. Thus we show a proof of the algorithm in [19, pages 273–274] using a similar technique to [11, Proposition 1.4].

Proposition 4.6

Let p and q be two n-ary terms for the language \(\{\wedge , \circ , +\}\) with p \(+\)-free. The class of varieties such that \(p \le q\) holds in \(\mathrm {Crr}(A)\) for all \(A \in \mathcal {V}\) is a Mal’cev class described by the family of equations \(\{\mathrm {Eq}^R(p \le q^{(k)}) \}_{k \in {\mathbb {N}}\backslash \{1\}}\). Furthermore, if q is \(+\)-free is a strong Mal’cev class described by \(\mathrm {Eq}^R(p \le q)\).

Proof

Suppose that \(p \le q\) holds for the set of all the compatible reflexive relations of algebras in \(\mathcal {V}\), with p and q n-ary terms. Let \(T_i(p)\) be constructed from p as in (4.1) and let \(V = \{y_1,\dots ,y_m\}\) be the set of vertices of \({\mathbf {G}}(p)\), the graph associated with p. Let \({\mathbf {F}} = {\mathbf {F}}_{\mathcal {V}}(\{x_1,\dots ,x_m\})\) be the m-generated free algebra in \(\mathcal {V}\). Then for all \(i = 1, \dots ,n\) let \(R'_i\) be the compatible reflexive relation of \({\mathbf {F}}\) defined by:

$$\begin{aligned} R'_i = \mathrm {Crg}_{{\mathbf {F}}}(T_i(p)). \end{aligned}$$

Then, from Proposition 3.3 item (1), it follows that:

$$\begin{aligned} (x_1,x_2) \in p(R'_1,\dots ,R'_n) \subseteq q(R'_1,\dots ,R'_n), \end{aligned}$$

through the assignment \(y_s \mapsto x_s\). Hence there exists a \(k \in {\mathbb {N}}\backslash \{1\}\) such that \((x_1,x_2) \in q^{(k)}(R'_1,\dots ,R'_m)\). We prove that \(\mathcal {V}\) satisfies \(\mathrm {Eq}^{R}(p \le q^{(k)})\). To this end let \(Z = \{z_1,\dots ,z_u\}\) be the set of vertices of \({\mathbf {G}}(q^{(k)})\). Let us consider the pair of equations

$$\begin{aligned} \begin{aligned} t_{(i,j,s)}(x_1,\dots ,x_m,y_{i_1},\dots ,y_{i_{c(s)}}) \approx \&t_i(x_1,\dots ,x_m)\\ t_{(i,j,s)}(x_1,\dots ,x_m,y_{j_1},\dots ,y_{j_{c(s)}})\approx \&t_j(x_1,\dots ,x_m), \end{aligned} \end{aligned}$$
(4.2)

such that \((t_i,t_j) \in Tt_s(q^{(k)})\), \(t_{(i,j,s)}\) is an \((m + c(s))\)-ary term, where \(c(s) = |T_s(p)|\), and the set of pairs \(\{(y_{i_t},y_{j_t})\}_{1 \le t \le c(s)} = T_s(p)\). We know that \((x_1 ,x_2) \) \(= (\pi _1^m,\pi _2^m) \in q^{(k)}(R'_1,\dots ,R'_n)\) thus, by (2) of Proposition 3.3, there is an assignment \(z_s \mapsto r_s(x_1,\dots ,x_m)\) from \(Z \rightarrow {\mathbf {F}}\) that extends \(z_1 \mapsto x_1\), \(z_2 \mapsto x_2\) such that \((r_i,r_j) \in R'_s\) whenever \((z_i, z_j)\) is an edge labelled with \(X_s\) of \({\mathbf {G}}(q^{(k)})\). Hence \((r_i,r_j) \in R'_s\) implies, by Lemma 4.5, that there exists an \((m + c(s))\)-ary term \(t_{(i,j,s)}\) such that \(\mathcal {V}\) satisfies (4.2), where \(t_i^{{\mathbf {F}}}(x_1,\dots ,x_m) = r_i\) and \(t_j^{{\mathbf {F}}}(x_1,\dots ,x_m) = r_j\).

Conversely, suppose that there exists \(k \in {\mathbb {N}}\backslash \{1\}\) such that \(\mathrm {Eq}^R(p \le q^{(k)})\) holds in \(\mathcal {V}\). Then let \({\mathbf {A}} \in \mathcal {V}\), \(a_1,a_2 \in A\), and let \(R'_1,\dots ,R'_n \in \mathrm {Crg}({\mathbf {A}})\) be such that:

$$\begin{aligned} (a_1,a_2) \in p(R'_1,\dots ,R'_n) \end{aligned}$$

we want to prove that

$$\begin{aligned} (a_1, a_2) \in q^{(k)}(R'_1,\dots ,R'_n). \end{aligned}$$

From (2) of Proposition 3.3 we have that there exists an assignment \(\psi :Y \rightarrow A\) extending \(y_1 \mapsto a_1\),\(y_2 \mapsto a_2\) such that \(y_s \mapsto a_s\), with \((a_i,a_j) \in R'_s\) whenever \((y_i,y_j)\) is an \(X_s\)-labelled edge of \({\mathbf {G}}(p)\).

Let \(Z = \{z_1,\dots ,z_u\}\) be the set of vertices of \({\mathbf {G}}(q^{(k)})\) and let \(|T_s(p)| = c(s) \). From the hypothesis we have that for all \((t_i,t_j) \in T_s(q^{(k)})\), there exists an \(m + c(s)\)-ary term \(t_{(t_i,t_j,s) }\) such that:

$$\begin{aligned} t_{(i,j,s)}(x_1,\dots ,x_m,y_{i_1},\dots ,y_{i_{c(s)}})&\approx t_i(x_1,\dots ,x_m)\\ t_{(i,j,s)}(x_1,\dots ,x_m,y_{j_1},\dots ,y_{j_{c(s)}})&\approx t_j(x_1,\dots ,x_m) \end{aligned}$$

are satisfied in \({\mathbf {A}}\), where \(\{(y_{i_t},y_{j_t})\}_{1 \le t \le c(s)} \) \(= T_s(p)\). From the definition of the assignment \(\psi \) we have:

$$\begin{aligned} t_i(a_1,\dots ,a_m)&= t_{(i,j,s)}(a_1,\dots ,a_m,a_{i_1},\dots ,a_{i_{c(s)}})\\&R'_s\ t_{(i,j,s)}(a_1,\dots ,a_m,a_{j_1},\dots ,a_{j_{c(s)}}) \\ {}&=t_j(a_1,\dots ,a_m). \end{aligned}$$

Let \(\rho :Z \rightarrow A\) be the assignment such that \(z_1 \mapsto a_1\),\(z_2 \mapsto a_2\) and \(z_i \mapsto t_i(a_1,\dots ,a_m)\) for all \(3 \le i \le u\). Thus we have that \((t_i(a_1,\dots ,a_m), \) \( t_j(a_1,\dots ,\) \(a_m)) \in R'_s\) whenever \((z_i,z_j) \in {\mathbf {G}}(q^{(k)})\). By (1) of Proposition 3.3, we have that \((a_1,a_2) \in q^{(k)}(R'_1,\dots ,R'_n) \subseteq q(R'_1,\dots ,R'_n)\). Thus the class of varieties such that \(p \le q\) holds in \(\mathrm {Crr}(A)\) for all \(A \in \mathcal {V}\) is a Mal’cev class described by the family of equations \(\{\mathrm {Eq}^R(p \le q^{(k)}) \}_{k \in {\mathbb {N}}\backslash \{1\}}\). Furthermore, if q is \(+\)-free is a strong Mal’cev class described by \(\mathrm {Eq}^R(p \le q)\). \(\square \)

Proof of Theorem 1.1

The proof follows from Proposition 4.6. \(\square \)

We show an application of this Algorithm.

Theorem 4.7

Let \(\mathcal {V}\) be a variety and let \(n \in {\mathbb {N}}\backslash \{1\}\). Then the following are equivalent:

  1. (1)

    \(\mathcal {V}\) satisfies the compatible reflexive relation inequality:

    $$\begin{aligned} R \wedge (S \circ T) \le T \circ S \circ (R \wedge S) \circ ^{(n)} (R \wedge T); \end{aligned}$$
  2. (2)

    there exist \(2n+2\) 4-ary terms \(s_0,s_1,t_0,\dots ,t_{2n-1}\) and \(n+3\) ternary terms \(p_0,p,m_0,\dots ,\) \(m_n\) such that \(\mathcal {V}\) satisfies:

    $$\begin{aligned}&x \approx p_0(x,y,z), m_n(x,y,z) \approx z,&\\&x \approx s_0(x,y,z,y),&\\&p(x,y,z) \approx s_0(x,y,z,z) \approx s_1(x,y,z,x),&\\&m_0(x,y,z) \approx s_1(x,y,z,y),&\\ {}&t_{2i}(x,y,z,x)\approx m_i(x,y,z),&\\ {}&t_{2i}(x,y,z,z)\approx m_{i+i}(x,y,z),&\\ {}&t_{2i+1}(x,y,z,x)\approx m_i(x,y,z)&\text {for }i\text { even}, \\ {}&t_{2i+1}(x,y,z,y)\approx m_{i+i}(x,y,z)&\text {for }i\text { even}, \\ {}&t_{2i+1}(x,y,z,y)\approx m_i(x,y,z)&\text {for }i\text { odd}, \\ {}&t_{2i+1}(x,y,z,z)\approx m_{i+i}(x,y,z)&\text {for }i\text { odd.} \end{aligned}$$

5 Equations equivalent over congruences and over compatible reflexive relations

In this section we give a characterization of an interesting set of equations which describe the same Mal’cev condition when considered with variables that run over the set of all compatible reflexive relations or over the congruence lattices. In [13] Lipparini showed that if p is a regular term, a variety satisfies the congruence identity \(p(\alpha _1,\dots , \alpha _n) \le q(\alpha _1,\dots ,\alpha _n)\) if and only if satisfies the tolerance identity \(p(T_1,\dots ,\) \(T_n) \le q(T_1,\dots ,\) \(T_n)\), provided we restrict the set of the variables to run over the representable tolerances, i.e. tolerances of the form \(R \circ R^{-1}\) where R is a compatible reflexive relation. It is also proved that both the properties to be regular for a term and to be representable for tolerances are not so restrictive. Instead, in the case of the compatible reflexive relations, the hypotheses on the equation \(p \le q\) are restrictive.

Theorem 5.1

Let pq be terms of the same arity for the language \(\{\circ , \wedge \}\) with p regular and q with at most one occurrence of \(\circ \). Let \(\mathcal {V}\) be a variety. Then the following are equivalent:

  1. (1)

    \(\mathcal {V}\) satisfies the compatible reflexive relation inequality \(p \le q\);

  2. (2)

    \(\mathcal {V}\) satisfies the congruence inequality \(p \le q\).

Proof

The implication \((1)\Rightarrow (2)\) is obvious. For \((2)\Rightarrow (1)\) let \(\mathcal {V}\) be a variety that satisfies \(p \le q\). Let \(\mathrm {Eq}(p \le q)\) the set of equation obtained using the Algorithm 4.1. From [18, 21] we have that \(\mathcal {V}\) satisfies the Mal’cev-condition induced by \(\mathrm {Eq}(p \le q)\). Let \({\mathbf {A}}\) be an algebra, \(R_1^*,\dots ,R_n^* \in \mathrm {Crr}({\mathbf {A}})\), and let \(a_1,a_2 \in A\) be such that \((a_1,a_2) \in p(R_1^*,\dots ,R_n^*)\). By (2) of Proposition 3.3, there exist elements \(a_3,\dots ,a_m\) \(\in A\), where m is the number of vertices \(Y = \{y_1,\dots ,y_m\}\) of \({\mathbf {G}}(p)\), and an assignment \(\psi :Y \rightarrow A\) such that \(y_i \mapsto a_i\), for \(1 \le i \le m\), and \((a_i,a_j) \in R^*_k\) whenever \((y_i,y_j)\) is an edge of \({\mathbf {G}}(p)\) with label \(X_k\). Let us denote by \({\varvec{a}} = (a_1,\dots ,a_m)\) and by \({\varvec{x}} = (x_1,\dots ,x_m)\). The goal is to prove that \((a_1,a_2) \in q(R_1^*,\dots ,R_n^*)\). We need to distinguish between two cases.

Case q with no occurrence of \(\circ \):

In this case we obtain equations satisfied by either only the trivial variety or all varieties. We have that \({\mathbf {G}}(q)\) has only two vertices \(\{z_1,z_2\} =Z\). Let us fix the assignment \(\rho :Z \rightarrow A\) such that \(z_1 \mapsto a_1\) and \(z_2 \mapsto a_2\). We prove that this assignment satisfies (1) of Proposition 3.3. To this end let \((z_1,z_2)\) be an edge of \({\mathbf {G}}(q)\) labelled by \(X_k\). By Lemma 4.4, we have that \({\mathbf {A}}\) satisfies the equation \(\pi _1^m({\varvec{x}}^{(T_k(p),l)}) \approx \pi _2^m({\varvec{x}}^{(T_k(p),l)})\). Hence

$$\begin{aligned} a_1 = \pi _1^m({\varvec{a}}^{(T_k(p),l)}) = \pi _2^m({\varvec{a}}^{(T_k(p),l)})\ R^*_k\ \pi _2^m({\varvec{a}}) = a_2. \end{aligned}$$

Case q with exactly one occurrence of \(\circ \):

In this case we apply the original Pixley–Wille algorithm 4.1 to \(p \le q\) finding the set of equations \(\mathrm {Eq}(p \le q)\). We see that \({\mathbf {G}}(q)\) has only three vertices and hence the equations in \(\mathrm {Eq}(p \le q)\) involve only three m-ary terms \(\pi _1^m,\pi _2^m,t\).

Let \(Z= \{z_1,z_2,z_3\}\) be the set of vertices of \({\mathbf {G}}(q)\). Let us define the assignment \(\rho :Z \rightarrow A\) such that \(z_i \mapsto a_i\), for \(i = 1,2\), and \(z_3 \mapsto t(a_1,\dots ,a_m)\). Next we prove that the assignment \(\rho \) satisfies the hypothesis in (1) of Proposition 3.3. To this end let us suppose that \((z_i,z_j)\) is an edge of \({\mathbf {G}}(q)\) labelled with \(X_k\). We can observe that \((t_i,t_j) \in Tt_k(q)\) where \(t_1 = \pi _1^m\), \(t_2 = \pi _2^m\), and \(t_3 = t\). Then we have three cases.

Subcase \((i,j) = (1,2)\): in this case the proof is identical to the one of q with no occurrence of \(\circ \).

Subcase \((i,j) = (1,3)\): by Lemma 4.4, we have that \({\mathbf {A}}\) satisfies the equation \(\pi _1^m({\varvec{x}}^{(T_k(p),l)}) \approx t({\varvec{x}}^{(T_k(p),l)})\). Hence

$$\begin{aligned} a_1 = \pi _1^m\ ({\varvec{a}}^{(T_k(p),l)})\ = t({\varvec{a}}^{(T_k(p),l)}) \ R^*_k\ t({\varvec{a}}). \end{aligned}$$

Subcase \((i,j) = (3,2)\): in this case the proof is symmetrical to Subcase \((i,j) = (1,3)\). By Lemma 4.4, we have that \({\mathbf {A}}\) satisfies the equation \(\pi _2^m({\varvec{x}}^{(T_k(p),r)}) \approx t({\varvec{x}}^{(T_k(p),r)})\). Hence

$$\begin{aligned} t({\varvec{a}}) \ R^*_k\ t({\varvec{a}}^{(T_k(p),r)}) = \pi _2^m({\varvec{a}}^{(T_k(p),r)}) = a_2. \end{aligned}$$

Thus \(\rho \) satisfies the hypothesis in (1) of Proposition 3.3 and \((a_1,a_2) \in q(R_1^*,\dots ,R_n^*)\). \(\square \)

We can see that the hypotheses of Theorem 5.1 are difficult to expand. Indeed the equation \(X \circ X \le X\) for compatible reflexive relations implies congruence permutability but is satisfied by all the varieties if the variables run over the congruence lattices. Moreover, the equation

$$\begin{aligned} R \wedge (S \circ T) \le (R \wedge S) \circ (R \wedge T) \circ (R \wedge S) \end{aligned}$$

implies majority for compatible reflexive relations [15], but when the variables run over the congruence lattices implies only 3-distributivity, which is strictly weaker. With the following theorem we show an example of application of Theorem 5.1 that can be deduced also from [15, page 6].

Theorem 5.2

Let \(\mathcal {V}\) be a variety. Then the following are equivalent:

  1. (1)

    \(\mathcal {V}\) satisfies the congruence inequality

    $$\begin{aligned} \alpha \wedge (\beta \circ \gamma ) \le (\alpha \wedge \beta ) \circ \gamma ; \end{aligned}$$
  2. (2)

    \(\mathcal {V}\) satisfies the compatible reflexive relation inequality

    $$\begin{aligned} R \wedge (S \circ T) \le (R \wedge S) \circ T. \end{aligned}$$

The proof of this theorem follows from Theorem 5.1 and clearly these two conditions imply majority.

We can also observe the following equivalence of equations.

Theorem 5.3

Let \({\mathbf {A}}\) be an algebra. Then the following are equivalent:

  1. (1)

    \({\mathbf {A}}\) satisfies the compatible reflexive relation inequality

    $$\begin{aligned} R \wedge (S \circ T) \le (R \wedge S) \circ T; \end{aligned}$$
  2. (2)

    \({\mathbf {A}}\) satisfies the compatible reflexive relation inequality

    $$\begin{aligned} R \wedge (S \circ T) \le (R \wedge S) \circ (R \wedge T). \end{aligned}$$