\chapter{Rectangulation}\label{rectangulation1}\index{rectangulation|(}

In this chapter we introduce a term condition for
rectangulation and prove a representation theorem for
rectangular tolerances. We explain how the structure of
rectangular tolerances improves in the presence of a join
term. We give three different Maltsev conditions that define
the class of varieties that omit rectangular tolerances.

\section{Rectangular Tolerances}

\begin{df}\label{rectangulation_defn}
  Let $S$ and $T$ be tolerances on an algebra $\m a$ and
  let~$\sqsupseteq$ be a compatible quasi-order on $\m a$
  (i.e., $\sqsupseteq$ is a reflexive, transitive, binary
  relation on $A$ that is a subuniverse of $\m a^2$).  Then
  {\bf $S$ rectangulates $T$ relative to
    $\sqsupseteq$}\index{rectangulation!defined} if for all
  $u\in A$ and all
  \begin{equation}\label{S,T-matrix3}
    \left[\begin{array}{cc} p&q\\ r&s \end{array}\right]
    \in M(S, T)\,,
  \end{equation}
  it is the case that
  \begin{equation}\label{rectangulation_imp}
    u\sqsupseteq q\quad\&\quad
    u\sqsupseteq r \quad\mimplies \quad
    u\sqsupseteq s\,.
  \end{equation}
  We indicate this by saying that {\bf $\C
    R(S,T;\sqsupseteq)$ 
    holds.}\index{$\C R(S,T;\sqsupseteq)$}
\end{df}

By interchanging the rows and columns of matrices one sees
that $\C {R}(S,T;\sqsupseteq)$ holds if and only if
\begin{equation}\label{nine}
  u\sqsupseteq q\quad\&\quad
  u\sqsupseteq r \quad\miff \quad
  u\sqsupseteq p \quad \&\quad
  u\sqsupseteq s
\end{equation} for every $u\in A$ and every $S,T$-matrix in
(\ref{S,T-matrix3}).

\begin{thm}\label{basic_rectangulation}
  Let $\m a$ be an algebra with tolerances $S$, $S'$, $T$,
  $T'$, compatible quasi-orders $\sqsupseteq$,
  $\sqsupseteq_j$ and a congruence~$\delta$.  Then the
  following are true.
  \begin{enumerate}
  \item[(1)] If\/ $\C R(S,T;\sqsupseteq)$ holds and
    $S'\subseteq S$, $T'\subseteq T$, then $\C
    R(S',T';\sqsupseteq)$ holds.
  \item[(2)] If\/ $\C R(S,T;\sqsupseteq_j)$ holds for all
    $j\in J$, then $\C R(S,T;\bigcap_{j\in J}{\sqsupseteq}_j)$
    holds.
  \item[(3)] Let\/ $\m b$ be a subalgebra of $\m a$.  If\/
    $\C R(S, T; \sqsupseteq)$ holds in $\m a$, then $\C
    R(S|_{\m b}, T|_{\m b}; {\sqsupseteq}|_{\m b})$ holds in
    $\m b$.
  \item [(4)] If $\sqsupseteq$ is $\delta$-closed (cf.\
    Section~\ref{the_term_condition}), then $\C R(S, T;
    \sqsupseteq)$ holds in~$\m a$ if and only if\/ $\C
    R(S/\delta, T/\delta; {\sqsupseteq}/\delta)$ holds in
    $\m a/\delta$.
  \item[(5)] $\C R(S,T;\sqsupseteq)$ holds if and only if\/
    $\C {R}(T,S;\sqsupseteq)$ holds.
  \item[(6)] $\C R(S,T;\delta)$ holds if and only if\/ $\C
    {SR}(S,T;\delta)$ holds.
  \end{enumerate}
\end{thm}

\begin{proof}
  Items (1)--(4) are proved in the same way as items (1),
  (6), (9) and (10) of Theorem~\ref{basic_centrality}.

  Item (5) follows from the fact that the transpose of an
  $S,T$-matrix is a $T,S$-matrix, and the definition of
  rectangulation is invariant under transpose (as indicated
  by (\ref{nine})).

  Item (6) follows from the fact that the definition of $\C
  {SR}(S, T; \delta)$ is the restriction of the definition
  of $\C {R}(S, T; \sqsupseteq)$ to the case where
  ${\sqsupseteq} = \delta$ is a congruence.
\end{proof}

It follows from Theorem~\ref{basic_rectangulation}~(2) that
for tolerances $S$ and $T$ on an algebra $\m a$ there is a
least compatible quasi-order $\sqsupseteq$ such that
\hbox{$\C R(S,T;\sqsupseteq)$} holds, namely the
intersection of all $\sqsupseteq_j$ such that $\C
R(S,T;\sqsupseteq_j)$ holds.  If some quasi-order
$\sqsupseteq_j$ is antisymmetric (equivalently, is a partial
order), then the intersection of all $\sqsupseteq_j$ will
also be antisymmetric. It is this situation that interests
us, so we make the following definition.

\begin{df}\label{rectangular_df}
  A tolerance $S$ {\bf rectangulates} a tolerance $T$ if $\C
  R(S,T;\sqsupseteq)$ holds for some compatible partial
  order $\sqsupseteq$.  If $S=T$ we say that $T$ is {\bf
    rectangular}.\index{tolerance!rectangular}\index{rectangular}

  If $\sqsupseteq$ is the least compatible quasi-order such
  that $\C R(S,T;\sqsupseteq)$ holds, then $[S,T]_{\bf R}$
  denotes the intersection of $\sqsupseteq$ with its
  converse $\sqsubseteq$ (${} := {\sqsupseteq}^{\cup}$).
\end{df}

If $S$ and $T$ are tolerances on $\m a$, $\sqsupseteq$ is
the least compatible quasi-order such that $\C
R(S,T;\sqsupseteq)$ holds, and $\delta = [S,T]_{\bf R}$ (${}
= {\sqsupseteq} \cap {\sqsubseteq}$), then $\delta$~is a
congruence on $\m a$ and $\sqsupseteq$ is $\delta$-closed.
Since $\C R(S,T;\sqsupseteq)$ holds, we get from
Theorem~\ref{basic_rectangulation}~(4) that $\C
R(S/\delta,T/\delta;{\sqsupseteq}/\delta)$ holds.  Since
${\sqsupseteq}/\delta$ is a compatible partial order on $\m
a/\delta$, this means that $S/\delta$ rectangulates
$T/\delta$ in $\m a/\delta$.  Moreover, it follows from
Theorem~\ref{basic_rectangulation}~(4) that $\delta =
[S,T]_{\bf R}$ is the least congruence on $\m a$ for which
this statement is true.  We record this as:

\begin{thm}\label{least_congruence}
  If\/ $S$ and $T$ are tolerances on $\m a$, then
  $[S,T]_{\bf R}$ is the least congruence $\delta\in\Con(\m
  a)$ such that $S/\delta$ rectangulates $T/\delta$ in $\m
  a/\delta$.
\end{thm}

If $S$ and $T$ are disjoint tolerances, then it follows from
Definition~\ref{rectangulation_defn} that $\C R(S,T;0)$
holds, and therefore $[S,T]_{\bf R} = 0$.  This describes a
trivial instance of rectangulation.  If it happens that
$S\cap T \neq 0$ yet still $[S,T]_{\bf R} = 0$, then the
intersection $S\cap T$ is a nontrivial rectangular
tolerance (by Theorem~\ref{basic_rectangulation}~(1)).  We
spend the rest of this section describing the structure of
such objects.

\begin{df}
  An operation $+$ on $A$ is a {\bf semilattice operation}
  on $A$ if it is
  \begin{enumerate}
  \item[(i)] idempotent: $\forall x\in A (x + x\approx x)$;
  \item[(ii)] commutative: $\forall x,y\in A (x + y\approx y
    + x)$; and
  \item[(iii)] associative: $\forall x,y,z\in A \big(x + (y
    + z) \approx (x + y) + z\big)$.
  \end{enumerate}

  If $T$ is a tolerance on an algebra $\m a$, then a partial
  operation $x + y$ on $\m a$ is a {\bf compatible
    semilattice operation on 
    $T$}\index{compatible semilattice operation} if
  \begin{enumerate}
  \item[(i)] $+\colon T\to \m a$ is a homomorphism (with $T$
    considered as a subalgebra of $\m a^2$); and
  \item[(ii)] $+$ is idempotent, commutative, and
    associative on each block of~$T$.
  \end{enumerate}
\end{df}

\begin{thm}\label{un_rect_repn_thm}
  Let\/ $\m a$ be an algebra and let\/ $\theta$ be a
  congruence on\/~$\m a$. If\/ $\theta$ supports a
  compatible semilattice operation, then\/ $\theta$ is
  rectangular.
\end{thm}

\begin{proof} Let $+$ be a compatible semilattice operation
  on $\theta$.  Define a relation $\sqsupseteq$ by
  \[
  a\sqsupseteq b\wrel{\miff}(a,b)\in\theta
  \quad\mbox{\rm and}\quad
  a=a+b\,.
  \]
  This is a partial order on $A$ due to the facts that
  $\theta$ is reflexive and transitive and $+$ is a
  semilattice operation on $\theta$-blocks.  It is
  compatible because $\theta$ and $+$ are.

  To show that $\m r(\theta,\theta;\sqsupseteq)$ holds, let
  \[
  \left[\begin{array}{cc} p&q\\ r&s\end{array}\right]=
  \left[\begin{array}{cc}
      f(\wec{a},\wec{u})&f(\wec{a},\wec{v})\\
      f(\wec{b},\wec{u})&f(\wec{b},\wec{v})
    \end{array}\right]
  \]
  be a $\theta,\theta$-matrix, and suppose that
  $u\sqsupseteq q$ and $u\sqsupseteq r$ for some $u\in
  A$. The definition of $\sqsupseteq$ forces the elements
  $u$, $q$ and $r$ to belong to the same $\theta$-block, and
  also forces $u = u+q = u+r$.  This $\theta$-block is
  closed under $+$, so $(u,q+r)\in\theta$. Moreover
  \[
  u = u+u = (u+q)+(u+r) = u+(q+r)\,,
  \]
  proving that $u\sqsupseteq q+r$. But
  \[
  \begin{array}{r@{}l}
    q+r &{} = f(\wec{a},\wec{v}) + f(\wec{b},\wec{u})\\
    &{} = f(\wec{a}+\wec{b},\wec{v}+\wec{u})\\
    &{} = f(\wec{a},\wec{u}) + f(\wec{b},\wec{v})\\
    &{} = p+s \sqsupseteq s\,,
  \end{array}
  \]
  so $u\sqsupseteq s$. This completes the proof.
\end{proof}

\begin{thm}\label{rect_repn_thm}
  Let\/ $\m a$ be an algebra and let\/ $T$ be a tolerance
  on\/~$\m a$. The following conditions are equivalent.
  \begin{enumerate}
  \item[(1)] $T$ is rectangular.
  \item[(2)] There is an algebra\/ $\widehat{\m a}\in {\vr
      V}(\m a)$ and a tolerance\/ $\widehat{T}$
    on~$\widehat{\m a}$ such that
    \begin{enumerate}
    \item[(i)] $\m a$ is a subalgebra of\/ $\widehat{\m a}$;
    \item[(ii)] $T\subseteq \widehat{T}|_A$;
    \item[(iii)] $\widehat{T}$ is rectangular; and
    \item[(iv)] $\widehat{T}$ supports a compatible
      semilattice operation.
    \end{enumerate}
  \end{enumerate}
\end{thm}

\begin{proof}
  For (2)$\mimplies$(1), we leave it to the reader to check
  our definitions and verify that whenever $\m a\leq
  \widehat{\m a}$, $\widehat{T}$ is a tolerance on
  $\widehat{\m a}$ for which $T\subseteq \widehat{T}|_A$,
  and $\widehat{T}$ rectangulates itself with respect to the
  partial order $\sqsupseteq$, then $T$ rectangulates itself
  with respect to the restricted partial order
  ${\sqsupseteq}|_A$.  (In particular, (2)(iv) is not needed
  to prove that (2)$\mimplies$(1).)  The real content of the
  theorem is the claim that (1)$\mimplies$(2).

  Assume that (1) holds, and that $\sqsupseteq$ is a
  compatible partial order on~$\m a$ for which ${\bf
    R}(T,T;\sqsupseteq)$ holds. We will construct
  $\widehat{\m a}$ from an algebra~$\m b$, defined as
  follows.  The universe of $\m b$ consists of the nonempty
  order ideals of the poset $\lb A; \sqsupseteq\rb$.  (A
  subset $I\subseteq A$ is an {\bf order
    ideal}\index{ideal!order ---} if $x\in I$ and
  $x\sqsupseteq y$ implies $y\in I$.)  If $f$ is a $k$-ary
  operation symbol in the language of $\m a$, and $I_1,
  \ldots, I_k\in B$, then $f^{\m b}(I_1,\ldots,I_k)$ is
  defined to be the order ideal $I$ generated by the set of
  all elements of the form $f^{\m a}(a_1,\ldots,a_k)$ with
  $a_i\in I_i$.  (Thus, $u\in I$ if and only if there exist
  $u_i\in I_i$ such that $f^{\m
    a}(u_1,\ldots,u_k)\sqsupseteq u$.)  If $a\in A$, write
  $\lb a\rb$ for the principal order ideal generated by $a$
  in $\lb A; \sqsupseteq \rb$.

  \begin{clm}\label{hom1}
    The function $\m a\to \m b\colon x\mapsto \lb x \rb$ is
    a one-to-one homomorphism.
  \end{clm}

  The fact that $\lb\;\rb$ is a 1-1 function follows from
  the fact that $\lb A;\sqsupseteq\rb$ is a partial order.
  To show that a typical $k$-ary basic operation $f$ is
  preserved by $\lb\;\rb$, choose $a_1,\ldots,a_k\in A$.
  The ideal $f^{\m b}\big(\lb a_1\rb,\ldots,\lb a_k\rb\big)$
  consists of all elements $u\in A$ for which there exist
  elements $u_i\in \lb a_i\rb$ such that $f^{\m
    a}(u_1,\ldots,u_k)\sqsupseteq u$.  But since
  $a_i\sqsupseteq u_i$ and $\sqsupseteq$ is compatible, this
  means that
  \[
  f^{\m a}(a_1,\ldots,a_k)\sqsupseteq f^{\m
    a}(u_1,\ldots,u_k)\sqsupseteq u\,.
  \]
  Thus $u\in f^{\m b}\big(\lb a_1\rb,\lb a_2\rb,\ldots,\lb
  a_k\rb\big)$ if and only if $u\in \lb f^{\m
    a}(a_1,\ldots,a_k)\rb$, which proves that $\lb\;\rb$ is
  a homomorphism.

  \medskip

  This claim shows that we may view $\m b$ as an extension
  of $\m a$. In order to define a tolerance $S$ on $\m b$
  whose restriction to $\m a$ contains $T$, we first define
  \[
  S' = \big\{(I,J)\in B^2\mid 
  (\forall u\in I)
  \big(\exists (v,w)\in (I\times J)\cap T\big)
  (v\sqsupseteq u)\big\}\,.
  \]
  Now let $S$ be the intersection of $S'$ and its converse.

  Let ${\vr L}$ be the language of $\m a$, and let ${\vr
    L}(\cup)$ be the expansion of the language to include
  the symbol $\cup$.  By interpreting $\cup$ in $\m b$
  as union of ideals we get an ${\vr L}(\cup)$-algebra
  $\lb \m b;\cup\rb$.

  \begin{clm}\label{tol}
    $S$ is a tolerance on $\lb\m b;\cup\rb$. Moreover, if
    $(a,b)\in T$, then $\big(\lb a\rb, \lb b\rb\big)\in S$.
  \end{clm}

  Since $S$ is the intersection of $S'$ and its converse, it
  will suffice to prove that $S'$ is a compatible reflexive
  relation of $\lb \m b;\cup\rb$, and that if $(a,b)\in
  T$, then $\big(\lb a\rb, \lb b\rb\big)\in S'$.

  Choose $I\in B$. For any $u\in I$ the pair $(u,u)\in
  (I\times I)\cap T$, so $(I,I)\in S'$.  This shows that
  $S'$ is reflexive.

  Next, suppose that $(I_i,J_i)\in S'$ for $1\leq i\leq k$,
  and that $f$ is a $k$-ary $\vr L$-operation.  Let $I =
  f(I_1,\ldots,I_k)$ and $J = f(J_1,\ldots,J_k)$. To see
  that $(I,J)\in S'$ let $u\in I$. There exist $u_i\in I_i$
  such that $f(u_1,\ldots,u_k)\sqsupseteq u$, by the
  definition of $\m b$, and there exist $(v_i,w_i)\in
  (I_i\times J_i)\cap T$ with $v_i\sqsupseteq u_i$, since
  $(I_i,J_i)\in S'$.  Since $\sqsupseteq$ is compatible,
  this means that
  \[
  v := f(v_1,\ldots,v_k)\sqsupseteq
  f(u_1,\ldots,u_k)\sqsupseteq u\,.
  \]
  Since $T$ is also compatible, for $w:=
  f(w_1,\ldots,w_k)\in J$ we have
  \[
  (v,w) = f\big((v_1,w_1),\ldots,(v_k,w_k)\big)\in T\,.
  \]
  Thus, for $u\in I$ (which was arbitrary) there exist
  $(v,w)\in (I\times J)\cap T$ such that $v\sqsupseteq
  u$. Hence $(I,J)\in S'$, showing that $S'$ is compatible
  with all $\vr L$-operations.

  To show that $S'$ is compatible with $\cup$, choose
  $(I',J'), (I'',J'')\in S'$ and let $(I,J) = (I'\cup I'',
  J'\cup J'')$.  Choose any $u\in I = I'\cup I''$. If
  $u\in I'$, then since $(I',J')\in S'$ there is a pair
  \[
  (v,w)\in \big((I'\times J')\cap T\big) \subseteq
  \big((I\times J)\cap T\big)
  \]
  such that $v\sqsupseteq u$. The same conclusion holds if
  $u\in I''$, so we have that $(I,J)\in S'$. Hence $S'$ is a
  compatible reflexive relation of $\lb \m b;\cup\rb$.

  To finish the proof of the claim we must show that for
  $(a,b)\in T$ we have $\big(\lb a\rb,\lb b\rb\big)\in S'$.
  To see this, observe that for any $u\in \lb a\rb$ the pair
  $(v,w) = (a,b)$ satisfies the required properties:
  $(v,w)\in \big(\lb a\rb \times \lb b\rb\big)\cap T$ and
  $v\sqsupseteq u$.

  \medskip

  We have constructed an algebra $\m b$, a tolerance $S$,
  and we have a candidate $\cup$ for the compatible
  semilattice operation on $S$.  For $\cup$ to be
  compatible on $S$ it must commute with the ${\vr
    L}$-operations on $S$.  This won't be true without some
  tinkering, so we factor by a congruence that collapses all
  failures of compatibility.  Specifically, let $\theta$ be
  the ${\vr L}(\cup)$-congruence on $\m b$ generated by
  all pairs of the form
  \[
  \big\lb f(I_1,\ldots, I_k)\cup f(J_1,\ldots, J_k),\;
  f(I_1\cup J_1,\ldots, I_k\cup J_k)\big\rb
  \]
  where $f\in {\vr L}(\cup)$ and each $(I_i,J_i)\in S$.
  Since $\theta$ is defined to be a congruence of $\lb \m
  b;\cup\rb$, the quotient $\lb \m b;\cup\rb/\theta$
  satisfies all equational properties satisfied by $\lb \m
  b;\cup\rb$.  In particular, $\cup$ is a semilattice
  operation of the quotient and all operations are monotone
  with respect to the semilattice order.

  \begin{clm}\label{hom2}
    If\/ $\lb U,V\rb\in\theta$ and\/ $u\in A$, then\/ $U
    \subseteq \lb u\rb\!\miff\! V \subseteq \lb u\rb$.
    Hence if $\big\lb \lb u\rb, \lb v\rb\big\rb\in\theta$,
    then\/ $u = v$.
  \end{clm}

  To see that this is so, it suffices to check the claim
  only in the case where $\lb U,V\rb$ is a polynomial image
  of a generating pair for $\theta$. Here, by a polynomial,
  we mean a unary polynomial of $\lb \m b;\cup\rb$,
  although in our argument we will only consider special
  unary polynomials of $\lb\m b;\cup\rb$.

  Let $\m c$ be any algebra. A {\bf basic
    translation}\index{basic translation} of $\m c$ is a
  unary polynomial of the form $q(x,c_1,\ldots,c_n)$ where
  each $c_i\in C$, and $q$ is obtained from some basic
  operation by permuting variables. It is known (and not
  hard to see) that the congruence on $\m c$ generated by
  some set $G\subseteq C\times C$ can be described by first
  forming the closure of $G$ under all basic translations,
  and then generating an equivalence relation. Hence
  $(x,y)\in \Cg C(G)$ if and only if there is a sequence $x
  = x_0,\ldots , x_m = y$ where each $\{x_i, x_{i+1}\} =
  \{p(g),p(h)\}$ for some $(g,h)\in G$ and some unary
  polynomial $p$ which is a composition of basic
  translations.

  For us, the fact that for any $f\in {\vr L}$ we have
  \[
  \begin{array}{r@{}l}
    f(x\cup W_1,W_2,\ldots, W_k) &{} =
    f(x,W_2,\ldots, W_k) \cup f(W_1,W_2,\ldots, W_k)\\
    &{} =  f(x,W_2,\ldots, W_k) \cup Z
  \end{array}
  \]
  when all $W_i\in \lb \m b;\cup\rb$ and $Z:=
  f(W_1,\ldots,W_k)$ implies that if a composition of basic
  translations of $\lb \m b;\cup\rb$ involves $\cup$,
  then it can be rewritten so that it is a composition of
  basic translations not involving $\cup$, followed by a
  single basic translation of the form $p(x) = x\cup Z$.
  This observation shows that to prove the claim it suffices
  to show that if $(H,K)$ is a generating pair for $\theta$,
  then
  \[
  p(H)\subseteq \lb u\rb\miff p(K)\subseteq\lb u\rb
  \]
  when $p$ has the form $p(x) = q(x,W_1,\ldots,W_k)\cup Z$
  where $q$ is a composition of basic translations not
  involving $\cup$, and $W_i, Z\in B$.

  Since the generating pairs for $\theta$ are comparable and
  the operations of $\lb \m b;\cup\rb$ are monotone, to
  prove that
  \[
  p(H)\subseteq \lb u\rb\miff p(K)\subseteq\lb u\rb
  \]
  for a generating pair $(H,K)$ it suffices to show that
  \[
  \begin{array}{r@{}ll}
    U:= {}& p\big(f(I_1,\ldots,I_n)\cup
    f(J_1,\ldots,J_n)\big)\subseteq \lb u\rb &\mimplies \\
    V:= {}& p\big(f(I_1\cup J_1,\ldots,I_n\cup J_n)\big)
    \subseteq \lb u\rb\,.&
  \end{array}
  \]
  Assume that $U\subseteq \lb u\rb$ but that there is some
  $e\in V - \lb u\rb$.  Then, since $p(x) =
  q(x,W_1,\ldots,W_k)\cup Z$ we get $Z\subseteq U\subseteq
  \lb u\rb$, so
  \[
  e\in V-Z = q\big(f(I_1\cup J_1,\ldots,I_n\cup
  J_n),W_1,\ldots,W_k\big)-Z
  \]
  implies that $e\in q\big(f(I_1\cup J_1,\ldots,I_n\cup
  J_n),W_1,\ldots,W_k\big)$.  We can reorder the variables
  of $f$ so that there are elements $s_i\in I_i\;(1\leq
  i\leq j)$,\; $t_i\in J_i\;(j+ 1\leq i\leq n)$,\; $w_i\in
  W_i\;(1\leq i\leq k)$ such that
  \[
  e = q\big(f(s_1,\ldots,s_j,t_{j+1},\ldots,t_n),
  w_1,\ldots,w_k\big)
  = q\big(f(\wec{s},\wec{t}),\wec{w}\big)\,.
  \]
  For each $i$ between 1 and $j$ we use the facts that
  $s_i\in I_i$ and $(I_i,J_i)\in S$ to choose
  $(s_i',t_i'')\in (I_i\times J_i)\cap T$ with
  $s_i'\sqsupseteq s_i$, and similarly for $i$ between $j+1$
  and $n$ we can choose $(t_i',s_i'')\in (J_i\times
  I_i)\cap T$ with $t_i'\sqsupseteq t_i$.  We use these
  elements to form tuples $\wec{s}' = (s_1',\ldots,s_j')$,
  $\wec{s}'' = (s_{j+1}'',\ldots,s_n'')$,
  $\wec{t}'$~and~$\wec{t}''$.  Since $\wec{s}'$ and
  $\wec{t}''$ are $T$-related coordinatewise, and the same
  is true for $\wec{s}''$ and $\wec{t}'$, we have
  \[
  \left[\begin{array}{cc}
      q\big(f(\wec{t}'',\wec{s}''),\wec{w}\big)
      &q\big(f(\wec{t}'',\wec{t}'),\wec{w}\big)\\
      q\big(f(\wec{s}',\wec{s}''),\wec{w}\big)
      &q\big(f(\wec{s}',\wec{t}'),\wec{w}\big)
    \end{array}\right]
  = \left[\begin{array}{cc} p&q\\ r&s \end{array}\right]
  \in M(T,T)
  \]
  with $q, r\in U\subseteq \lb u\rb$.  Since we have assumed
  that $T$ rectangulates itself with respect to
  $\sqsupseteq$, and $u\sqsupseteq q, r$, we must have
  \[
  u\sqsupseteq 
  s = q\big(f(\wec{s}',\wec{t}'),\wec{w}\big)
  \sqsupseteq q\big(f(\wec{s},\wec{t}),\wec{w}\big)
  = e\,,
  \]
  which is contrary to our choice of $e$.  This proves the
  first sentence of the claim.  The second sentence follows
  from the first by taking $U = \lb u\rb$, $V = \lb v\rb$,
  and using the fact that $\sqsupseteq$ is a partial order.

  \medskip

  The relation $S/\theta = \big\{(I/\theta,J/\theta)\in
  (B/\theta)^2\mid (I,J)\in S\big\}$ is a tolerance on $\m
  b/\theta$, hence a subalgebra of $\m b/\theta\times \m
  b/\theta$.

  \begin{clm}\label{comp_semi}
    The function $\cup\colon S/\theta\to \m b/\theta$ is a
    homomorphism.
  \end{clm}

  We must show that if $(I_i/\theta,J_i/\theta)\in S/\theta$
  and $f\in {\vr L}$, then in~$\m b/\theta$ we have
  \begin{eqnarray*}
    \lefteqn{f(I_1/\theta\cup 
      J_1/\theta,\ldots, I_k/\theta\cup J_k/\theta)}\\
    &&=  f(I_1/\theta,\ldots,I_k/\theta)\cup
    f(J_1/\theta,\ldots,J_k/\theta)\,.
  \end{eqnarray*}
  Equivalently, we must show that if $(I_i,J_i)\in S$ and
  $f\in {\vr L}$, then in~$\m b$ we have
  \[
  f(I_1\cup J_1,\ldots,I_k\cup J_k) \equiv_{\theta}
  f(I_1,\ldots,I_k)\cup f(J_1,\ldots,J_k)\,.
  \]
  This is immediate from the definition of $\theta$.

  \medskip

  Claims \ref{hom1} and \ref{hom2} prove that the composite
  $x\mapsto \lb x\rb\mapsto \lb x\rb/\theta$ is an
  embedding: $\m a\to \m b\to \m b/\theta$.  We identify $\m
  a$ with its image under this homomorphism.

  Let $\vr C$ be the set of all algebras $\m c\in {\vr V}(\m
  a)$ that are intermediate extensions: $\m a\leq {\m c}\leq
  \m b/\theta$.  This set contains $\m a$, so it is
  nonempty, and it is closed under unions of chains.
  Therefore there is an algebra $\widehat{\m a}\in {\vr C}$
  which is maximal among intermediate extensions that belong
  to~${\vr V}(\m a)$.  Let $\widehat{T} =
  S/\theta|_{\widehat{A}}$ be the restriction of $S/\theta$
  to $\widehat{\m a}$.

  \begin{clm}
    $\widehat{T}$ is a tolerance on\/ $\widehat{\m a}$, and
    conditions (2)(i)--(iv) of Theorem~\ref{rect_repn_thm}
    hold for $\widehat{T}$ and\/~$\widehat{\m a}$.
  \end{clm}

  The tolerance $\widehat{T}$ is the restriction of the
  tolerance $S/\theta$ on $\m b/\theta$ to~$\widehat{\m a}$,
  so it is a tolerance on $\widehat{\m a}$. It is a
  consequence of Claim~\ref{tol} that $T\subseteq
  \widehat{T}|_A$.  What we have left to show is that
  $\widehat{T}$ is rectangular, and supports a compatible
  semilattice operation. We show the latter first.

  Claim \ref{comp_semi} proves that $\cup\colon
  S/\theta\to \m b/\theta$ is a homomorphism. This
  homomorphism can be restricted to $\widehat{T}$.  The
  image $\cup(\widehat{T})$ of the restricted homomorphism
  contains $\widehat{A}$, since $\widehat{T}$ is reflexive
  and $a\cup a = a$ for all $a\in \widehat{A}$.  The image
  $\cup(\widehat{T})$ is a quotient of $\widehat{T}$, and
  $\widehat{T}$ is a subalgebra of $\widehat{\m a}\times
  \widehat{\m a} \in {\vr V}(\m a)$, so the image is in
  ${\vr V}(\m a)$.  The maximality of $\widehat{\m a}$
  prevents it from being properly contained in
  $\cup(\widehat{T})$, so $\cup(\widehat{T}) =
  \widehat{\m a}$.  This shows that $\cup$ is a
  homomorphism from $\widehat{T}$ to $\widehat{\m a}$.

  Let $D$ be a $\widehat{T}$-block.  If $a, b, c\in D$, then
  $(a,c),(b,c)\in \widehat{T}\subseteq S/\theta$ so, since
  $S/\theta$ is a tolerance of $\lb \m b;\cup\rb/\theta$,
  \[
  (a\cup b,c)=(a,c)\cup (b,c)\in
  S/\theta|_{\widehat{A}}=\widehat{T}\,.
  \]
  This shows that $a\cup b$ is $\widehat{T}$-related to
  any $c\in D$, so $a\cup b\in D$ by the fact~that $D$ is
  a block. Since $\cup$ is a homomorphism
  from~$\widehat{T}$ to~$\widehat{\m a}$ that is the
  restriction of a semilattice operation on $\m b/\theta$,
  and since each $\widehat{T}$-block is closed under
  $\cup$, it follows that $\cup$ is a compatible
  semilattice operation on $\widehat{T}$.

  Now we prove that $\widehat{T}$ is rectangular.  To check
  this we need a compatible partial order on $\widehat{\m
    a}$.  We choose it to be the restriction of the
  $\cup$-semilattice order on $\m b/\theta$, which we
  denote by $\gg$ and define by
  \[
  a\gg b \wrel{\miff} a = a\cup b\,.
  \]
  We have already observed that the operations of $\m
  b/\theta$ are monotone with respect to the semilattice
  order, and this fact is inherited by $\widehat{\m a}$,
  hence $\gg$ is a compatible partial order.  To see that
  ${\bf R}(\widehat{T},\widehat{T};\gg)$ holds, choose $M
  \in M(\widehat{T},\widehat{T})$,
  \[
  M = \left[\begin{array}{cc}
      p(\wec{a},\wec{u})&p(\wec{a},\wec{v})\\
      p(\wec{b},\wec{u})&p(\wec{b},\wec{v})
    \end{array}\right] = 
  \left[\begin{array}{cc} p&q\\ r&s \end{array}\right]\,,
  \]
  with $u\gg q, r$ for some $u\in \widehat{A}$.  All four
  elements of this matrix are $\widehat{T}$-related, so
  \[
  u\gg u\cup u\gg q\cup r= p(\wec{a},\wec{v})\cup
  p(\wec{b},\wec{u}) =
  p(\wec{a}\cup\wec{b},\wec{v}\cup\wec{u})\gg
  p(\wec{b},\wec{v}) = s\,.
  \]
  Thus, $u\gg q, r$ implies $u\gg s$, as required.  This
  completes the proof of the claim, and also of the theorem.
\end{proof}

It is worth recording that the proof produces from $\m a$
and $T$ two algebras of interest: $\widehat{\m a}$ and $\m
b/\theta$.  The properties of the two algebras are roughly
the same with respect to rectangulation, but $\widehat{\m
  a}$ is in the variety generated by $\m a$ while $\m
b/\theta$ may not be.  On the other hand, the compatible
semilattice operation that we constructed is only a partial
operation on $\widehat{\m a}$ (it is defined only on
$\widehat{T}$-blocks), while it is a total operation on $\m
b/\theta$ and the semilattice order is a compatible partial
order of $\m b/\theta$.


\section{Rectangular Tolerances and Join Terms}

We introduced join terms in Section~\ref{join_term}, but did
not investigate their properties. It is now important that
we do so. In this section we explore the structure of
rectangular tolerances on algebras in varieties with a join
term.  For such tolerances we prove that the representation
given in Theorem~\ref{rect_repn_thm} is simpler in that one
may take $\widehat{\m a} = \m a$ and $\widehat{T}=T$. We
then describe connections with the relations $\geq_T$ and
$\sim_T$ that were introduced in Definition~\ref{ge_defn}

\begin{thm}\label{join_prop}
  Let\/ $\vr V$ be a variety with a join term $+$, and let\/
  $T$ be a tolerance on an algebra~$\m A\in\vr V$.
  \begin{enumerate}
  \item[(1)] If\/ $B$ is a $T$-block and $w\geq_B u$ and
    $w\geq_B v$, then $w\geq_B u+v$.  Similarly, if\/
    $w\ge_T u$ and $w\ge_T v$, then $w\ge_T u+v$.
  \item[(2)] If\/ $B$ is a $T$-block, then $\geq_B$ is a join
    semilattice ordering on $B$ modulo $\sim_B$, and $+$ is
    the join with respect to that ordering.
  \item[(3)] If\/ $B$ is a $T$-block containing all entries
    of $\left[\begin{array}{cc} a&b\\
        c&d\end{array}\right]\in M(T,T)$, then
    $a+d\sim_B b+c$.
  \item[(4)] If\/ $(q,r;s)$ is a $(T,T)$-triple, then
    $q+r\ge_T s$.
  \item[(5)] If\/ $p$ is a polynomial of\/ $\m a$ and\/
    $\wec{u}\wrel{T}\wec{v}$, then
    \[
    p(\wec{u}+\wec{v}) \sim_T p(\wec{u}) +
    p(\wec{v})\,.
    \]
  \end{enumerate}
\end{thm}

\begin{proof}
  From $w\geq_B u$ and $w\geq_B v$ we get $w = w+w\geq_B
  u+v$, since $+$ is idempotent and $\geq_B$ is compatible
  with idempotent polynomials (Lemma~\ref{basic_prop}~(1)).
  The statement about $\geq_T$ follows in the same way from
  Lemma~\ref{basic_prop}~(2).

  If $B$ is a $T$-block, then $B$ is closed under $+$ since
  $+$ is idempotent.  From Corollary~\ref{omit_1_cor}, $u+v
  \geq_B u, v$, while item~(1) proves conversely that if
  $w\geq_B u, v$, then $w\geq_B u+v$.  Thus $\geq_B$ is
  indeed a semilattice order modulo $\sim_B$ on $B$, and $+$
  is the join with respect to this order.

  For item~(3), Lemma~\ref{ge_elementary}~(3) proves that
  $b+c\ge_B (b+d)+(a+c)$. But from
  Corollary~\ref{omit_1_cor} we have $b+d\ge_B d$ and
  $a+c\ge_B a$, so
  \[
  b+c\ge_B (b+d)+(a+c)\ge_B d+a\,.
  \]
  Since $\geq_B$ is transitive on $B$, we have $b+c\geq_B
  d+a$. If we interchange the two rows of this $T,T$-matrix,
  then we derive the reverse inequality $d+a\geq_B b+c$,
  hence $b+c\sim_B d+a$.  It follows from item~(2) that
  $d+a\sim_B a+d$, so from the transitivity of $\sim_B$ on
  $B$ we get $a+d\sim_B b+c$, as claimed.

  For (4), if $(q,r;s)$ is a $(T,T)$-triple, then its
  entries belong to a $T,T$-matrix.  All four entries of any
  $T,T$-matrix are pairwise $T$-related, hence a block $B$
  exists that contains all four entries.  Applying item~(3)
  to this block we obtain $q+r\sim_B p+s$ for some $p\in B$,
  hence from item~(1) it follows that $q+r\geq_B s$. This
  proves $q+r\geq_T s$.

  We first prove item (5) in the case where $p=f$ is a basic
  operation of $\m a$.  Choose $T$-blocks $B_i$ such that
  $u_i, v_i\in B_i$ for all $i$, and choose a $T$-block $B$
  such that $f(B_1,\ldots,B_n)\subseteq B$.  According to
  item~(2) of this theorem we have
  \begin{equation}\label{sim_stuff} u_i+v_i\sim_{B_i}
    v_i+u_i
  \end{equation} for all $i$. Now consider the $T,T$-matrix
  \[
  \left[\begin{array}{cc} f(\wec{u}+\wec{u})&
      f(\wec{u}+\wec{v})\\ f(\wec{v}+\wec{u})&
      f(\wec{v}+\wec{v})
    \end{array}\right]\,.
  \]
  All entries lie in $B$, so from part~$(3)$ we get that
  \[
  f(\wec{u}+\wec{u})+f(\wec{v}+\wec{v})\sim_B
  f(\wec{u}+\wec{v})+f(\wec{v}+\wec{u})\,.
  \]
  The left hand side is $f(\wec{u})+f(\wec{v})$, since $+$
  is idempotent. The right side is $\sim_B$-related to
  $f(\wec{u}+\wec{v})$ since, by (\ref{sim_stuff}),
  Claim~\ref{compatibility_claim} and the idempotence of $+$
  we have
  \[
  f(\wec{u}+\wec{v})+f(\wec{v}+\wec{u})\sim_B
  f(\wec{u}+\wec{v})+f(\wec{u}+\wec{v}) =
  f(\wec{u}+\wec{v})\,.
  \]
  Since $\sim_B$ is transitive on $B$ we get
  $f(\wec{u})+f(\wec{v}) \sim_B f(\wec{u} +
  \wec{v})$, hence $f(\wec{u})+f(\wec{v}) \sim_T
  f(\wec{u}+\wec{v})$.

  Now we prove (5) for polynomials.  Consider the relation
  $\rho\subseteq A^3$ consisting of all triples $(u,v,w)$
  for which there is a $T$-block $B$ such that $u, v, w\in
  B$ and $u+v\sim_B w$.  It follows from the fact that
  item~(5) is true when $f$ is a basic operation, together
  with Claim~\ref{compatibility_claim} and the transitivity
  of $\sim_{B'}$ on $B'$ for any block $B'$, that $\rho$ is
  compatible with the basic operations of $\m a$. It is
  compatible with all constant operations on~$A$ because $+$
  is idempotent.  Thus $\rho$ is compatible with all
  polynomial operations of~$\m a$. Since $\rho$ contains all
  triples of the form $(u,v,u+v)$, it therefore contains
  $\big(p(\wec{u}),p(\wec{v}),p(\wec{u}+\wec{v})\big)$,
  establishing that $p(\wec{u}+\wec{v})\sim_T
  p(\wec{u})+p(\wec{v})$.
\end{proof}

We can prove more if $T$ is rectangular.

\begin{thm}\label{join_props_2} 
  Let\/ $\vr V$ be a variety with a join term $+$, and let\/
  $T$~be a tolerance on an algebra\/~$\m A\in\vr V$.  If\/
  $\sqsupseteq$ is a compatible partial order of\/~$\m a$
  for which\/ $\C R(T,T;\sqsupseteq)$ holds, then the
  following are true.
  \begin{enumerate}
  \item[(1)] The relation $\sim_T$ is the equality relation
    on $\m a$.
  \item[(2)] $\geq_T$ equals ${\sqsupseteq}\cap T$, and
    also equals $\{(u,v)\in T\mid u=u+v\}$.
  \item[(3)] If\/ $\left[\begin{array}{cc} a&b\\
        c&d\end{array}\right]\in M(T,T)$, then $a+d = b+c$.
  \item[(4)] If\/ $f$ is a polynomial of\/ $\m a$ and\/
    $\wec{u}\wrel{T}\wec{v}$, then
    \[
    f(\wec{u}+\wec{v}) = f(\wec{u}) + f(\wec{v})\,.
    \]
  \item[(5)] $+\colon T\to \m a$ is the unique compatible
    semilattice operation supported by $T$.
  \end{enumerate}
\end{thm}

\begin{proof}
  If $(r,s)$ is a $(T,T;0)$-pair, then there is a matrix
  \[
  \left[\begin{array}{cc} p&q\\ r&s \end{array}\right]
  \in M(T,T)
  \]
  with $q=r$.  Since $r\sqsupseteq r$ and $r\sqsupseteq q$
  (${} = r$), we get $r\sqsupseteq s$ because $\C
  R(T,T;\sqsupseteq)$ holds.  Thus the relation
  $\sqsupseteq$ contains all $(T,T;0)$-pairs, hence contains
  $\geq_T$. Therefore, the reflexive relation $\sim_T$ is
  contained in the intersection of $\sqsupseteq$ and its
  converse, which forces $\sim_T$ to be the equality
  relation.  This proves item (1), and together with
  Theorem~\ref{join_prop}~(3) and~(5) also proves items~(3)
  and~(4).

  We will show that $\geq_T$ is contained in
  ${\sqsupseteq}\cap T$, which is contained in $\{(u,v)\in
  T\mid u=u+v\}$, which is contained in $\geq_T$.  It
  follows from Definition~\ref{ge_defn} that $\geq_T$ is
  contained in $T$, and it follows from the argument of the
  previous paragraph that $\geq_T$ is contained
  in~$\sqsupseteq$, so $\geq_T$ is contained in
  ${\sqsupseteq}\cap T$.  Next, choose any pair $(u,v)$ in
  ${\sqsupseteq}\cap T$.  Since $\sqsupseteq$ is reflexive
  and compatible, and since $u\sqsupseteq v$, we get that
  $u=u+u\sqsupseteq u+v$.  But $u+v\geq_T u$, according to
  the definition of a join term, so $u+v\sqsupseteq u$ by
  the argument of the first paragraph.  This shows that both
  $(u,u+v)$ and $(u+v,u)$ belong to the partial order
  $\sqsupseteq$, so $u=u+v$. Hence ${\sqsupseteq}\cap T$ is
  contained in $\{(u,v)\in T\mid u=u+v\}$.  Finally, choose
  any $(u,v)\in T$ such that $u=u+v$. If $B$ is a block
  of~$T$ containing $u$ and $v$, then $u=u+v\geq_B v$, since
  $\geq_B$ is the join order for $+$ on $B$
  (Theorem~\ref{join_prop}~(2)). Therefore $u\geq_T v$,
  proving that $\{(u,v)\in T\mid u=u+v\}$ is contained in
  $\geq_T$.  This completes the proof of item~(2).

  For item~(5), it follows from Theorem~\ref{join_prop}~(2)
  and part~(1) of this theorem that $+$ is a semilattice
  operation on the blocks of $T$.  The property from
  item~(4) of this corollary, in the cases where $f$ is a
  basic operation of $\m a$, is exactly the property that
  $+\colon T\to \m a$ is a homomorphism.  Thus $+$ is a
  compatible semilattice operation on~$T$. If $s\colon T\to
  \m a$ is another compatible semilattice operation, then
  using the commutativity and idempotence of $s$ and $+$,
  and the fact that $s\colon T\to \m a$ is a homomorphism,
  and that $+$ is a term, we have for any $(u,v)\in T$ that
  \[
  \begin{array}{r@{}l}
    s(u,v) &{} = s(u,v) + s(v,u)\\
    &{} = s(u+v,v+u)\\
    &{} = s(u+v,u+v)\\
    &{} = u+v\,.
  \end{array}
  \]
  Thus $+$ is unique.
\end{proof}

\begin{cor}\label{str_ab_thm3}
  Let\/ $\vr V$ be a variety. The following are equivalent.
  \begin{enumerate}
  \item[(1)] $\vr V$ has no member with a nonzero congruence
    that is simultaneously rectangular and abelian.
  \item[(2)] $\vr V$ has no member with a nonzero tolerance
    that is simultaneously rectangular and abelian.
  \item[(3)] $\vr V$ satisfies a nontrivial idempotent
    Maltsev condition.
  \end{enumerate}
\end{cor}

\begin{proof} 
  Since tolerances are congruences, (2)$\mimplies$(1).

  A strongly abelian congruence is both rectangular and
  abelian, so if (1) holds, then $\vr V$ omits strongly
  abelian abelian congruences. Hence $\vr V$ satisfies a
  nontrivial idempotent Maltsev condition, according to
  Theorem~\ref{str_ab_thm1}, showing that (1)$\mimplies$(3).

  Finally, if $\vr V$ satisfies a nontrivial idempotent
  Maltsev condition, then it has a join term, $+$.  Suppose
  that $\m a\in {\vr V}$ has a tolerance $T$ that is
  rectangular and abelian.  By
  Theorem~\ref{join_props_2}~(5), $+$ is a semilattice
  operation on $T$-blocks. Therefore, if $(a,b)\in T$ and
  $a\ge b$ in the semilattice order, then
  \[
  \left[\begin{array}{cc} a&a\\ a&b \end{array}\right]
  = \left[\begin{array}{cc} 
      a+a&a+b\\
      b+a&b+b
    \end{array}\right]
  \in M(T,T)\,.
  \]
  But since $T$ is also abelian, the equality in the first
  row of this matrix implies equality in the second
  row. Hence $T = 0$, and (3)$\mimplies$(2).
\end{proof}

One can use tame congruence theory, \cite{hobby-mckenzie},
to prove that a finite simple algebra has a nontrivial
tolerance that is (a) simultaneously rectangular and abelian
if and only if it has one that is (b) strongly rectangular
if and only if it has one that is (c) strongly abelian.  So
perhaps it is not too surprising that the varieties that
omit tolerances of type (a) are the same as those that omit
type (b) or (c). However, (a), (b) and (c) are truly
different properties of tolerances, even for finite
algebras, as we explain in the next example.

\begin{exmp}\label{A(M)_2}
  This example is an extension of Example~\ref{A(M)}.  As in
  that example, let $X$ be a set and let ${\vr M}\subseteq
  X^{2\times 2}$ be a set of $2\times 2$ matrices with
  entries in $X$.  Define $\m a({\vr M})$ as in
  Example~\ref{A(M)}.  Suppose that $\gg$ is a quasi-order
  defined on the set $X$ such that whenever $M =
  \left[\begin{array}{cc} p&q\\r&s\end{array}\right]$
  belongs to $\vr M$, then
  \[
  u\gg q\quad\&\quad u\gg r
  \quad\miff \quad 
  u\gg s\quad\&\quad u\gg p
  \]
  for any $u\in X$.  Let $\sqsupseteq$ be the least
  extension of $\gg$ to a quasi-order on $A = X\cup Y\cup
  \{0\}$ (namely, $\sqsupseteq$ is the union of $\gg$ with
  the equality relation on $A$).  Then $\sqsupseteq$ is a
  compatible quasi-order of $\m a({\vr M})$, and it is clear
  that $\C R(R,S;\sqsupseteq)$ and $\C R(T,T;\sqsupseteq)$
  both hold (since for $u\neq v$ we have $u\sqsupseteq v$ if
  and only if $u\gg v$).  Thus, we are again in the
  situation that we may ignore algebraic considerations and
  think set-theoretically when considering relationships
  between rectangulation and the term conditions introduced
  earlier.

  To see, for example, that there is a finite algebra with a
  tolerance that is rectangular and abelian but not strongly
  rectangular (hence not strongly abelian), it is entirely
  sufficient to write down the single matrix $M =
  \left[\begin{array}{cc} 1&3\\ 3&2
    \end{array}\right]$.  Then, for ${\vr M}=\{M\}$, and $\m
  a({\vr M})$ and $T$ defined as in Example~\ref{A(M)}, the
  set of nontrivial $T,T$-matrices are just those that can
  be obtained from $M$ by permuting its entries by some
  combination of row or column interchanges or transposes.
  As a $T, T$-matrix, $M$ formally conflicts with $\C
  {SR}(T,T;0)$. But it does not formally conflict with $\C
  {C}(T,T;0)$ or $\C R(T,T;\gg)$ where $\gg$ is the partial
  order on $X$ generated by the pairs $(3,1)$ and $(3,2)$.
  Therefore, on the algebra $\m a({\vr M})$, the tolerance
  $T$ is rectangular and abelian but not strongly
  rectangular.
\end{exmp}

The construction of Example~\ref{A(M)_2} can be used to show
that it is possible for the transitive closure of the
$(T,T;0)$-pairs to be a partial order even when $T$ is not
rectangular.  For example, this occurs when
\[
{\vr M} = \left\{
\left[\begin{array}{cc} 1&3\\ 3&2 \end{array}\right],
\left[\begin{array}{cc} 1&4\\ 4&2\end{array}\right]
\right\}\,.
\]
Generalizations of this example show that the construction
of the rectangular commutator of two tolerances can be
arbitrarily complicated in general. The situation is better
in varieties with join terms.

\begin{thm}\label{quotients}
  Let\/ $\vr V$ be a variety with a join term $+$, and let
  $T$~be a tolerance on an algebra~$\m A\in\vr V$.  Let
  $\rho$ be any congruence on $\m a$ that contains $\sim_T$,
  and let\/ $\m c = \m a/\rho$ and\/ $S = T/\rho$.
  \begin{enumerate}
  \item[(1)] If $a_1\ge_S a_2\ge_S\cdots \ge_S a_n\ge_S
    a_1$ in $\m c$, then $a_1 = a_2 = \cdots = a_n$.
  \item[(2)] If\/ $\sqsupseteq$ is the transitive closure of
    $\geq_S$, then $\sqsupseteq$ is a partial order of\/ $C$
    whose restriction to any $S$-block agrees with $\geq_S$.
  \item[(3)] $\C R(S,S;\sqsupseteq)$ holds.
  \item[(4)] The transitive closure of\/ $\sim_T$ is
    $[T,T]_{\m r}$.
  \end{enumerate}
\end{thm}

\begin{proof}
  First we prove~$(1)$. We may assume that all
  $(a_i,a_{i+1})$ (with the understanding that $n+1=1$) are
  $(S,S;0)$-pairs. Now choose $n\ge 2$ minimal among such
  cycles for which the statement is false. We argue that
  $a_1+a_2=a_2+a_1=a_1$.  As $(a_1,a_2)$ is an
  $(S,S;0)$-pair, there exists a $(T,T)$-matrix
  \[
  \left[\begin{array}{cc} a&b\\ c&d\end{array}\right]
  \]
  such that $b/\rho=c/\rho=a_1$ and $d/\rho=a_2$.  Choose a
  $T$-block $B$ containing these four elements.  By
  Theorem~\ref{join_prop} we have that $b+c\sim_B a+d$, and
  that $+$ is a semilattice operation on $B$
  modulo~$\sim_B$, which implies that $(b+c)+d\sim_B
  d+(b+c)\sim_B b+c$. The relation $\sim_B$ is contained
  in~$\rho$, and therefore in $\m a/\rho$ we have
  $(a_1+a_1)+a_2=a_2+(a_1+a_1)=a_1+a_1$. But $+$ is
  idempotent, so $a_1+a_2=a_2+a_1=a_1$. A similar argument
  shows that $a_i+a_{i+1}=a_{i+1}+a_{i}=a_i$ for all $i$.

  Consider
  \[
  a_1+a_2\ge_S a_2+a_3\ge_S a_2+a_4\ge_S\dots \ge_S
  a_2+a_n\ge_S a_2+a_1\,.
  \]
  This is a cycle of length $n-1$. We show that every link
  in it is an $(S,S;0)$-pair. Indeed, the sum of two
  $(S,S)$-matrices is also an $(S,S)$-matrix, hence the sum
  of two $(S,S)$-triples is an $(S,S)$-triple as well. Now
  $(a_1,a_1;a_2)$ and $(a_2,a_2;a_3)$ are $(S,S)$-triples,
  and so their sum $(a_1+a_2,a_1+a_2;a_2+a_3)$ is an
  $(S,S)$-triple, proving that the first link is indeed an
  $(S,S;0)$-pair. Similarly, $(a_2,a_2;a_2)$ and
  $(a_i,a_i;a_{i+1})$ are $(S,S)$-triples, and their sum
  shows that all the other links in the chain are
  $(S,S;0)$-pairs,~too.

  The minimality of~$n$ then forces this chain to be
  trivial, that is, all links are equal. Thus
  $a_1+a_2=a_2+a_3$. But we know that $a_1+a_2=a_1$ and
  $a_2+a_3=a_2$. Therefore $a_1=a_2$. This contradicts the
  minimality of~$n$ in the original chain. This argument
  works for every~$n>1$, and so $(1)$ is proved.

  To prove~$(2)$ suppose that $u\sqsupseteq v$ and
  $v\sqsupseteq u$ hold.  Then there is a $\ge_S$-chain
  from~$u$ to~$v$, and from~$v$ to~$u$. Thus the statement
  in~$(1)$ shows that $u=v$. Therefore~$\ge$ is indeed a
  partial order. To prove the other statement, suppose that
  \[
  b_1\ge_S b_2\ge_S b_3\ge_S \dots \ge_S b_n\,,
  \]
  where $(b_1,b_n)\in S$. Consider
  \begin{equation}\label{cycle_of_bees}
    b_1+b_1\ge_S
    b_2+b_1\ge_S b_3+b_1\ge_S \dots \ge_S b_n+b_1\,.
  \end{equation}
  Here $b_n+b_1\ge_S b_1=b_1+b_1$ by the properties of~$+$,
  since $b_n$ and $b_1$ are~$S$-related. Hence
  (\ref{cycle_of_bees}) is a cycle, which must be trivial
  by~$(1)$. Therefore $b_1=b_n+b_1\ge_S b_n$, proving~$(2)$.

  Now we prove that $\C R(S,S;\sqsupseteq)$ holds.  Suppose
  that
  \[
  \left[\begin{array}{cc} a&b\\ c&d\end{array}\right]\in
  M(S,S)\,,
  \]
  and $u\in C$ satisfies that $u\sqsupseteq b$ and
  $u\sqsupseteq c$.  If $B$ is an $S$-block that contains
  these four elements, then Theorem~\ref{join_prop}~(3)
  guarantees that $b+c\sim_B a+d$.  But the relation
  $\sim_B$ is the intersection of $\geq_B$ and its converse,
  the relation $\geq_B$ is contained in $\geq_S$, and
  $\geq_S$ is antisymmetric by item~(2).  Thus $\sim_B$ is
  equality on $B$, yielding $b+c=a+d$. As $+$ is idempotent
  and $\sqsupseteq$ is compatible, we get that
  $u=u+u\sqsupseteq b+c = a+d$.  But $a+d\geq_S d$ by the
  definition of a join term, so $u\sqsupseteq a+d\sqsupseteq
  d$, proving that $\C R(S,S;\sqsupseteq)$ holds.

  For item (4), let $\rho$ be the transitive closure of
  $\sim_T$ in $\m a$. Since $\sim_T$ is a tolerance, its
  transitive closure $\rho$ is a congruence.  Now suppose
  that $\gg$ is the least compatible partial order on $\m a$
  such that $\C R(T,T;\gg)$ holds.  If
  \[
  \left[\begin{array}{cc} p&q\\ r&s\end{array}\right]\in
  M(T,T)\,,
  \]
  and $q=r$, then $r\gg r$ and $r\gg q$ (${} =r$), so $r\gg
  s$. Thus $\gg$ contains all $(T,T;0)$-pairs, and therefore
  contains $\geq_T$.  According to
  Definition~\ref{rectangular_df}, $[T,T]_{\m r}$ is the
  intersection of $\gg$ and its converse, hence $[T,T]_{\m
    r}$ contains the intersection of $\geq_T$ and its
  converse, hence contains $\sim_T$.  Since $\rho$ is the
  least congruence containing $\sim_T$, we get $\rho \leq
  [T,T]_{\m r}$.

  On the other hand, according to
  Theorem~\ref{least_congruence}, $[T,T]_{\m r}$ is the
  least congruence $\delta$ for which $T/\delta$ is a
  rectangular tolerance of $\m a/\delta$.  By items (2) and
  (3) of this theorem, $\rho$ is a congruence with this
  property.  Therefore $[T,T]_{\m r} = \rho$.
\end{proof}

The following consequence of Theorem~\ref{quotients} is
worth stating separately.

\begin{cor}\label{sim_is_equality}
  Let\/ $\vr V$ be a variety with a join term, and let\/
  $T$~be a tolerance on some $\m a\in {\vr V}$. Then $T$ is
  rectangular if and only if $\sim_T$~is the equality
  relation.
\end{cor}

\begin{proof}
  If $T$ is rectangular, then $\sim_T$ is the equality
  relation according to Theorem~\ref{join_props_2}~(1).  On
  the other hand, if $\sim_T$ is the equality relation, then
  Theorem~\ref{quotients}~(4) guarantees that $[T,T]_{\m r}
  = 0$.
\end{proof}

Corollary~\ref{sim_is_equality} implies the following
characterization of rectangular tolerances in varieties with
join terms, which is a refinement of
Theorem~\ref{un_rect_repn_thm}.

\begin{cor}\label{rect_with_+}
  Let\/ $\vr V$ be a variety with a join term $+$, and let
  $T$~be a tolerance on an algebra~$\m A\in\vr V$.  Then $T$
  is rectangular if and only if $+$ is a compatible
  semilattice operation on $T$.
\end{cor}

\begin{proof}
  If $T$ is rectangular, then $+$ is a compatible
  semilattice operation on $T$ by
  Theorem~\ref{join_props_2}~(5).  Conversely, suppose that
  $+$ is a compatible semilattice operation on $T$. If
  $(r,s)$ is a $(T,T;0)$-pair, then there is a matrix
  \[
  \left[\begin{array}{cc} p&q\\ r&s\end{array}\right]=
  \left[\begin{array}{cc}
      f(\wec{a},\wec{u})&f(\wec{a},\wec{v})\\
      f(\wec{b},\wec{u})&f(\wec{b},\wec{v})
    \end{array}\right] \in M(T,T)
  \]
  with $q=r$. In this situation
  \[
  q+r = f(\wec{a}+\wec{b},\wec{v}+\wec{u}) = p+s\,,
  \]
  and all elements $p$, $q$, $r$, $s$, $q+r$ and $p+s$ lie
  in a single $T$-block. Therefore $r = q+r = p+s\ge s$ in
  the semilattice order on that block. This means that the
  equation $r+s = r$ holds, which is a property that is
  independent of the block that we are considering.  Thus if
  $(r,s)$~is a $(T,T;0)$-pair, then $r\ge s$ in the
  semilattice order on any block containing $r$ and $s$.
  This conclusion implies that on any $T$-block the relation
  $\ge_T$ is contained in the semilattice order, and
  therefore that $\sim_T$~is the equality relation.  Hence
  the tolerance $T$ is rectangular by
  Corollary~\ref{sim_is_equality}.
\end{proof}

The following corollary will be used in Section~\ref{ACD}.

\begin{cor}\label{ACD_cor}
  Let\/ $\vr V$ be a variety with a join term $+$, and let
  $T$~be a rectangular tolerance on an algebra~$\m A\in\vr
  V$.  Assume that $a$ and\/~$b$ are distinct\/ $T$-related
  elements of\/ $\m a$.  If\/ $\rho$ is a congruence on~$\m
  a$ that is maximal with respect to $(a,b)\notin\rho$, then
  $T/\rho$ is a nontrivial rectangular tolerance on the
  subdirectly irreducible algebra $\m a/\rho$.
\end{cor}

\begin{proof}
  If $T$ is rectangular, then $\sim_T$ is the equality
  relation according to Theorem~\ref{join_props_2}~(1).
  Therefore every congruence $\rho$ on $\m a$ contains
  $\sim_T$. From Theorem~\ref{quotients}, $T/\rho$ is a
  rectangular congruence of $\m a/\rho$ for any $\rho$.
  Choosing $\rho$ as described in the statement of this
  corollary guarantees that $T/\rho$ is nontrivial and that
  $\m a/\rho$ is subdirectly irreducible.
\end{proof}


\section{Varieties Omitting Rectangular
Tolerances}\label{omit_rect_tol}


The purposes of this section are to show that a variety
omits rectangular tolerances if and only if it omits
rectangular congruences, and then to give three different
Maltsev characterizations of the class of varieties with
these properties.

\begin{lm}\label{free_rect2}
  Let\/ $\vr V$ be a variety with a join term and\/ $\m F =
  \m f_{\vr V}(x,y)$ the free $\vr V$-algebra generated by
  the set $\{x,y\}$.  Let\/ $T = \Tg f(x,y)$, let $\theta =
  \Cg f(T)$, and let\/ $B = x/\theta$.  Then the relations
  $\geq_{\theta}$ and $\geq_T$ have the same restriction to
  $B$.
\end{lm}

\begin{proof}
  It follows from Lemma~\ref{basic_prop}~(4) that
  $({\geq_T})|_B = {\rm tr.cl.}(S|_B)$, where $S$ is the set
  of $(T,T;0)$-pairs of $\m f$, and that
  $({\geq_{\theta}})|_B = {\rm tr.cl.}(\overline{S}|_B)$,
  where $\overline{S}$ is the (larger) set of
  $(\theta,\theta;0)$-pairs of $\m f$.  Thus, it is enough
  to show that if $(r,s)\in B^2$ is a
  $(\theta,\theta;0)$-pair, then $(r,s)$ is in the
  transitive closure of the set of $(T,T;0)$-pairs.  So
  choose a $\theta,\theta$-matrix of the form
  \[
  \left[\begin{array}{cc} p&r\\ r&s\end{array}\right] =
  \left[\begin{array}{cc}
      t(\wec{a},\wec{c})& t(\wec{a},\wec{d})\\
      t(\wec{b},\wec{c})& t(\wec{b},\wec{d})
    \end{array}\right]\,.
  \]
  Let $h\colon \m f\to\m f$ be the endomorphism determined
  by $x\mapsto x$, $y\mapsto x$.  The conditions
  $\wec{a}\equiv_\theta \wec{b}$ and $\wec{c}\equiv_\theta
  \wec{d}$ are equivalent to $h(\wec{a})=h(\wec{b})$ and
  $h(\wec{c})=h(\wec{d})$.  As in the proof of
  Lemma~\ref{free_rect}, consider the following~$4\times 4$
  matrix:
 \[
  \left[\begin{array}{cccccc}
      t(\wec{a},\wec{c})&
      t\big(\wec{a},h(\wec{c})\big)&=&
      t\big(\wec{a},h(\wec{d})\big)&
      t(\wec{a},\wec{d})\\
      \noalign{\vskip 1pt}
      t\big(h(\wec{a}),\wec{c}\big)&
      t\big(h(\wec{a}),h(\wec{c})\big)&=&
      t\big(h(\wec{a}),h(\wec{d})\big)&
      t\big(h(\wec{a}),\wec{d}\big)\\
      \Vert&\Vert&&\Vert&\Vert\\
      t\big(h(\wec{b}),\wec{c}\big)&
      t\big(h(\wec{b}),h(\wec{c})\big)&=&
      t\big(h(\wec{b}),h(\wec{d})\big)&
      t\big(h(\wec{b}),\wec{d}\big)\\
      \noalign{\vskip 1pt}
      t(\wec{b},\wec{c})&
      t\big(\wec{b},h(\wec{c})\big)&=&
      t\big(\wec{b},h(\wec{d})\big)&
      t(\wec{b},\wec{d})
    \end{array}\right]\,.
  \]
  Recall from that earlier proof that the four elements in
  the middle are all equal to~$x$ and that the four $2\times
  2$ matrices in the corners are \hbox{$T,T$-matrices.}  All
  elements of this $4\times 4$ matrix are contained in~$B$,
  because all elements are $\theta$-related, $r, s\in B$ by
  assumption, and $B$ is a block of~$\theta$.

  Proceeding as we did in the proof of
  Lemma~\ref{free_rect}, let $k\colon \m f\to \m f$ be the
  endomorphism of $\m f$ that sends $x$ to $y$ and $y$ to
  $y$.  Consider the analogous $4\times 4$ matrix with
  respect to~$k$, and apply~$r(x,y)$ to these two matrices,
  the first matrix in the first argument, the second matrix
  in the second argument.  As before, we get a $4\times 4$
  matrix which, after deleting one of the doubled middle
  columns and one of the doubled middle rows, is a $3\times
  3$ matrix of the form:
  \[
  J = \left[\begin{array}{ccc}
      p&i&r\\ j&r&\ell\\ r&m&s\\
    \end{array}\right]\,.
  \]
  The four $2\times 2$ matrices in the corners of this
  $3\times 3$ matrix $J$ are all \hbox{$T,T$-matrices.}
  From the matrix in the upper right corner we get
  that~$r\ge_T \ell$. From the matrix in the lower left
  corner we obtain that~$r\ge_T m$. From the matrix in the
  lower right corner we get, using
  Theorem~\ref{join_prop}~(4), that $\ell + m\ge_T s$. But
  $+$ is idempotent, $\ge_T$~is~compatible, and $\ge_T$ is
  transitive on~$B$, so $r=r+r\ge_T \ell + m\ge_T s$.
\end{proof}

\begin{thm}\label{rect_cong}
  Let\/ $\vr V$ be a variety. The following are equivalent.
  \begin{enumerate}
  \item[(1)] No member of\/ $\vr V$ has a nontrivial
    rectangular congruence.
  \item[(2)] No member of\/ $\vr V$ has a nontrivial
    rectangular tolerance.
  \end{enumerate}
\end{thm}

\begin{proof}
  Clearly (2)$\mimplies$(1), since congruences are
  tolerances.  The same type of argument as that used in the
  proof of Lemma~\ref{4_eq_conditions} shows that to prove
  the converse it is enough to show that
  \[
  (x,y)\in [\theta,\theta]_{\m r} \wrel{\mimplies} (x,y)
  \in [T,T]_{\m r}
  \]
  where $\theta = \Cg f(x,y)$ and $T = \Tg f(x,y)$ are the
  congruence and tolerance generated by $(x,y)$ in the free
  algebra $\m f = \m f_{\vr V}(x,y)$.  So assume that
  $(x,y)\in [\theta,\theta]_{\m r}$.  This assumption, which
  is equivalent to the assumption that $\vr V$ has no member
  with a rectangular congruence, implies that $\vr V$ has no
  algebra with a strongly rectangular congruence.
  Theorems~\ref{omit_1} and \ref{str_ab_thm2} now guarantee
  that $\vr V$ has a join term.  This puts us into position
  to use Theorem~\ref{quotients}.  By part~(4) of that
  theorem, the condition that $(x,y)\in [\theta,\theta]_{\m
    r}$ means that $(x,y)$ lies in the transitive closure of
  $\sim_{\theta}$.  But according to
  Lemma~\ref{basic_prop}~(5), the fact that $\theta$~is a
  congruence implies that $\sim_{\theta}$ is transitive.
  Therefore $x\sim_{\theta} y$.  This implies that
  $x\ge_{\theta} y$ and $y\ge_{\theta} x$, so by
  Lemma~\ref{free_rect2} we get that $x\ge_T y$ and $y\ge_T
  x$. Since $B=x/\theta$ is the unique $T$-block containing
  $x$ and $y$ we have $x\geq_B y$ and $y\geq_B x$; i.e.,
  $x\sim_B y$ and hence $x\sim_T y$.
  Theorem~\ref{quotients}~(4) now guarantees that $(x,y)\in
  [T,T]_{\m r}$.
\end{proof}

The proof of Theorem~\ref{rect_cong} shows that a variety
$\vr V$ contains no member with a rectangular tolerance or
congruence if and only if ${x\sim_T y}$ in~$\m f = \m f_{\vr
  V}(x,y)$ for $T = \Tg f (x,y)$. This property is easily
seen to be expressible by an idempotent Maltsev condition,
which we record here.

\begin{thm}\label{rect_Malt_cond1}
  Let\/ $\vr V$ be a variety.  The following are equivalent.
  \begin{enumerate}
  \item[(1)] No member of\/ $\vr V$ has a nontrivial
    rectangular tolerance.
  \item[(2)] $x\sim_T y$ in\/ $\m f = \m f_{\vr V}(x,y)$
    for\/ $T = \Tg f (x,y)$.
  \item[(3)] There exists an $m\ge 1$, and sixary terms
    $f_1,\dots,f_m$ such that\/ $\vr V$ satisfies the
    following identities:
    \begin{enumerate}
    \item[(i)] $x\approx f_1(y,y,x,x,x,y)$,
    \item[(ii)] $f_m(y,x,x,x,y,y)\approx y$,
    \item[(iii)] $f_{i}(x,x,x,y,y,y) \approx
      f_{i}(y,y,x,x,x,y)$, $1\le i\le m$,
    \item[(iv)] $f_i(y,x,x,x,y,y)\approx
      f_{i+1}(y,y,x,x,x,y)$, $1\le i \le m-1$.
    \end{enumerate}
  \item[(4)] For every algebra $\m a\in {\vr V}$, tolerance
    $S$ on $\m a$, and $(a,b)\in S$, $a\ge_S b$ holds.
  \item[(5)] For every algebra $\m a\in {\vr V}$, tolerance
    $S$ on $\m a$, and $(a,b)\in S$, $a\sim_S b$ holds.
  \end{enumerate}
\end{thm}

\begin{proof}
  The proof of Theorem~\ref{rect_cong} shows that (1) and
  (2) are equivalent.

  If (2) holds, then $x\ge_T y$ in $\m f$, so according to
  Lemma~\ref{ge_in_free2} there exists a sequence
  $f_1,\ldots,f_m$ of sixary terms satisfying the identities
  in~(3).

  Now suppose that (3) holds. Choose $\m a\in {\vr V}$, a
  tolerance $S$ on~$\m a$, an $S$-block $B$ and $a, b\in B$.
  Since $B$ is a block, it is closed under all the
  idempotent terms that appear in item (3). By substituting
  $a$ and~$b$ for $x$ and~$y$ in the identities of (3) we
  obtain elements of $S$ witnessing that $a\geq_B b$.
  Namely, the fact that $(a,b)\in S$ implies that for
  each~$i$ the matrix
  \[
  \left[\begin{array}{cc} p_i&q_i\\
      r_i&s_i \end{array}\right]
  = \left[\begin{array}{cc}
      f_i(a,b,a,b,a,b)& f_i(a,a,a,b,b,b)\\
      f_i(b,b,a,a,a,b)& f_i(b,a,a,a,b,b)
    \end{array}\right]
  \]
  is in $M(S,S)$. Identities of type (iii) imply that
  $q_i=r_i$, so each $(r_i,s_i)$ is an $(S,S;0)$ pair.  The
  other identities imply that the sequence of these pairs is
  a connected chain from $a$ to $b$.  Thus $a\geq_S b$, and
  item~(4) is established.

  The argument of the previous paragraph showed that
  $a\geq_B b$ for some $S$-block $B$, and a similar one
  shows that $b\geq_B a$ for the same block $B$. Hence
  $a\sim_B b$, which implies that $a\sim_S b$.  This
  establishes item (5). Finally, item~$(2)$ is a special
  case of $(5)$.
\end{proof}

Our next task will be to connect the foregoing with the
Hobby--McKenzie term.  First we need a lemma.

\begin{lm}\label{2-elt-semi} If\/ $\m c$ is a nontrivial
  idempotent algebra with a compatible semilattice term,
  then there is an algebra\/ $\m d$ that is a homomorphic
  image of a subalgebra of\/ $\m c$ and is term equivalent
  to the $2$-element semilattice.
\end{lm}

\begin{proof}
  Denote the semilattice operation by~$+$, and call it join.
  Since the semilattice order is equationally definable by
  \[
  x\geq y\wrel{\miff} x=x+y\,,
  \]
  and $+$ is compatible, it follows that the semilattice
  order is a compatible relation.  As $C$ is not a
  singleton, there exist two distinct elements $0<1$ of~$\m
  C$.  If $c_1,\ldots,c_k$ belong to the interval $[0,1]$
  (with respect to the semilattice ordering), and $f$ is a
  term operation of $\m c$, then
  \[
  1 = f(1,\ldots,1)\ge f(c_1,\ldots,c_k)\ge 
  f(0,\ldots,0) = 0
  \]
  by the idempotence of $f$ and the compatibility of $\ge$.
  Thus $[0,1]$ is a nontrivial subalgebra of $\m c$.
  Replacing $\m c$ by this subalgebra, we may henceforth
  assume that $\m c$ has least and largest elements $0$ and
  $1$.

  If $f$ is a $k$-ary term operation of $\m c$, then since
  $+$ is compatible, the operation $f$ must commute with
  $x_1+\cdots + x_k$ on the matrix
  \[
  \left[\begin{array}{cccc}
      x_1 & 0 & \cdots & 0\\
      0 & x_2 & \cdots & 0\\
      \vdots & \vdots & & \vdots\\
      0 & 0 &  \cdots & x_k
    \end{array}\right]\,.
  \]
  This says exactly that $f(x_1,\ldots,x_k) = f_1(x_1) +
  \cdots + f_k(x_k)$ where
  $f_i(x_i):=f(0,\dots,0,x_i,0,\dots,0)$, with $x_i$ in the
  $i$-th position. As $f$ is idempotent, we have that
  \[
  f_1(x)+\dots +f_n(x)=x
  \]
  for every $x$. In particular, $f_i(x)\le x$ for every
  $x$. The functions~$f_i$ are of course endomorphisms
  for~$+$, too, since $f$ is compatible with $+$
  and~$0+0=0$.

  Choose a maximal semilattice ideal $I$ of $\m c$ that does
  not contain~$1$. Let $F=C-I$ be the complementary
  filter. Let $\theta$ be the equivalence relation on $C$
  whose classes are $I$ and $F$.  We claim that $\theta$ is
  a congruence of~$\m C$, and that $\m C/\theta$ is term
  equivalent to a semilattice.  To show this, represent an
  arbitrarily chosen term $f$ as a sum of unary polynomials
  as described in the previous paragraph.  The condition
  $f_i(x)\le x$ implies that $f_i(I)\subseteq I$. We prove
  that either $f_i(F)\subseteq F$, or $f_i(F)\subseteq
  I$. Assume that $f_i(F)\not\subseteq F$, and choose $u\in
  F$ so that $f_i(u)\in I$. By the maximality of~$I$, there
  exists an element $a\in I$ such that $a+u=1$. Since $f_i$
  is a $+$\,-endomorphism we have $f_i(1)=f_i(a)+f_i(u)\in
  I$. This shows that if $f_i(u)\in I$, then $f_i(1)\in I$,
  hence $f_i(C)\subseteq I$.  Consequently each $f_i$
  preserves $\theta$.  Since $+$ also preserves $\theta$, it
  follows that $f$ preserves it, so $\theta$ is a congruence
  of~$\m C$.

  The quotient $\m d = \m c/\theta$ is a $2$-element
  idempotent algebra with a compatible semilattice term $+$.
  Any such algebra is term equivalent to the $2$-element
  semilattice, as we now show.  Denote the elements of $D$
  by $0$ and~$1$ such that $0<1$ in the $+$\,-order.  As
  above, each term operation of~$\m d$ may be represented as
  $f(x_1,\ldots,x_k) = f_1(x_1)+\cdots + f_k(x_k)$ where
  each $f_i$ is a decreasing $+$\,-endomorphism.  But since
  $D = \{0,1\}$ this forces each $f_i$ to be the identity
  function or the constant function with value $0$. If $J
  \subseteq \{1,\ldots,k\}$ is the set of indices $j$ such
  that $f_j$ is the identity, then $J\neq\emptyset$, since
  $f$ is idempotent, and $f(x_1,\ldots,x_k) = \sum_J
  x_j$. Hence $f$ equals a semilattice term operation.
\end{proof}

Now we are in position to give a second Maltsev
characterization of the class of varieties that omit
rectangular tolerances.

\begin{thm}\label{rect_Malt_cond2}
  Let\/ $\vr V$ be a variety.  The following are equivalent.
  \begin{enumerate}
  \item[(1)] No member of\/ $\vr V$ has a nontrivial
    rectangular tolerance.
  \item[(2)] $\vr V$ satisfies an idempotent (linear)
    Maltsev condition that fails in the variety of
    semilattices.
  \item[(3)] $\vr V$ has a Hobby--McKenzie term.
  \end{enumerate}
\end{thm}

\begin{proof}
  The equivalence of (2) and (3) is
  Theorem~\ref{hobby-mckenzie_term}.  To show that
  (1)$\mimplies$(2) we argue that the idempotent linear
  Maltsev condition from Theorem~\ref{rect_Malt_cond1}~(3)
  fails in the variety of semilattices.  We give two proofs
  of this.

  First, the Maltsev condition from
  Theorem~\ref{rect_Malt_cond1} holds only in varieties
  omitting rectangular congruences.  A calculation shows
  that the largest congruence on the 2-element semilattice
  is rectangular. Therefore the Maltsev conditon fails in
  the variety of semilattices.

  For the second proof, observe that if
  $f_1(x_1,\ldots,x_6)$ is a semilattice term, then identity
  (i) of Theorem~\ref{rect_Malt_cond1}~(3), $x\approx
  f_1(y,y,x,x,x,y)$, implies that $f_1$ does not involve the
  variables $x_1, x_2$ or $x_6$.  (Otherwise, by putting the
  absorbing element of the 2-element semilattice in for
  these variables and the nonabsorbing element for the other
  variables one obtains the contradiction that these two
  elements are equal.)  This, together with the first
  instance of identity (iii), $f_{1}(x,x,x,y,y,y)\approx
  f_{1}(y,y,x,x,x,y)$ (${} \approx x$), shows that $f_1$
  does not involve $x_4, x_5$ or~$x_6$ either. Therefore, by
  idempotence, $f_1(x_1,\ldots, x_6) \approx x_3$.  This
  argument propagates down the chain of $f_i$'s via identity
  (iv), showing that each term satisfies
  $f_i(x_1,\ldots,x_6)\approx x_3$.  Identity (ii) then
  reduces to $x\approx y$, which fails in the variety of
  semilattices.

  Now we prove (2)$\mimplies$(1).  Assume that $\vr V$
  satisfies a (not necessarily linear) idempotent Maltsev
  condition, called $W$, that fails in the variety of
  semilattices.  Let $T = \tg(x,y)$ be the tolerance
  generated by~$(x,y)$ on the free algebra $\m F=\m F_{\vr
    V}(x,y)$, and let $B$ be the $T$-block of idempotent
  binary terms.  The set $B$ is closed under all idempotent
  terms of~$\vr V$, so let $\m b$ be the algebra with
  universe $B$ and basic operations all idempotent terms
  of~$\vr V$. Then $\m b$ is an idempotent algebra that
  satisfies the idempotent Maltsev condition $W$.  The
  relation~$\sim_T$ restricted to~$B$ is a
  congruence~$\theta$ of~$\m B$.

  Since the Maltsev condition $W$ is nontrivial, the variety
  generated by~$\m b$ has a join term $+$.
  By~Theorem~\ref{join_prop}~(2) and (5), $+$ is a
  compatible semilattice term of the idempotent algebra~$\m
  C=\m B/\theta$.  If $\m c$ is nontrivial, then
  Lemma~\ref{2-elt-semi} guarantees that some homomorphic
  image $\m d$ of some subalgebra $\m c$ is term equivalent
  to the $2$-element semilattice. The Maltsev condition $W$
  is satisfied by $\m c$, hence by $\m d$, hence by the
  variety of semilattices.  But we have assumed the
  contrary, so we conclude that $\m c$ is trivial.  This
  proves that $\m b$ is a single $\sim_T$ class, and
  therefore that $x\sim_T y$ in $\m f_{\vr V}(x,y)$.
  According to Theorem~\ref{rect_Malt_cond1}, this means
  that $\vr V$ contains no algebra with a nontrivial
  rectangular tolerance.
\end{proof}

In the preceding proof the implication (3)$\mimplies$(1) is
verified indirectly.  Before proceeding, we shall describe a
direct proof of this implication.  Suppose that
$f(x_1,\ldots,x_n)$ is a Hobby--McKenzie term for~$\vr V$.
Recall from Chapter~\ref{centrality} that for a subset
${U\subseteq N := \{1,\ldots,n\}}$ the expression $f_U(x,y)$
denotes the term obtained from $f$ by substituting $x$ for
$x_i$ if $i\in U$ and $y$ for $x_i$ otherwise.  The
statement that $f$~is a Hobby--McKenzie term for~$\vr V$ is
precisely the statement that $f$~is idempotent and for any
nonempty subset $U\subseteq N$ there exist subsets $V,
W\subseteq N$ with $U\subseteq V$, $U\not\subseteq W$ and
${\vr V}\models f_V(x,y)\approx f_W(x,y)$.

As usual, let $\m F=\m F_{\vr V}(x,y)$, $T = \Tg f(x,y)$,
and $B$ the $T$-block of idempotent binary terms.  Our aim
is to prove that $x\sim_T y$ using the equations of the
Hobby--McKenzie term.  Recall that the restriction
of~$\sim_T$ to~$B$ is transitive.  Let $U\subseteq N$ be
minimal under inclusion with respect to the property that
$f_U(x,x+y)\sim_T x$.  (Such a set~$U$ exists, since
$f_N(x,x+y) = x \sim_T x$.) If $U$ is not empty, then there
exist ${V, W\subseteq N}$ such that $U\subseteq V$ but
$U\not\subseteq W$, and ${f_V(x,x+y) = f_W(x,x+y)}$. Hence
by Theorem~\ref{join_prop},
\begin{equation}\label{HMpart1}
  f_U(x,x+y)+f_W(x,x+y)\sim_T f_{U\cap W}(x,x+y)\,,
\end{equation} and
\begin{equation}\label{HMpart2}
  f_U(x,x+y)+f_V(x,x+y)\sim_T f_{U\cap V}(x,x+y)=f_U(x,x+y)\,.
\end{equation}
Since $f_V(x,x+y)=f_W(x,x+y)$, the left hand sides of lines
(\ref{HMpart1}) and (\ref{HMpart2}) are the same. Therefore
\[
f_{U\cap W}(x,x+y) \sim_T f_U(x,x+y) \sim_T x\,.
\]
This contradicts the minimality of~$U$ unless $U =
\emptyset$, which leads to the conclusion that $x\sim_T
f_{\emptyset}(x,x+y) = x+y$. A symmetric argument shows that
$y\sim_T x+y$, and therefore $x\sim_T y$. At this point,
Theorem~\ref{rect_Malt_cond1} may be invoked to deduce that
no algebra in $\vr V$ has a rectangular tolerance.

\bigskip

We turn to our third Maltsev characterization of the class
of varieties that omit rectangular tolerances.  This new
Maltsev condition involves four variable terms, and somewhat
resembles Alan Day's Maltsev condition characterizing the
class of congruence modular varieties (cf.\ \cite{day1}).

\begin{df}\label{D2}
  Let $\m a$ be an algebra.  If $\Conb(\m a)$ has a
  sublattice isomorphic to the lattice $\m d_2$
\begin{figure}[ht]
\begin{center} \setlength{\unitlength}{1mm}
\begin{picture}(30,30) \put(0,10){\circle*{1.2}}
\put(0,20){\circle*{1.2}} \put(15,0){\circle*{1.2}}
\put(15,20){\circle*{1.2}} \put(15,30){\circle*{1.2}}
\put(30,10){\circle*{1.2}} \put(30,20){\circle*{1.2}}
%
\put(0,10){\line(3,-2){15}} \put(0,10){\line(3,2){15}}
\put(0,10){\line(0,1){10}} \put(15,30){\line(-3,-2){15}}
\put(15,30){\line(0,-1){10}} \put(15,30){\line(3,-2){15}}
\put(30,10){\line(-3,-2){15}} \put(30,10){\line(-3,2){15}}
\put(30,10){\line(0,1){10}}
%
\put(14,15){$\alpha$} \put(-4.5,9){$\mu$}
\put(-4.5,19){$\nu$} \put(32,9){$\delta$}
\put(32,19){$\theta$}
\end{picture}
\end{center}
\caption{$\m d_2$}\label{fig20}
\end{figure}
with $(\theta\circ\mu)\cap (\nu\circ\delta) \not\subseteq
\alpha$, then we call this sublattice a {\bf special $\m
  d_2$}\index{special $\m d_2$} in $\Conb(\m a)$. We say
that {\bf ${\vr V}$ omits special $\m d_2$'s} if for no $\m
a\in {\vr V}$ does $\Conb(\m a)$ have a sublattice that is a
special~$\m d_2$.
\end{df}

As an aid to recognizing copies of $\m d_2$ in congruence
lattices, we record the following.

\begin{lm}\label{presentation}
  A presentation of\/ $\m d_2$ relative to the variety of
  all lattices is $\lb G\mid R\rb$ where $G = \{x, y, z\}$
  and $R$ consists of the relations:
  \begin{enumerate}
  \item[(i)] $x\wedge z\leq y$,
  \item[(ii)] $x\leq z\vee( y\wedge x)$,
  \item[(iii)] $ z\leq x\vee( y\wedge z)$, and
  \item[(iv)] $ y\leq (x\wedge y)\vee( y\wedge z)$.
  \end{enumerate}
  Moreover any lattice generated by $G$ and satisfying the
  relations in~$R$ and also satisfying $x\not\leq y$ is
  isomorphic to $\m d_2$.
\end{lm}

\begin{proof}
  The reader can easily verify that the copy of $\m d_2$ in
  Figure~\ref{fig21} is generated by $x, y$ and $ z$, and
  that the relations in the statement of the lemma hold for
  these elements.  To show that it is a presentation of $\m
  d_2$ we must prove from the relations (and the laws of
  lattice theory) that the seven elements $x$, $ y$, $ z$,
  $p:= x\wedge y$, $q:= z\wedge y$, $s:= x\wedge y\wedge z$,
  and $t:= x\vee y\vee z$ are closed under meet and join.

\begin{figure}[ht]
\begin{center} \setlength{\unitlength}{1mm}
\begin{picture}(30,43) \put(0,15){\circle*{1.2}}
\put(0,25){\circle*{1.2}} \put(15,5){\circle*{1.2}}
\put(15,25){\circle*{1.2}} \put(15,35){\circle*{1.2}}
\put(30,15){\circle*{1.2}} \put(30,25){\circle*{1.2}}
%
\put(0,15){\line(3,-2){15}} \put(0,15){\line(3,2){15}}
\put(0,15){\line(0,1){10}} \put(15,35){\line(-3,-2){15}}
\put(15,35){\line(0,-1){10}} \put(15,35){\line(3,-2){15}}
\put(30,15){\line(-3,-2){15}} \put(30,15){\line(-3,2){15}}
\put(30,15){\line(0,1){10}}
%
\put(14,0){$s$} \put(14,20){$y$} \put(14,37){$t$}
\put(-4.5,14){$p$} \put(-4.5,24){$x$} \put(32,14){$q$}
\put(32,24){$z$}
\end{picture}
\end{center}
\caption{ \ }\label{fig21}
\end{figure}

It is clear that the seven elements are ordered as they
should be, and consequently $ s$ and $ t$ are the bottom and
top elements of the sublattice they generate. The only
incomparable doubletons are $\{x, y\}$, $\{x, z\}$, $\{x,
q\}$, $\{y, z\}$, $\{p, z\}$ and $\{p, q\}$.  By symmetry,
we do not need to consider the meets or joins of $\{y, z\}$
or $\{p, z\}$.  For the remaining cases:
\begin{itemize}
\item $\{x, y\}$: $x\wedge y = p$ by the definition of
  $p$. By relation (iii), $x\vee y$ is above $ z$. Since
  $x\vee y$ is formally below $x\vee y\vee z = t$, it must
  be equal to it.
\item $\{x, z\}$: $x\wedge z$ is below $ y$ by relation (i),
  so $x\wedge z = x\wedge y\wedge z = s$, as desired. $x\vee
  z$ is above $(x\wedge y)\vee(y\wedge z)$, since
  corresponding joinands are larger, and $(x\wedge
  y)\vee(y\wedge z)\geq y$ by (iv).  Therefore $x\vee z =
  x\vee y\vee z = t$.
\item $\{x, q\}$: $x\wedge q = x\wedge( y\wedge z) = s$
  holds by the definition of~$q$.  $x\vee q = x\vee(
  y\wedge z)$ is above $ z$ by (iii), therefore it is above
  $x\vee z = t$ and hence equal to $ t$.
\item $\{ p, q\}$: $ p\wedge q$ is below $x\wedge z$, which
  has already been shown to be the bottom element, so
  $p\wedge q = s$. By (iv) we have $y\leq (x\wedge
  y)\vee(y\vee z) = p\vee q\leq y$, so $p\vee q = y$.
\end{itemize}

This proves that $\lb G\mid R\rb$ presents $\m d_2$.  For
the last claim of the lemma, any lattice generated by $G$
satisfying the relations $R$ which is not isomorphic to $\m
d_2$ must be a proper quotient of $\m d_2$.  Since $\m d_2$
is a subdirectly irreducible lattice whose least congruence
collapses $p$~and~$x$, any such lattice will satisfy $x =
p\leq y$. Therefore, if a lattice is generated by $G$ and
satisfies $R$ but does not satisfy $x\leq y$, then the
lattice is isomorphic to $\m d_2$.
\end{proof}

\begin{thm}\label{equiv}
  The following are equivalent for a variety\/ $\vr V$.
  \begin{enumerate}
  \item[(1)] $\vr V$ satisfies an idempotent Maltsev
    condition that fails in the variety of semilattices.
  \item[(2)] Whenever $\theta$, $\mu$, $\nu$ and $\delta$
    are congruences on some $\m a\in {\vr V}$, then
    $(\theta\circ\mu)\cap (\nu\circ\delta) \subseteq
    [(\theta\vee\delta)\wedge(\nu\vee\mu)] \vee
    \delta\vee\mu$.
  \item[(3)] $\vr V$ has a sequence of terms $f_i(x,y,u,v)$
    for $0\leq i\leq 2m+1$, such that
    \begin{enumerate}
    \item[(i)] ${\vr V}\models f_0(x,y,u,v)\approx x$;
    \item[(ii)] ${\vr V}\models f_i(x,y,y,y)\approx
      f_{i+1}(x,y,y,y)$ for even $i$;
    \item[(iii)] ${\vr V}\models f_i(x,x,y,y)\approx
      f_{i+1}(x,x,y,y)$ and
    \item[] ${\vr V}\models f_i(x,y,x,y)\approx
      f_{i+1}(x,y,x,y)$ for odd $i$;
    \item[(iv)] ${\vr V}\models f_{2m+1}(x,y,u,v)\approx v$.
    \end{enumerate}
  \item[(4)] $\vr V$ omits special $\m d_2$'s.
  \end{enumerate}
\end{thm}

\begin{proof}
  We first establish the equivalence of (2), (3) and (4),
  and connect them to item (1) afterward.

  Assume that (2) holds.  On the free algebra $\m f = \m
  f_{\vr V}(x,y,u,v)$ let $\theta = \Cg f(x,u)$, $\mu = \Cg
  f(u,v)$, $\nu = \Cg f(x,y)$, and $\delta = \Cg f(y,v)$.
  Since $(x,v)\in (\theta\circ\mu)\cap (\nu\circ\delta)$,
  and (2) holds:
  \[
  (\theta\circ\mu)\cap (\nu\circ\delta) \subseteq
  [(\theta\vee\delta)\wedge(\nu\vee\mu)] \vee
  \delta\vee\mu\,,
  \]
  we have $(x,v)\in [(\theta\vee\delta)\wedge(\nu\vee\mu)]
  \vee \delta\vee\mu$.  Therefore, there is a sequence $f_0,
  f_1,\ldots, f_{2m+1}$ of elements of $\m f$ such that $f_0
  = x$, $f_{2m+1} = v$, $(f_i,f_{i+1})\in \delta\vee \mu$
  for even $i$ while $(f_i,f_{i+1})\in
  (\theta\vee\delta)\wedge(\nu\vee\mu)$ for odd~$i$. If one
  chooses 4--ary terms representing the $f_i$'s, it is
  straightforward to see that the equations of (3) hold.

  Assume that (3) holds and that some $\m a\in {\vr V}$ has
  congruences $\mu$, $\nu$, $\alpha$, $\delta$ and $\theta$
  that generate a sublattice of $\Conb(\m a)$ isomorphic
  to~$\m d_2$ labeled as in Figure~\ref{fig20}.  Choose any
  $(a,d)\in (\theta\circ \mu)\cap (\nu\circ\delta)$.  There
  exist elements $b, c\in A$ such that $a\equiv_{\nu} b
  \equiv_{\delta}d$ and $a\equiv_{\theta} c\equiv_{\mu}d$.
  The pairs $\big(f_i(a,b,c,d), f_{i+1}(a,b,c,d)\big)$
  belong to $\delta\vee\mu = \alpha$ for even $i$ and
  $(\theta\vee\delta)\wedge(\nu\vee\mu)\leq \alpha$ for odd
  $i$.  Hence $a = f_0(a,b,c,d)$ is $\alpha$-related to
  $f_{2m+1}(a,b,c,d) = d$.  Since $(a,d)\in (\theta\circ
  \mu)\cap (\nu\circ\delta)$ was chosen arbitrarily, this
  implies that $(\theta\circ \mu)\cap
  (\nu\circ\delta)\subseteq\alpha$.  Therefore this copy of
  $\m d_2$ is not a special $\m d_2$. The argument works for
  every $\m d_2$ that appears in a congruence lattice of a
  member of $\vr V$, so $\vr V$ omits special $\m d_2$'s and
  item~(4)~holds.

  Next we argue the contrapositive of (4)$\mimplies$(2), so
  assume that some $\m a\in {\vr V}$ has congruences $\mu$,
  $\nu$, $\delta$ and $\theta$ such that
  \[
  (\theta\circ\mu)\cap (\nu\circ\delta) \not\subseteq
  [(\theta\vee\delta)\wedge(\nu\vee\mu)] \vee
  \delta\vee\mu\,.
  \]
  Choose $(a,d)\in (\theta\circ\mu)\cap (\nu\circ\delta)$
  satisfying
  \[
  (a,d)\notin [(\theta\vee\delta)\wedge(\nu\vee\mu)]
  \vee\delta\vee\mu\,,
  \]
  as well as elements $b, c\in A$ such that $a\equiv_{\nu} b
  \equiv_{\delta}d$ and $a\equiv_{\theta} c\equiv_{\mu}d$.
  Let $\theta^*:=\Cg a \big((a,c),(b,d)\big)$,\; $\nu^*:=
  \Cg a\big((a,b),(c,d)\big)$, and
  \[
  \alpha^*:= \Cg a\big((b,d),(c,d)\big)\vee
  (\theta^*\wedge\nu^*)\,.
  \]
  We will show that the congruences $x:=\theta^*$,
  $y:=\alpha^*$, and $z:= \nu^*$ satisfy the presentation
  for $\m d_2$ given in Lemma~\ref{presentation}.

  Item (i) of Lemma~\ref{presentation} requires that
  $\theta^*\wedge \nu^*\leq \alpha^*$, which is an immediate
  consequence of the definition of $\alpha^*$.

  Item (ii) requires that $\theta^*\leq \nu^* \vee (\alpha^*
  \wedge \theta^*)$.  Since $\nu^*$ contains $(a,b)$
  and~$(c,d)$ while $\alpha^*\wedge \theta^*$ contains
  $(b,d)$, the join is the congruence generated by $X\times
  X$ where $X = \{a,b,c,d\}$. Hence the join contains the
  generators $(a,c)$ and $(b,d)$ of $\theta^*$. Item (iii)
  is symmetric to item (ii).

  For item (iv), the congruence $\theta^*\wedge \alpha^*$
  contains $\{(b,d)\}\cup (\theta^*\wedge\nu^*)$, since this
  is true of each of $\theta^*$ and $\alpha^*$.  Similarly
  $\nu^*\wedge \alpha^*$ contains $\{(c,d)\}\cup
  (\theta^*\wedge\nu^*)$. This shows that $(\theta^*\wedge
  \alpha^*)\vee (\alpha^*\wedge \nu^*)$ contains all the
  generators of $\alpha^*$.  Hence $\alpha^* \leq
  (\theta^*\wedge \alpha^*)\vee (\alpha^*\wedge \nu^*)$.

  Finally we must show that $\theta^*\not\leq \alpha^*$.
  Assume that this is not the case.  Since
  $(a,c)\in\theta^*$, this assumption forces
  $(a,c)\in\alpha^*$.  By definition, $\theta^*\leq
  (\theta\vee\delta)$,\; $\nu^*\leq (\nu\vee\mu)$,\; $\Cg
  a(b,d)\leq\delta$ and $\Cg a(c,d)\leq \mu$, so
  \[
  \alpha^* = (\theta^*\wedge \nu^*)\vee\Cg a(c,d)\vee\Cg
  a(b,d) \leq [(\theta\vee\delta)\wedge(\nu\vee\mu)] \vee
  \delta\vee\mu\,.
  \]
  Combining the facts that $(a,c)\in\alpha^*$ and $(c,d)\in
  \mu$, we obtain that the right hand side of the previous
  displayed line contains $(a,d)$. This is contrary to the
  choice of $(a,d)$, so we are forced to conclude that
  $\theta^*\not\leq \alpha^*$.  This completes the proof
  that $\{\theta^*, \alpha^*, \nu^*\}$ generates a copy of
  $\m d_2$ in $\Conb(\m a)$.  Indeed, this is a {\em
    special}\/ $\m d_2$ since $a\equiv_{\nu^*}
  b\equiv_{\alpha^*\wedge\,\theta^*} d$ and
  $a\equiv_{\theta^*} c\equiv_{\alpha^*\wedge\,\nu^*} d$, so
  \[
  (a,d)\in \big(\theta^*\circ (\alpha^*\wedge\nu^*)\big)
  \cap
  \big(\nu^*\circ(\alpha^*\wedge \theta^*)\big) 
  - \alpha^*\,.
  \]
  This proves that item (4) of the theorem fails to hold.

  Now we turn our attention to item (1).  If $\m 2 = \lb
  \{0,1\}; +\rb$ is the $2$-element join semilattice,
  $\theta, \nu\in \Con(\m 2\times \m 2)$ are the projection
  kernels, and $\alpha\in \Con(\m 2\times \m 2)$ is the
  kernel of the homomorphism $+\colon \m 2^2\to \m 2$, then
  $\theta$, $\nu$ and $\alpha$ generate a special $\m
  d_2$. Therefore the variety of semilattices does not
  satisfy the idempotent Maltsev condition in (3). This
  shows that (3)$\mimplies$(1).  To complete the proof, we
  show that (1)$\mimplies$(3).

  Both (1) and (3) are statements about the idempotent
  Maltsev conditions satisfied by~$\vr V$.  The idempotent
  reduct $\Id({\vr V})$ satisfies the same idempotent
  Maltsev conditions as $\vr V$, so to prove
  (1)$\mimplies$(3) we may (and do) assume that $\vr V$ is
  idempotent.

  Suppose that (3) fails.  Then $\vr V$ does not have terms
  satisfying the identities listed in (3), so the method
  that we used to construct those terms in our proof that
  (2)$\mimplies$(3) must fail.  Recall from that part of the
  proof that we defined $\m f = \m f_{\vr V}(x,y,u,v)$,\;
  $\theta = \Cg f(x,u)$,\; ${\mu = \Cg f(u,v)}$,\; $\nu =
  \Cg f(x,y)$, and $\delta = \Cg f(y,v)$.  We argued that if
  \[
  (x,v)\in [(\theta\vee\delta)\wedge(\nu\vee\mu)] \vee
  \delta\vee\mu\,,
  \]
  then (3) holds. Therefore, in our current situation, the
  congruence $\alpha:=[(\theta\vee\delta)\wedge(\nu\vee\mu)]
  \vee \delta\vee\mu$ does not contain the pair $(x,v)$.
  Our plan is to use this fact to construct a nontrivial
  algebra in $\vr V$ that has a compatible semilattice
  operation.

  Let $X = \{x,y,u,v\}$, so that $\m f = \m f_{\vr V}(X)$.
  Define $\m g = \m f_{\vr V}(x,v)$ to be the subalgebra
  of~$\m f$ generated by~$\{x,v\}$.  The functions
  $\tau_i\colon X\to X$ for $i = 1,2$, defined by $\tau_1(x)
  = \tau_1(y) = x = \tau_2(x) = \tau_2(u)$ and $\tau_1(u) =
  \tau_1(v) = v = \tau_2(y) = \tau_2(v)$ are transversals
  for the equivalence relations $E_1 = \Eq
  X\big((x,y),(u,v)\big)$ and $E_2 = \Eq
  X\big((x,u),(y,v)\big)$ respectively.  These transversals
  induce homomorphisms $h_i\colon \m f\to \m f$ whose
  kernels are $\theta\vee\delta$ and $\nu\vee\mu$
  respectively (according to Lemma~\ref{T_theta}~(1)), and
  whose images are both $\m g$.  Therefore the kernel of
  \[
  h:=h_1\times h_2\colon\m f\to \m g\times \m g \colon
  t(x,y,u,v)\mapsto \big(t(x,x,v,v),t(x,v,x,v)\big)
  \]
  is $[(\theta\vee\delta)\wedge(\nu\vee\mu)]$.  The
  idempotence of $\vr V$ implies that this homomorphism is
  surjective. Namely, if $(p,q) = \big(p(x,v),
  q(x,v)\big)\in G\times G$, then $(p\circ q)(x,y,u,v) :=
  p\big(q(x,y),q(u,v)\big)\in F$ is a preimage of $(p,q)$
  under $h$.  This shows that $\m g\times \m g$ is generated
  by the four elements $h(x) = (x,x)$,\, $h(y) = (x,v)$,\,
  $h(u) = (v,x)$, and $h(v) = (v,v)$.  Since the kernel of
  $h$ is contained in
  $\alpha=[(\theta\vee\delta)\wedge(\nu\vee\mu)]\vee
  \delta\vee\mu$, we may use $h$ to recast our earlier
  assumption that $(x,v)\notin\alpha$ as a statement about
  $\m g\times\m g$.  That assumption is equivalent to the
  assumption that $h(x,v) = \big((x,x),(v,v)\big)$ does not
  belong to the congruence
  \[
  \begin{array}{r@{}l}
    h(\alpha) &{} = h\big([(\theta\vee\delta)
    \wedge(\nu\vee\mu)]\vee \delta\vee\mu\big)\\
    &{} = \Cg {\m G\times \m G}\big(h(\delta\vee\mu)\big)\\
    &{} = \Cg {\m G\times \m G}\big(h(y,v), h(u,v)\big)\\
    &{} = \Cg {\m G\times \m G}\big(((x,v),(v,v)),\,
    ((v,x),(v,v))\big)\,.
  \end{array}
  \]
  Therefore, if we let $\beta = h(\alpha)$, then we have
  $\beta = \Cg {\m G\times \m G}(Y\times Y)$ where $Y =
  \{(x,v), (v,x), (v,v)\}$, and our earlier assumption that
  $(x,v)\notin\alpha$ in~$\m f$ is equivalent to the
  assumption that $\big((x,x),(v,v)\big)\notin \beta$ in~$\m
  g\times \m g$.

  For any $(p,q)\in G^2$ there is an $r\in G$ such that
  $(p,q)\wrel{\beta}(r,r)$.  Indeed, if $p=p(x,v)$ and $q =
  q(x,v)$, then for $r = p\big(q(x,v),v\big)$ we~have
  \begin{equation}\label{complicated_stuff}
    \begin{array}{r@{}l}
      (p,q)&{} =\big(p(x,v),q(x,v)\big)\\
      &{} =\big(p(q(x,x),q(v,v)),\; p(q(x,v),q(x,v))\big)\\
      &{} = (p\circ q)\big((x,x),(x,v),(v,x),(v,v)\big)\\
      &{} \equiv_{\beta} 
      (p\circ q)\big((x,x),(v,v),(v,v),(v,v)\big)\\
      &{} =\big(p(q(x,v),q(v,v)),\; p(q(x,v),q(v,v))\big)\\
      &{} =\big(p(q(x,v),v),\; p(q(x,v),v)\big)\\
      &{} =(r,r)\,.
    \end{array}
  \end{equation}
  Of course, the element $r$ need not be unique, since it
  may happen that $(p,q)\wrel{\beta}(r,r)\wrel{\beta}(s,s)$
  for some $s\neq r$.  To account for this nonuniqueness,
  let $\gamma$ be the congruence on $\m g$ defined by
  \[
  r\wrel{\gamma} s\wrel{\miff} (r,r)\wrel{\beta}(s,s)\,.
  \]
  This is indeed a congruence, as it is $\iota^{-1}(\beta)$
  for $\iota\colon \m g\to \m g^2\colon p\mapsto (p,p)$
  equal to the diagonal embedding.  Write $\overline{G}$ for
  $G/\gamma$ and $\overline{p}$ for $p/\gamma$ if~$p\in G$.
  In this notation, we have shown in
  (\ref{complicated_stuff}) that there is a well defined
  function
  \[
  \ast\colon G\times G\to\overline{G}\colon
  ({p},{q})\mapsto \overline{r}\quad
  \mbox{\rm if $(p,q)\wrel{\beta}(r,r)$\,.}
  \]
  Explicitly, the value of $p\mathop{\ast} q$ is
  $\overline{p\big(q(x,v),v\big)}$, as we have shown.

  If $q\wrel{\gamma} q'$, then
  $p\big(q(x,v),v\big)\wrel{\gamma} p\big(q'(x,v),v\big)$,
  since $p$ is a term and $\gamma$~is a congruence.  Hence
  \[
  p\mathop{\ast} q = \overline{p\big(q(x,v),v\big)} =
  \overline{p\big(q'(x,v),v\big)} = p\mathop{\ast} q'\,,
  \]
  showing that left $\ast$\,-multiplication by any $p\in G$
  is compatible with~$\gamma$.  Since the generators of
  $\beta$ are invariant under switching coordinates, the
  property $(p,q)\wrel{\beta} (r,r)$ is equivalent to
  $(q,p)\wrel{\beta} (r,r)$, so $p\mathop{\ast} q =
  q\mathop{\ast} p$.  This commutativity implies that right
  $\ast$\,-multiplication is also compatible with
  $\gamma$. Consequently $\ast$ induces a well defined
  binary operation (also called $\ast$) on $\overline{G}$:
  \[
  \ast\colon \overline{G}\times
  \overline{G}\to\overline{G}\colon
  (\overline{p},\overline{q})\mapsto \overline{r}\quad
  \mbox{\rm if $(p,q)\wrel{\beta}(r,r)$\,.}
  \]
  We have already established the commutativity of this
  operation. The idempotence of $\ast$ follows from the fact
  that $(p,p)\wrel{\beta}(p,p)$ for any $p\in G$.
  Associativity is clear, too, since
  \[
  (\overline{p}\mathrel{\ast} 
  \overline{q})\mathrel{\ast} \overline{r} =
  \overline{p\big(q(r(x,v),v),v\big)} =
  \overline{p}\mathrel{\ast}
  (\overline{q}\mathrel{\ast}\overline{r})\,.
  \]
  Thus $\ast$ is a semilattice operation on the set
  $\overline{G}$.  Moreover, $\ast$ is a compatible
  semilattice operation of the algebra $\overline{\m g} :=
  \m g/\gamma$.  For suppose that $f$ is an $n$-ary basic
  operation of $\overline{G}$, and that $\overline{p}_i,
  \overline{q}_i\in \overline{G}$ are chosen
  arbitrarily. Choose $r_i$ such that
  $(p_i,q_i)\wrel{\beta}(r_i,r_i)$ for all $i$.  Then, since
  $\beta$~is a congruence,
  $\big(f(\wec{p}),f(\wec{q})\big)\wrel{\beta}
  \big(f(\wec{r}),f(\wec{r})\big)$. This shows that
  \[
  f(\overline{\wec{p}})\mathrel{\ast} f(\overline{\wec{q}}) =
  f(\overline{\wec{r}}) =
  f(\overline{\wec{p}}\mathrel{\ast}\overline{\wec{q}})\,.
  \]
  Finally (and critically), $\overline{\m g}$ is nontrivial.
  Indeed, as $\big((x,x),(v,v)\big)\notin\beta$, we have
  that $(x,v)\notin\gamma$, so $\overline{x}$ and
  $\overline{v}$ are distinct elements of $\overline{\m g}$.

  This proves that $\overline{\m g}\in\vr V$ is a nontrivial
  algebra with a compatible semilattice operation.
  Theorem~\ref{un_rect_repn_thm} applies to show that the
  total relation on $\overline{\m g}$ is rectangular. From
  Theorem~\ref{rect_Malt_cond2} we derive that any
  idempotent Maltsev condition satisfied by $\vr V$ is also
  satisfied by the variety of semilattices.  Thus (1) fails,
  and the proof is complete.
\end{proof}

In Theorem~\ref{omit_d2_sub} we will learn that if $\vr V$
satisfies an idempotent Maltsev condition that fails in the
variety of semilattices, then $\vr V$ omits all $\m d_2$'s,
not just the special ones.\index{rectangulation|)}

