Let $A$ be a universal algebra with finitely many finitary operations. Write $F_n$ for the $n$-ary operations.
We define the affine maps on $A$ inductively: $\eta \mapsto \eta$ and $\eta \mapsto c$ where $c \in A$ are affine, and if $f \in F_n$ and $c_i \in A$ are constants, and $g$ is affine, then $\eta \mapsto f(c_1, \ldots, c_k, g(\eta), c_{k+2}, \ldots, c_n)$ is affine.
Affine maps can be thought of as syntactic objects (terms with one variable and constants), and the depth of an affine map is the number of times we use the inductive step in the definition, i.e. "how many layers of parenthesis surround $\eta$". On the other hand, an affine map gives a function $f : A \to A$, and two affine maps $f, g$ are equivalent if they define the same function.
(BTW, I've called these "affine maps" because for some universal algebras these are the affine maps, and I don't know a meaning for that term in universal algebra, but do tell if you know a more standard term for this.)
Now, we say $A$ is $k$-shallow if for every affine map $f$, there exists an affine map $g$ with depth at most $k$, which is equivalent to $f$.
Now let $V$ be a variety of universal algebras (so the class of universal algebras with a fixed set of operations, satisfying a fixed set of laws). We say $V$ is $k$-shallow if every algebra in $V$ is $k$-shallow. We say $V$ is shallow if it is $k$-shallow for some $k$.
Examples:
Groups are a variety with operations $((x, y) \mapsto x \cdot y) \in F_2$, $(x \mapsto x^{-1}) \in F_1$ and identity $e \in F_0$, and you know the laws. This variety is $3$-shallow: the deepest type of term we need is $\eta \mapsto (x \cdot \eta^{-1}) \cdot y$.
Lattices have operations $\wedge, \vee \in F_2$ and satisfy laws $x \vee y \equiv y \vee x$, $x \vee (y \vee z) \equiv (x \vee y) \vee z$, $x \vee x \equiv x$, $x \equiv x \vee (x \wedge y$, and the laws obtained by exchanging $\vee \leftrightarrow \wedge$. I know a roundabout way to prove that lattices are not shallow, but I don't have a simple direct proof.
Pre-question. Is there a simple proof that lattices are not shallow?
(According to Wikipedia, in the free lattice on generators $x, y, z$, the elements defined inductively by $p_0 = x$ and $p_{n+1} = (x \vee (y \wedge (z \vee (x \wedge (y \vee (z \wedge p_n))))))$ are distinct; I suppose the affine maps obtained by setting $p_0 = \eta$ are not shallow, but I don't know much about these lattices.)
- Distributive lattices are lattices, with additional laws $x \vee (y \wedge z) \equiv (x \vee y) \wedge (x \vee z)$ and the law obtained by exchanging $\vee \leftrightarrow \wedge$. Distributive lattices are $2$-shallow, with the deepest affine maps equivalent to $\eta \mapsto (\eta \vee x) \wedge y$.
We now get to the modular lattices. These are the lattices where the projection to an interval $[a, b]$ is well-defined in the sense that $a \leq b$ (meaning $a = a \wedge b$) implies $(c \vee a) \wedge b \equiv (c \wedge b) \vee a)$ for all $c$. To make these into a variety, we can rephrase this as the law $(a \wedge b) \vee (x \wedge b) \equiv ((a \wedge b) \vee x) \wedge b$ (this is added on top of the laws of the variety of lattices).
Question. Is the variety of modular lattices shallow?
One can ask about finite variants of these notions, i.e. bounded shallowness of finite algebras. It also interests me whether modular lattices are "finitely shallow", i.e. finite modular lattices are $k$-shallow for some fixed $k$. (Of course, any individual finite algebra is $k$-shallow for some $k$.)
(The motivation for this question is symbolic dynamical, and I don't know how this links to existing research in universal algebra. Feel free to school me on this!)