1 Introduction

The natural join and the inner union operations combine relations (i.e. tables) of a database. SQL-like languages construct queries by making repeated use of the natural join and of the union. The inner union is a mathematically well behaved variant of the union—for example, it does not introduce empty cells. Tropashko and Spight realized [25, 26] that these two operations are the meet and join operations in a class of lattices, known by now as the class of relational lattices. They proposed then lattice theory as an algebraic approach, alternative to Codd’s relational algebra [4], to the theory of databases.

Roughly speaking, elements of the relational lattice \(\mathsf {R}(D,A)\) are tables of a database, where A is a set of columns’ names and D is the set of possible cells’ values. Let us illustrate the two operations with examples. The natural join takes two tables and constructs a new one whose columns are indexed by the union of the headers, and whose rows are glueings of the rows along identical values in common columns:

figure a

The inner union restricts two tables to the common columns and lists all the rows of the two tables. The following example suggests how to construct, using this operation, a table of users given two (or more) tables of people having different roles.

figure b

Since we shall focus on lattice-theoretic considerations, we shall use the symbols \(\wedge \) and \(\vee \), in place of the symbols \(\bowtie \) for \(\cup \) used by database theorists.

A first important attempt to axiomatize these lattices was done by Litak et al. [17]. They proposed an axiomatization, comprising equations and quasiequations, in a signature that extends the pure lattice signature with a constant, the header constant. A main result of that paper is that the quasiequational theory of relational lattices is undecidable in this extended signature. Their proof mimics Maddux’s proof that the equational theory of cylindric algebras of dimension \(n \ge 3\) is undecidable [18].

Their result was further refined by us in [23]: the quasiequational theory of relational lattices is undecidable even when the signature considered is the least one, comprising only the meet (natural join) and the join operations (inner union). Our proof relied on a deeper algebraic insight: we proved that it is undecidable whether a finite subdirectly irreducible lattice can be embedded into a relational lattice—from this kind of result, undecidability of the quasiequational theory immediately follows. We proved the above statement by reducing to it an undecidable problem in modal logic, the coverability problem of a frame by a universal \(\mathbf {S5}^{3}\)-product frame [12]. In turn, this problem was shown to be undecidable by reducing it to the representability problem of finite simple relation algebras [11].

We prove here that the equational theory of relational lattices is decidable. That is, we prove that it is decidable whether two lattice terms t and s are such that \(\llbracket t \rrbracket _{v} = \llbracket s \rrbracket _{v}\), for any valuation \(v : \mathbb {X}\xrightarrow {\;\;}\mathsf {R}(D,A)\) of variables in a relational lattice \(\mathsf {R}(D,A)\). We achieve this goal by showing that this theory has a kind of finite model property of bounded size. Out main result, Theorem 25, sounds as follows: if an inclusion \(t \le s\) fails in a relational lattice \(\mathsf {R}(D,A)\), then such inclusion fails in a finite lattice \(\mathsf {R}(E,B)\), such that B is bound by an exponential function in the size of t and s, and E is linear in the size of t. It follows that the size of \(\mathsf {R}(E,B)\) can be bound by a triple exponential function in the size of t and s. In algebraic terms, our finite model theorem can be stated by saying that the variety generated by the relational lattices is actually generated by its finite generators, the relational lattices that are finite.

In our opinion, our results are significant in two respects. Firstly, the algebra of the natural join and of the inner union has a direct connection to the widespread SQL-like languages, see e.g. [17]. We dare to say that most of programmers that use a database—more or less explicitly, for example within server-side web programs—are using these operations. In view of the widespread use of these languages, the decidability status of this algebraic system deserved being settled. Moreover, we believe that the mathematical insights contained in our decidability proof shall contribute to understand further the algebraic system. For example, it is not known yet whether a complete finite axiomatic basis exists for relational lattices; finding it could eventually yield applications, e.g. on the side of automated optimization of queries.

Secondly, our work exhibits the equational theory of relational lattices as a decidable one within a long list of undecidable logical theories [11, 12, 17, 18, 23] that are used to model the constructions of relational algebra. We are exploring limits of decidability, a research direction widely explored in automata theoretic settings starting from [3]. We do this, within logic and with plenty of potential applications, coming from the undecidable side and crossing the border: after the quasiequational theory, undecidable, the next natural theory on the list, the equational theory of relational lattices, is decidable.

On the technical side, our work relies on [22] where the duality theory for finite lattices developed in [21] was used to investigate equational axiomatizations of relational lattices. A key insight from [22] is that relational lattices are, in some sense, duals of generalized ultrametric spaces over a powerset algebra. It is this perspective that made it possible to uncover the strong similarity between the lattice-theoretic methods and tools from modal logic—in particular the theory of combination of modal logics, see e.g. [15]. We exploit here this similarity to adapt filtrations techniques from modal logic [8] to lattice theory. Also, the notion of generalized ultrametric spaces over a powerset algebra and the characterization of injective objects in the category of these spaces have been fundamental tools to prove the undecidability of the quasiequational theory [23] as well as, in the present case, the decidability of the equational theory.

The paper is organised as follows. We recall in Sect. 2 some definitions and facts about lattices. The relational lattices \(\mathsf {R}(D,A)\) are introduced in Sect. 3. In Sect. 4 we show how to construct a lattice \(\mathsf {L}(X,\delta )\) from a generalized ultrametric space \((X,\delta )\). This construction generalizes the construction of the lattice \(\mathsf {R}(D,A)\): if \(X = {D}^{A}\) is the set of all functions from A to D and \(\delta \) is as a sort of Hamming distance, then \(\mathsf {L}(X,\delta ) = \mathsf {R}(D,A)\). We use the functorial properties of \(\mathsf {L}\) to argue that when a finite space \((X,\delta )\) has the property of being pairwise-complete, then \(\mathsf {L}(X,\delta )\) belongs to the variety generated by the relational lattices. In Sect. 5 we show that if an inclusion \(t \le s\) fails in a lattice \(\mathsf {R}(D,A)\), then we can construct a finite subset \(T(f,t) \subseteq {D}^{A}\), a “tableau” witnessing the failure, such that if \(T(f,t) \subseteq T\) and T is finite, then \(t \le s\) fails in a finite lattice of the form \(\mathsf {L}(T,\delta _{B})\), where the distance \(\delta _{B}\) takes values in a finite powerset algebra P(B). In Sect. 6, we show how to extend T(ft) to a finite bigger set \(\mathsf {G}\), so that \((\mathsf {G},\delta _{B})\) as a space over the powerset algebra P(B) is pairwise-complete. This lattice \(\mathsf {L}(\mathsf {G},\delta _{B})\) fails the inclusion \(t \le s\); out of it, we build a lattice of the form \(\mathsf {R}(E,B)\), which fails the same inclusion; the sizes of E and B can be bound by functions of the sizes of the terms t and s. Perspectives for future research directions appear in the last Sect. 7.

2 Elementary Notions on Orders and Lattices

We assume some basic knowledge of order and lattice theory as presented in standard monographs [5, 9]. Most of the lattice theoretic tools we use originate from the monograph [7].

A lattice is a poset L such that every finite non-empty subset \(X \subseteq L\) admits a smallest upper bound \(\bigvee X\) and a greatest lower bound \(\bigwedge X\). A lattice can also be understood as a structure \(\mathfrak {A}\) for the functional signature \((\vee ,\wedge )\), such that the interpretations of these two binary function symbols both give \(\mathfrak {A}\) the structure of an idempotent commutative semigroup, the two semigroup structures being connected by the absorption laws \(x \wedge (y \vee x) = x\) and \(x \vee (y \wedge x) = x\). Once a lattice is presented as such structure, the order is recovered by stating that \(x \le y\) holds if and only if \(x \wedge y= x\).

A lattice L is complete if any subset \(X \subseteq L\) admits a smallest upper bound \(\bigvee X\). It can be shown that this condition implies that any subset \(X \subseteq L\) admits a greatest lower bound \(\bigwedge X\). A lattice is bounded if it has a least element \(\bot \) and a greatest element \(\top \). A complete lattice (in particular, a finite lattice) is bounded, since \(\bigvee \emptyset \) and \(\bigwedge \emptyset \) are, respectively, the least and greatest elements of the lattice.

If P and Q are partially ordered sets, then a function \(f : P \xrightarrow {\;\;}Q\) is order-preserving (or monotone) if \(p \le p'\) implies \(f(p) \le f(p')\). If L and M are lattices, then a function \(f : L \xrightarrow {\;\;}M\) is a lattice morphism if it preserves the lattice operations \(\vee \) and \(\wedge \). A lattice morphism is always order-preserving. A lattice morphism \(f : L \xrightarrow {\;\;}M\) between bounded lattices L and M is bound-preserving if \(f(\bot ) = \bot \) and \(f(\top ) = \top \). A function \(f : P \xrightarrow {\;\;}Q\) is said to be left adjoint to an order-preserving \(g : Q \xrightarrow {\;\;}P\) if \(f(p) \le q\) holds if and only if \(p \le g(q)\) holds, for every \(p \in P\) and \(q \in Q\); such a left adjoint, when it exists, is unique. Dually, a function \(g : Q \xrightarrow {\;\;}P\) is said to be right adjoint to an order-preserving \(f : P \xrightarrow {\;\;}Q\) if \(f(p) \le q\) holds if and only if \(p \le g(q)\) holds; clearly, f is left adjoint to g if and only if g is right adjoint to f, so we say that f and g form an adjoint pair. If P and Q are complete lattices, the property of being a left adjoint (resp., right adjoint) to some g (resp., to some f) is equivalent to preserving all (possibly infinite) joins (resp., all meets).

A Moore family on P(U) is a collection \(\mathcal {F}\) of subsets of U which is closed under arbitrary intersections. Given a Moore family \(\mathcal {F}\) on P(U), the correspondence sending \(Z \subseteq U\) to \({\overline{Z}}^{}:= \bigcap \{\,Y \in \mathcal {F}\mid Z \subseteq Y \,\}\) is a closure operator on P(U), that is, an order-preserving inflationary and idempotent endofunction of P(U). The subsets in \(\mathcal {F}\), called the closed sets, are exactly the fixpoints of this closure operator. A Moore family \(\mathcal {F}\) has the structure of a complete lattice where

$$\begin{aligned} \bigwedge \, X&:= \bigcap X\,,&\bigvee \,X&:= {\overline{\bigcup X}}^{}\,. \end{aligned}$$
(1)

The notion of Moore family can also be defined for an arbitrary complete lattice L. Moore families on L turns out to be in bijection with closure operators on L. We shall actually consider the dual notion: a dual Moore family on a complete lattice L is a subset \(\mathcal {F}\subseteq L\) that is closed under arbitrary joins. Such an \(\mathcal {F}\) determines an interior operator (an order-preserving decreasing and idempotent endofunction on L) by the formula \({x}^{\circ } = \bigvee \{\,y \in \mathcal {F}\mid y \le x\,\}\) and has the structure of a complete lattice, where \(\bigvee _{\mathcal {F}} X := \bigvee _{L} X\) and \(\bigwedge _{\mathcal {F}} X := {(\bigwedge _{L} X)}^{\circ }\). Dual Moore families on L are in bijection with interior operators on L. Finally, let us mention that closure (resp., interior) operators arise from adjoint pairs f and g (with f left adjoint to g) by the formula \({\overline{x}}^{} = g(f(x))\) (resp., \({x}^{\circ } = f(g(x))\));

3 The Relational Lattices \(\mathsf {R}(D,A)\)

Throughout this paper we use the \({Y}^{X}\) for the set of functions of domain Y and codomain X.

Let A be a collection of attributes (or column names) and let D be a set of cell values. A relation on A and D is a pair \((\alpha ,T)\) where \(\alpha \subseteq A\) and \(T \subseteq {D}^{\alpha }\). Elements of the relational latticeFootnote 1 \(\mathsf {R}(D,A)\) are relations on A and D. Informally, a relation \((\alpha ,T)\) represents a table of a relational database, with \(\alpha \) being the header, i.e. the collection of names of columns, while T is the collection of rows.

Before we define the natural join, the inner union operations, and the order on \(\mathsf {R}(D,A)\), let us recall some key operations. If \(\alpha \subseteq \beta \subseteq A\) and \(f \in {D}^{\beta }\), then we shall use for the restriction of f to \(\alpha \); if \(T \subseteq {D}^{\beta }\), then shall denote projection to \(\alpha \), that is, the direct image of T along restriction, ; if \(T \subseteq {D}^{\alpha }\), then \(i_{\beta }(T)\) shall denote cylindrification to \(\beta \), that is, the inverse image of restriction, . Recall that \(i_{\beta }\) is right adjoint to . With this in mind, the natural join and the inner union of relations are respectively described by the following formulas:

The order is then given by .

A convenient way of describing these lattices was introduced in [17, Lemma 2.1]. The authors showed that the relational lattices \(\mathsf {R}(D,A)\) are isomorphic to the lattices of closed subsets of \(A \cup {D}^{A}\), where \(Z \subseteq A \cup {D}^{A}\) is said to be closed if it is a fixed-point of the closure operator \({\overline{(\,-\,)}}^{}\) defined as

$$\begin{aligned} {\overline{Z}}^{}&:= Z \cup \{\,f \in {D}^{A}\mid A \setminus Z \subseteq Eq(f,g), {\text {for some }} g \in Z\,\}\,, \end{aligned}$$

where in the formula above Eq(fg) is the equalizer of f and g. Letting \(\delta (f,g) := \{\,x \in A \mid f(x) \ne g(x)\,\}\), the above definition of the closure operator is obviously equivalent to the following one:

$$\begin{aligned} {\overline{Z}}^{}&:= \alpha \cup \{\,f \in {D}^{A}\mid \delta (f,g) \subseteq \alpha , \text { for some } {g} \in {Z}\, {\cap }\, {{D}^A} \,\},\; \text {with } \alpha = {Z} \cap {A}. \end{aligned}$$

From now on, we rely on this representation of relational lattices.

4 Lattices from Metric Spaces

Generalized ultrametric spaces over a Boolean algebra P(A) turn out to be a convenient tool for studying relational lattices [17, 22]. Metrics are well known tools from graph theory, see e.g. [10]. Generalized ultrametric spaces over a Boolean algebra P(A) were introduced in [20] to study equivalence relations.

Definition 1

An ultrametric space over P(A) (briefly, a space) is a pair \((X,\delta )\), with \(\delta : X \times X \xrightarrow {\;\;}P(A)\) such that, for every \(f,g,h \in X\),

$$\begin{aligned} \delta (f,f)&\subseteq \emptyset \,,&\delta (f,g)&\subseteq \delta (f,h) \cup \delta (h,g)\,, \end{aligned}$$
(2)
$$\begin{aligned} \delta (f,g)&= \emptyset \text { implies } f = g\,,&\delta (f,g)&= \delta (g,f)\,. \end{aligned}$$
(3)

That is, we have defined an ultrametric space over P(A) as a category (with a small set of objects) enriched over \((P(A)^{op},\emptyset ,\cup )\) (equation (2), see [16]) which moreover is reduced and symmetric (conditions (3)) .

A morphism of spacesFootnote 2 \(\psi : (X,\delta _{X}) \xrightarrow {\;\;}(Y,\delta _{Y})\) is a function \(\psi : X \xrightarrow {\;\;}Y\) such that \(\delta _{Y}(\psi (f),\psi (g)) \le \delta _{X}(f,g)\), for each \(f,g \in X\). Obviously, spaces and their morphisms form a category. If \(\delta _{Y}(\psi (f),\psi (g)) = \delta _{X}(f,g)\), for each \(f,g \in X\), then \(\psi \) is said to be an isometry. A space \((X,\delta )\) is said to be pairwise-complete, see [2], or convex, see [19], if, for each \(f,g \in X\) and \(\alpha ,\beta \subseteq A\),

$$\begin{aligned} \delta (f,g) \subseteq \alpha \cup \beta&\text { implies } \delta (f,h) \subseteq \alpha \text { and } \delta (h,g) \subseteq \beta \,, \;\text { for some }h \in X. \end{aligned}$$

Proposition 2

(see [2, 20]). If A is finite, then a space is injective in the category of spaces if and only if it is pairwise-complete.

If \((X,\delta _{X})\) is a space and \(Y \subseteq X\), then the restriction of \(\delta _{X}\) to Y induces a space \((Y,\delta _{X})\); we say then that \((Y,\delta _{X})\) is a subspace of X. Notice that the inclusion of Y into X yields an isometry of spaces.

Our main example of space over P(A) is \(({D}^{A},\delta )\), with \({D}^{A}\) the set of functions from A to D and the distance defined by

$$\begin{aligned} \delta (f,g)&:= \{\, a \in A \mid f(a) \ne g(a)\,\}\,. \end{aligned}$$
(4)

A second example is a slight generalization of the previous one. Given a surjective function \(\pi : D \xrightarrow {\;\;}A\), let \(\texttt {Sec}_{\pi }\) denote the set of all the functions \(f : A \xrightarrow {\;\;}D\) such that \(\pi \circ f = id_{A}\). Then \(\texttt {Sec}_{\pi }\subseteq {D}^{A}\), so \(\texttt {Sec}_{\pi }\) with the distance inherited from \(({D}^{A},\delta )\) can be made into a space. Considering the first projection \(\pi _{1} : A \times D \xrightarrow {\;\;}A\), we see that \((D^{A},\delta )\) is isomorphic to the space \(\texttt {Sec}_{\pi _{1}}\). By identifying \(f \in \texttt {Sec}_{\pi }\) with a vector \(\langle f(a) \in \pi ^{-1}(a)\mid a \in A\rangle \), we see that

$$\begin{aligned} \texttt {Sec}_{\pi }&= \prod _{a \in A}D_{a}\,, \quad \text { where } D_{a} := {\pi }^{-1}(a). \end{aligned}$$
(5)

That is, the spaces of the form \(\texttt {Sec}_{\pi }\) are naturally related to Hamming graphs in combinatorics [13], dependent function types in type theory [6, 14], universal \(\mathbf {S5}^{A}\)-product frames in modal logic [12].

Theorem 3

(see [23]). Spaces of the form \(\texttt {Sec}_{\pi }\) are, up to isomorphism, exactly the injective objects in the category of spaces.

4.1 The Lattice of a Space

The construction of the lattice \(\mathsf {R}(D,A)\) can be carried out from any space. Namely, for a space \((X,\delta )\) over P(A), say that \(Z \subseteq X\) is \(\alpha \)-closed if \(g \in Z\) and \(\delta (f,g) \subseteq \alpha \) implies \(f \in Z\). Clearly, \(\alpha \)-closed subsets of X form a Moore family so, for \(Z \subseteq X\), we denote by \({\overline{Z}}^{\alpha }\) the least \(\alpha \)-closed subset of X containing Z. Observe that \(f \in {\overline{Z}}^{\alpha }\) if and only if \(\delta (f,g) \subseteq \alpha \) for some \(g \in Z\). Next and in the rest of the paper, we shall exploit the obvious isomorphism between \(P(A)\times P(X)\) and \(P(A \cup X)\) (where we suppose A and X disjoint) and notationally identify a pair \((\alpha ,Z) \in P(A)\times P(X)\) with its image \(\alpha \cup X \in P(A \cup X)\). Let us say then that \((\alpha ,Z)\) is closed if Z is \(\alpha \)-closed. Closed subsets of \(P(A \cup X)\) form a Moore family, whence a complete lattice where the order is subset inclusion.

Definition 4

For a space \((X,\delta )\), the lattice \(\mathsf {L}(X,\delta )\) is the lattice of closed subsets of \(P(A \cup X)\).

Clearly, for the space \(({D}^{A},\delta )\), we have \(\mathsf {L}({D}^{A},\delta ) = \mathsf {R}(D,A)\). Let us mention that meets and joins \(\mathsf {L}(X,\delta )\) are computed using the formulas in (1). In particular, for joins,

$$\begin{aligned} (\alpha ,Y) \vee (\beta ,Z)&= (\alpha \cup \beta , {\overline{Y \cup Z}}^{\alpha \cup \beta })\,. \end{aligned}$$

The above formula yields that, for any \(f \in X\), \(f \in (\alpha ,Y) \vee (\beta ,Z)\) if and only if \(\delta (f,g) \subseteq \alpha \cup \beta \), for some \(g \in Y \cup Z\).

We argue next that the above construction is functorial. Below, for a function \(\psi : X \xrightarrow {\;\;}Y\), \(\psi ^{-1} : P(Y) \xrightarrow {\;\;}P(X)\) is the inverse image of \(\psi \), defined by \(\psi ^{-1}(Z) := \{\,x \in X \mid \psi (x) \in Z\,\}\).

Proposition 5

If \(\psi :(X,\delta _{X}) \xrightarrow {\;\;}(Y,\delta _{Y})\) is a space morphism and \((\alpha ,Z) \in \mathsf {L}(Y,\delta _{Y})\), then \((\alpha ,\psi ^{-1}(Z)) \in \mathsf {L}(X,\delta _{X})\). Therefore, by defining \(\mathsf {L}(\psi )(\alpha ,Z) := (\alpha ,\psi ^{-1}(Z))\), the construction \(\mathsf {L}\) lifts to a contravariant functor from the category of spaces to the category of complete meet-semilattices.

Proof

Let \(f \in X\) be such that, for some \(g \in \psi ^{-1}(Z)\) (i.e. \(\psi (g) \in Z\)), we have \(\delta _{X}(f,g) \subseteq \alpha \). Then \(\delta _{Y}(\psi (f),\psi (g)) \subseteq \delta _{X}(f,g) \subseteq \alpha \), so \(\psi (f) \in Z\), since Z is \(\alpha \)-closed, and \(f \in \psi ^{-1}(Z)\). In order to see that \(\mathsf {L}(\psi )\) preserves arbitrary intersections, recall that \(\psi ^{-1}\) does.    \(\square \)

Notice that \(\mathsf {L}(\psi )\) might not preserve arbitrary joins.

Proposition 6

The lattices \(\mathsf {L}(\texttt {Sec}_{\pi })\) generate the same lattice variety of the lattices \(\mathsf {R}(D,A)\).

That is, a lattice equation holds in all the lattices \(\mathsf {L}(\texttt {Sec}_{\pi })\) if and only if it holds in all the relation lattices \(\mathsf {R}(D,A)\).

Proof

Clearly, each lattice \(\mathsf {R}(D,A)\) is of the form \(\mathsf {L}(\texttt {Sec}_{\pi })\). Thus we only need to argue that every lattice of the form \(\mathsf {L}(\texttt {Sec}_{\pi })\) belongs to the lattice variety generated by the \(\mathsf {R}(D,A)\), that is, the least class of lattices containing the lattices \(\mathsf {R}(D,A)\) and closed under products, sublattices, and homomorphic images. We argue as follows.

As every space \(\texttt {Sec}_{\pi }\) embeds into a space \(({D}^{A},\delta )\) and a space \(\texttt {Sec}_{\pi }\) is injective, we have maps \(\iota : \texttt {Sec}_{\pi }\xrightarrow {\;\;}({D}^{A},\delta )\) and \(\psi : ({D}^{A},\delta )\xrightarrow {\;\;}\texttt {Sec}_{\pi }\) such that \(\psi \circ \iota = id_{\texttt {Sec}_{\pi }}\). By functoriality, \(\mathsf {L}(\iota ) \circ \mathsf {L}(\psi ) = id_{\mathsf {L}(\texttt {Sec}_{\pi })}\). Since \(\mathsf {L}(\iota )\) preserves all meets, it has a left adjoint \(\ell : \mathsf {L}(\texttt {Sec}_{\pi }) \xrightarrow {\;\;}\mathsf {L}({D}^{A},\delta ) = \mathsf {R}(D,A)\). It is easy to see that \((\ell ,\mathsf {L}(\psi ))\) is an EA-duet in the sense of [24, Definition 9.1] and therefore \(\mathsf {L}(\texttt {Sec}_{\pi })\) is a homomorphic image of a sublattice of \(\mathsf {R}(D,A)\), by [24, Lemma 9.7].    \(\square \)

Remark 7

For the statement of [24, Lemma 9.7] to hold, additional conditions are necessary on the domain and the codomain of an EA-duet. Yet the implication that derives being a homomorphic image of a sublattice from the existence of an EA-duet is still valid under the hypothesis that the two arrows of the EA-duet preserve one all joins and, the other, all meets.

4.2 Extension from a Boolean Subalgebra

We suppose that P(B) is a Boolean subalgebra of P(A) via an inclusion \(i : P(B) \xrightarrow {\;\;}P(A)\). If \((X,\delta _{B})\) is a space over P(B), then we can transform it into a space \((X,\delta _{A})\) over P(A) by setting \(\delta _{A}(f,g) = i(\delta _{B}(f,g))\). We have therefore two lattices \(\mathsf {L}(X,\delta _{B})\) and \(\mathsf {L}(X,\delta _{A})\).

Proposition 8

Let \(\beta \subseteq B\) and \(Y \subseteq X\). Then Y is \(\beta \)-closed if and only if it is \(i(\beta )\)-closed. Consequently the map \(i_{*}\), sending \((\beta ,Y) \in \mathsf {L}(X,\delta _{B})\) to \(i_{*}(\beta ,Y) := (i(\beta ),Y) \in \mathsf {L}(X,\delta _{A})\), is a lattice embedding.

Proof

Observe that \(\delta _{B}(f,g) \subseteq \beta \) if and only if \(\delta _{A}(f,g) = i(\delta _{B}(f,g)) \subseteq i(\beta )\). This immediately implies the first statement of the Lemma, but also that, for \(Y \subseteq X\), \({\overline{Y}}^{\beta } = {\overline{Y}}^{i(\beta )}\). Using the fact that meets are computed as intersections and that i preserves intersections, it is easily seen that \(i_{*}\) preserves meets. For joins let us compute as follows:

$$\begin{aligned} i_{*}(\beta _{1},Y_{1}) \vee i_{*}(\beta _{2},Y_{2})&= (i(\beta _{1})\cup i(\beta _{2}),{\overline{Y_{1} \cup Y_{2}}}^{i(\beta _{1}) \cup i(\beta _{2})}) \\ = \;&(i(\beta _{1}\cup \beta _{2}),{\overline{Y_{1} \cup Y_{2}}}^{i(\beta _{1} \cup \beta _{2})}) = (i(\beta _{1}\cup \beta _{2}),{\overline{Y_{1} \cup Y_{2}}}^{\beta _{1} \cup \beta _{2}}) \\ = \;&i_{*}(\beta _{1}\cup \beta _{2},{\overline{Y_{1} \cup Y_{2}}}^{\beta _{1} \cup \beta _{2}}) = i_{*}((\beta _{1},Y_{1}) \vee (\beta _{2},Y_{2})). \end{aligned}$$

   \(\square \)

5 Failures from Big to Small Lattices

The set of lattice terms is generated by the following grammar:

$$\begin{aligned} t&:= x \mid \top \mid t \wedge t \mid \bot \mid t \vee t\,, \end{aligned}$$

where x belongs to a set of variables \(\mathbb {X}\). For lattice terms \(t_{1},\ldots ,t_{n}\), we use \(Vars(t_{1},\ldots ,t_{n})\) to denote the set of variables (which is finite) occurring in any of these terms. The size of a term t is the number of nodes in the representation of t as a tree. If \(v : \mathbb {X}\xrightarrow {\;\;}L\) is a valuation of variables into a lattice L, the value of a term t w.r.t. the valuation v is defined by induction in the obvious way; here we shall use \(\llbracket t \rrbracket _{v}\) for it.

For ts two lattice terms, the inclusion \(t \le s\) is the equation \(t \vee s = s\). Any lattice-theoretic equation is equivalent to a pair of inclusions, so the problem of deciding the equational theory of a class of lattices reduces to the problem of decing inclusions. An inclusion \(t \le s\) is valid in a class of lattices \(\mathcal {K}\) if, for any valuation \(v : \mathbb {X}\xrightarrow {\;\;}L\) with \(L \in \mathcal {K}\), \(\llbracket v \rrbracket _{v} \le \llbracket s \rrbracket _{v}\); it fails in \(\mathcal {K}\) if for some \(L \in \mathcal {K}\) and \(v : \mathbb {X}\xrightarrow {\;\;}L\) we have \(\llbracket t \rrbracket _{v} \not \le \llbracket s \rrbracket _{v}\).

From now on, our goal shall be proving that if an inclusion \(t \le s\) fails in a lattice \(\mathsf {R}(D,A)\), then it fails in a lattice \(\mathsf {L}(\texttt {Sec}_{\pi })\), where \(\texttt {Sec}_{\pi }\) is a finite space over some finite Boolean algebra P(B). The size of B and of the space \(\texttt {Sec}_{\pi }\), shall be inferred from of the sizes of t and s.

From now on, we us fix terms t and s, a lattice \(\mathsf {R}(D,A)\), and a valuation \(v : \mathbb {X}\xrightarrow {\;\;}\mathsf {R}(D,A)\) such that \(\llbracket t \rrbracket _{v} \not \subseteq \llbracket s \rrbracket _{v}\).

Lemma 9

If, for some \(a \in A\), \(a \in \llbracket t \rrbracket _{v} \setminus \llbracket s \rrbracket _{v}\), then the inclusion \(t \le s\) fails in the lattice \(\mathsf {R}(E,B)\) with \(B = \emptyset \) and E a singleton.

Proof

The map sending \((\alpha ,X) \in \mathsf {R}(D,A)\) to \(\alpha \in P(A)\) is lattice morphism. Therefore if \(t \le s\) fails because of \(a \in A\), then it already fails in the Boolean lattice P(A). Since P(A) is distributive, \(t \le s\) fails in the two elements lattice. Now, when \(B = \emptyset \) and E is a singleton \(\mathsf {R}(E,B)\) is (isomorphic to) the 2 elements lattice, so the same equation fails in \(\mathsf {R}(E,B)\).    \(\square \)

Because of the Lemma, we shall focus on functions \(f \in {D}^{A}\) such that \(f \in \llbracket t \rrbracket _{v} \setminus \llbracket s \rrbracket _{v}\). In this case we shall say that f witnesses the failure of \(t \le s\) (in \(\mathsf {R}(D,A)\), w.r.t. the valuation v).

5.1 The Lattices \(\mathsf {R}(D,A)_{T}\)

Let T be a subset of \({D}^{A}\) and consider the subspace \((T,\delta )\) of \({D}^{A}\) induced by the inclusion \(i_{T} : T \subseteq {D}^{A}\). According to Proposition 5, the inclusion \(i_{T}\) induces a complete meet-semilattice homomorphism \(\mathsf {L}(i_{T}) : \mathsf {R}(D,A)= \mathsf {L}({D}^{A},\delta ) \xrightarrow {\;\;}\mathsf {L}(T,\delta )\). Such a map has a right adjoint \(j_{T} : \mathsf {L}(T,\delta ) \xrightarrow {\;\;}\mathsf {L}({D}^{A},\delta )\), which is a complete join-semilattice homomorphism; moreover \(j_{T}\) is injective, since \(\mathsf {L}(i_{T})\) is surjective.

Proposition 10

For a subset \(T \subseteq {D}^{A}\) and \((\alpha ,X) \in \mathsf {R}(D,A)\), \((\alpha , {\overline{X \cap T}}^{\alpha }) = j_{T}(\mathsf {L}(i_{T}(\alpha ,X))\). The set of elements of the form \((\alpha ,{\overline{X \cap T}}^{\alpha })\), for \(\alpha \subseteq A\) and \(X \subseteq {D}^{A}\), is a complete sub-join-semilattice of \(\mathsf {R}(D,A)\).

Proof

It is easily seen that \(\mathsf {L}(i_{T})(\alpha ,X) = (\alpha , X \cap T)\) and that, for \((\beta ,Y) \in \mathsf {L}(T,\delta )\), \((\beta ,Y) \subseteq (\alpha ,X \cap T)\) if and only if \((\beta ,{\overline{Y}}^{\beta }) \subseteq (\alpha ,X)\), so \(j_{T}(\beta ,Y) = (\beta ,{\overline{Y}}^{\beta })\).

It follows that the elements of the form \((\alpha ,{\overline{X \cap T}}^{\alpha })\), where \((\alpha ,X) \in \mathsf {R}(D,A)\), form a sub-complete join-semilattice of \(\mathsf {R}(D,A)\): indeed, they are the image of lattice \(\mathsf {L}(T,\delta )\) under the complete join-semilattice homomorphism \(j_{T}\). We argue next that, for any pair \((\alpha ,X)\) (we do not require that X is \(\alpha \)-closed) there is a \(Z \subseteq {D}^{A}\) which is \(\alpha \)-closed and such that \({\overline{X \cap T}}^{\alpha } = {\overline{Z \cap T}}^{\alpha }\). Indeed, the equality

$$\begin{aligned} {\overline{X \cap T}}^{\alpha }&= {\overline{{\overline{ X \cap T}}^{\alpha } \cap T}}^{\alpha } \end{aligned}$$

is easily verified, so we can let \(Z = {\overline{X \cap T}}^{\alpha }\).    \(\square \)

Therefore, the set of pairs of the form \((\alpha ,{\overline{X \cap T}}^{\alpha })\) is a dual Moore family and a complete lattice, where joins are computed as in \(\mathsf {R}(D,A)\), and where meets are computed in a way that we shall make explicit. For the moment, let us fix the notation.

Definition 11

\(\mathsf {R}(D,A)_{T}\) is the lattice of elements of the form \((\alpha ,{\overline{X \cap T}}^{\alpha })\).

By the proof of Proposition 10, the lattice \(\mathsf {R}(D,A)_{T}\) is isomorphic to the latttice \(\mathsf {L}(T,\delta )\). We shall use the symbol for meets in \(\mathsf {R}(D,A)_{T}\); these are computed by the formula

where, for each \((\alpha ,X) \in \mathsf {R}(D,A)\), \({(\alpha ,X)}^{\circ }\) is the greatest pair in \(\mathsf {R}(D,A)_{T}\) that is below \((\alpha ,X)\). Standard theory on adjoints yields

$$\begin{aligned} {(\alpha ,X)}^{\circ } = (j_{T} \circ \mathsf {L}(i_{T}))(\alpha ,X) = (\alpha ,{\overline{X \cap T}}^{\alpha })\,. \end{aligned}$$

We obtain in this way the explicit formula for the binary meet in \(\mathsf {R}(D,A)_{T}\):

Remark that we have

whenever \((\alpha ,X)\) and \((\beta ,Y)\) are in \(\mathsf {R}(D,A)_{T}\).

Lemma 12

Let \((\alpha ,X),(\beta ,Y) \in \mathsf {R}(D,A)_{T}\) and let \(f \in T\). If \(f \in (\alpha ,X) \cap (\beta ,Y)\), then .

Proof

This is immediate from the fact that

$$\begin{aligned} {\overline{X \cap T}}^{\alpha } \cap {\overline{Y \cap T}}^{\beta } \cap T&\subseteq {\overline{{\overline{X \cap T}}^{\alpha } \cap {\overline{Y \cap T}}^{\beta } \cap T}}^{\alpha \cap \beta }\,. \end{aligned}$$

   \(\square \)

5.2 Preservation of the Failure in the Lattices \(\mathsf {R}(D,A)_{T}\)

Recall that \(v : \mathbb {X}\xrightarrow {\;\;}\mathsf {R}(D,A)\) is the valuation that we have fixed.

Definition 13

For a susbset T of \({D}^{A}\), the valuation \(v_{T} : \mathbb {X}\xrightarrow {\;\;}\mathsf {R}(D,A)_{T}\) is defined by the formula \(v_{T}(x) = {v(x)}^{\circ }\), for each \(x \in \mathbb {X}\).

More explicitley, we have

$$\begin{aligned} v_{T}(x)&:= (\alpha , {\overline{T \cap X}}^{\alpha })\,, \quad \text {where } (\alpha ,X) = v(x)\,. \end{aligned}$$

The valuation \(v_{T}\) takes values in \(\mathsf {R}(D,A)_{T}\), while v takes value in \(\mathsf {R}(D,A)\). It is possible then to evaluate a lattice term t in \(\mathsf {R}(D,A)_{T}\) using \(v_{T}\) and to evaluate it in \(\mathsf {R}(D,A)\) using v. To improve readability, we shall use the notation \(\llbracket t \rrbracket _{T}\) for the result of evaluating the term in \(\mathsf {R}(D,A)_{T}\), and the notation \(\llbracket t \rrbracket \) for the result of evaluating it in \(\mathsf {R}(D,A)\). Since both \(\llbracket t \rrbracket \) and \(\llbracket t \rrbracket _{T}\) are subsets of \(P(A \cup X)\), it is possible to compare them using inclusion.

Lemma 14

The relation \(\llbracket s \rrbracket _{T} \subseteq \llbracket s \rrbracket \) holds, for each \(T\subseteq {D}^{A}\) and each lattice term s.

Proof

The proof of the Lemma is a straightforward induction, considering that \(v_{T}(x) \subseteq v(x)\) for all \(x \in \mathbb {X}\). For example, using \(\llbracket s_{i} \rrbracket _{T} \subseteq \llbracket s_{i} \rrbracket \), for \(i =1,2\),

   \(\square \)

A straightforward induction also yields:

Lemma 15

Let \(T\subseteq {D}^{A}\) be a finite subset, let t be a lattice term and suppose that \(\llbracket t \rrbracket = (\beta ,Y)\). Then \(\llbracket t \rrbracket _{T}\) is of the form \((\beta ,Y')\) for some \(Y' \subseteq {D}^{A}\).

Definition 16

Let us define, for each term t and \(f \in {D}^{A}\) such that \(f \in \llbracket t \rrbracket \), a finite set \(T(f,t) \subseteq {D}^{A}\) as follows:

  • If t is the variable x, then we let \(T(f,t) := \{\,f\,\}\).

  • If \(t = s_{1} \wedge s_{2}\), then \(f \in \llbracket s_{1} \rrbracket \cap \llbracket s_{2} \rrbracket \), so we define \(T(f,t) := T(f,s_{1}) \cup T(f,s_{2})\).

  • If \(t = s_{1} \vee s_{2}\) and \(\llbracket s_{i} \rrbracket = (\alpha _{i},X_{i})\) for \(i = 1,2\), then \(f \in \llbracket s_{1} \vee s_{2} \rrbracket \) gives that, for some \(i \in \{\,1,2\,\}\) there exists \(g \in X_{i}\) such that \(\delta (f,g) \subseteq \alpha _{1} \cup \alpha _{2}\). We set then \(T(f,t) := \{\,f\,\} \cup T(g,s_{i})\).

Obviously, we have:

Lemma 17

For each lattice term t and \(f \in {D}^{A}\) such that \(f \in \llbracket t \rrbracket \), \(f \in T(f,t)\).

Proposition 18

For each lattice term t and \(f \in {D}^{A}\) such that \(f \in \llbracket t \rrbracket \), if \(T(f,t) \subseteq T\), then \(f \in \llbracket t \rrbracket _{T}\).

Proof

We prove the statement by induction on t.

  • If t is the variable x and \(f \in \llbracket x \rrbracket = v(x) = (\beta ,Y)\), then \(f \in Y\). We have \(T(f,x) = \{\,f\,\}\). Obviously, \(f \in Y \cap \{\,f\,\} = Y \cap T(f,t) \subseteq Y \cap T\), so \(f \in (\beta , {\overline{Y \cap T}}^{\beta }) = v_{T}(x) = \llbracket t \rrbracket _{T}\).

  • Suppose \(t = s_{1} \wedge s_{2}\) so \(f \in \llbracket s_{1} \wedge s_{2} \rrbracket \) yields \(f \in \llbracket s_{1} \rrbracket \) and \(f\in \llbracket s_{2} \rrbracket \). We have defined \(T(f,t) = T(f,s_{1}) \cup T(f,s_{2}) \subseteq T\) and so, using \(T(f,s_{i}) \subseteq T\) and the induction hypothesis, \(f \in \llbracket s_{i} \rrbracket _{T}\) for \(i = 1,2\). By Lemma 17  \(f \in T\), so we can use Lemma 12 asserting that

  • Suppose \(t = s_{1} \vee s_{2}\) and \(f \in \llbracket s_{1} \vee s_{2} \rrbracket \); let also \((\beta _{i},Y_{i}) := \llbracket s_{i} \rrbracket \) for \(i =1,2\). We have defined \(T(f,t) := \{\,f\,\} \cup T(g,s_{i})\) for some \(i \in \{\,1,2\,\}\) and for some \(g \in \llbracket s_{i} \rrbracket \) such that \(\delta (f,g) \subseteq \beta _{1} \cup \beta _{2}\). Now \(g \in T(g,s_{i}) \subseteq T(f,t) \subseteq T\) so, by the induction hypothesis, \(g \in \llbracket s_{i} \rrbracket _{T}\). According to Lemma 15, for each \(i = 1,2\) \(\llbracket s_{i} \rrbracket _{T}\) is of the form \((\beta _{i},Y_{i}')\), for some subset \(Y'_{i} \subseteq {D}^{A}\). Therefore \(\delta (f,g) \subseteq \beta _{1} \cup \beta _{2}\) and \(g \in \llbracket s_{i} \rrbracket _{T}\) implies

    $$\begin{aligned} f \in \llbracket s_{1} \rrbracket _{T} \vee \llbracket s_{2} \rrbracket _{T} = \llbracket s_{1} \vee s_{2} \rrbracket _{T}\,. \end{aligned}$$

       \(\square \)

Proposition 19

Suppose f witnesses the failure of the inclusion \(t \le s\) in \(\mathsf {R}(D,A)\) w.r.t. the valuation v. Then, for each subset \(T \subseteq {D}^{A}\) such \(T(f,t) \subseteq T\), f witnesses the failure of the inclusion \(t \le s\) in the lattice \(\mathsf {R}(D,A)_{T}\) and w.r.t. valuation \(v_{T}\).

Proof

As f witnesses \(t \not \le s\) in \(\mathsf {R}(D,A)\), \(f \in \llbracket t \rrbracket \) and \(f \not \in \llbracket s \rrbracket \). By Lemma 18 \(f \in \llbracket t \rrbracket _{T}\). If \(f\in \llbracket s \rrbracket _{T}\), then \(\llbracket s \rrbracket _{T} \subseteq \llbracket s \rrbracket \) (Lemma 14) implies \(f \in \llbracket s \rrbracket \), a contradicition. Therefore \(f\not \in \llbracket s \rrbracket _{T}\), so f witnesses \(t \not \le s\) in \(\mathsf {R}(D,A)_{T}\).    \(\square \)

5.3 Preservation of the Failure in a Finite Lattice \(\mathsf {L}(X,\delta )\)

From now on, we suppose that \(T \subseteq {D}^{A}\) is finite and \(T(f,t) \subseteq T\) with f witnessing the failure of \(t \le s\). Consider the sub-Boolean-algebra of P(A) generated by the sets

$$\begin{aligned}&\{\, \delta (f,g) \mid f,g \in T \,\} \cup \{\,A \cap v(x) \mid x \in Vars(t,s)\,\}\,. \end{aligned}$$
(6)

Let us call \(\mathsf {B}\) this Boolean algebra (yet, notice the dependency of this definition on T, as well as on ts and v). It is well known that a Boolean algebra generated by a finite set is finite.

Remark 20

If \(n = \mathrm {card}(T)\) and \(m = \mathrm {card}(Vars(t,s))\), then \(\mathsf {B}\) can have at most \(2^{\frac{n(n-1)}{2} + m}\) atoms. If we let k be the maximum of the sizes of t and s, then, for \(T = T(f,t)\), both \(n \le k\) and \(m \le 2k\). We obtain in this case the over-approximation \(2^{\frac{k^{2} + 3k}{2}}\) on the number of atoms of \(\mathsf {B}\).

Let us also recall that \(\mathsf {B}\) is isomorphic to the powerset \(P(\mathsf {at}(\mathsf {B}))\), where \(\mathsf {at}(\mathsf {B})\) is the set of atoms of \(\mathsf {B}\). Let \(i : P(\mathsf {at}(\mathsf {B})) \xrightarrow {\;\;}P(A)\) be an injectve homomorphism of Boolean algebras whose image is \(\mathsf {B}\). Since \(\delta (f,g) \in \mathsf {B}\) for every \(f,g \in T\), we can transform the metric space \((T,\delta )\) induced from \(({D}^{A},\delta )\) into a metric space \((T,\delta _{\mathsf {at}(\mathsf {B})})\) whose distance takes values in the powerset algebra \(P(\mathsf {at}(\mathsf {B}))\):

$$\begin{aligned} \delta _{\mathsf {at}(\mathsf {B})}(f,g) = \beta&\quad \text {if and only if} \quad \delta (f,g) = i(\beta )\,. \end{aligned}$$

Recall from Proposition 8 that there is a lattice embedding \(i_{*}: \mathsf {L}(T,\delta _{\mathsf {at}(\mathsf {B})}) \xrightarrow {\;\;}\mathsf {L}(T,\delta )\), defined in the obvious way: \(i_{*}(\alpha ,Y) = (i(\beta ),Y)\).

Proposition 21

If f witnesses the failure of the inclusion \(t \le s \) in \(\mathsf {R}(D,A)\) w.r.t. the valuation v, then the same inclusion fails in all the lattices \(\mathsf {L}(T,\delta _{\mathsf {at}(\mathsf {B})})\), where T is a finite set and \(T(f,t) \subseteq T\).

Proof

By Proposition 19 the inclusion \(t \le s\) fails in the lattice \(\mathsf {R}(D,A)_{T}\). This lattice is isomorphic to the lattice \(\mathsf {L}(T,\delta )\) via the map sending \((\alpha ,X) \in \mathsf {R}(D,A)_{T}\) to \((\alpha ,X \cap T)\). Up to this isomorphism, it is seen that the (restriction to the variables in t and s of) the valuation \(v_{T}\) takes values in the image of the lattice \(\mathsf {L}(T,\delta _{\mathsf {at}(\mathsf {B})})\) via \(i_{*}\), so \(\llbracket t \rrbracket _{T},\llbracket s \rrbracket _{T}\) belong to this sublattice and the inclusion fails in this lattice, and therefore also in \(\mathsf {L}(T,\delta _{\mathsf {at}(\mathsf {B})})\).    \(\square \)

6 Preservation of the Failure in a Finite Lattice \(\mathsf {L}(\texttt {Sec}_{\pi })\)

We have seen up to now that if \(t \le s\) fails in \(\mathsf {R}(D,A)\), then it fails in many lattices of the form \(\mathsf {L}(T,\delta _{\mathsf {at}(\mathsf {B})})\). Yet it is not obvious a priori that any of these lattices belongs to the variety generated by the relational lattices. We show in this section that we can extend any T to a finite set \(\mathsf {G}\) while keeping \(\mathsf {B}\) fixed, so that \((\mathsf {G},\delta _{\mathsf {at}(\mathsf {B})})\) is a pairwise-complete space over \(P(\mathsf {at}(\mathsf {B}))\). Thus, the inclusion \(t \le s\) fails in the finite lattice \(\mathsf {L}(\mathsf {G},\delta _{\mathsf {at}(\mathsf {B})})\). Since \((\mathsf {G},\delta _{\mathsf {at}(\mathsf {B})})\) is isomorphic to a space of the form \(\texttt {Sec}_{\pi }\) with \(\pi : E \xrightarrow {\;\;}\mathsf {at}(\mathsf {B})\), the inclusion \(t \le s\) fails in a lattice \(\mathsf {L}(\texttt {Sec}_{\pi })\) which we have seen belongs to the variety generated by the relational lattices. This also leads to construct a finite relational lattice \(\mathsf {R}(\mathsf {at}(\mathsf {B}),E)\) in which the equation \(t \le s\) fails. By following the chain of constructions, the sizes of \(\mathsf {at}(\mathsf {B})\) and E can also be estimated, leading to decidability of the equational theory of relational lattices.

Definition 22

A glue of T and \(\mathsf {B}\) is a function \(g \in {D}^{A}\) such that, for all \(\alpha \in \mathsf {at}(\mathsf {B})\), there exists \(f \in T\) with . We denote by \(\mathsf {G}\) the set of all functions that are glues of T and \(\mathsf {B}\).

Observe that \(T \subseteq \mathsf {G}\) and that \(\mathsf {G}\) is finite, with

$$\begin{aligned} \mathrm {card}(\mathsf {G})&\le \mathrm {card}(T)^{\mathrm {card}(\mathsf {at}(\mathsf {B}))} \,. \end{aligned}$$
(7)

In order to prove the following Lemma, let, for each \(\alpha \in \mathsf {at}(\mathsf {B})\) and \(g \in \mathsf {G}\), \(f(g,\alpha ) \in T\) be such that .

Lemma 23

If \(g_{1},g_{2} \in \mathsf {G}\), then \(\delta (g_{1},g_{2}) \in \mathsf {B}\).

Proof

$$\begin{aligned} \delta (g_{1},g_{2})&= \bigcup _{\alpha \in \mathsf {at}(\mathsf {B})} (\alpha \cap \delta (g_{1},g_{2})) = \bigcup _{\alpha \in \mathsf {at}(\mathsf {B})} (\alpha \cap \delta (f(g_{1},\alpha ),f(g_{2},\alpha )))\,. \end{aligned}$$

Since \(\delta (f(g_{1},\alpha ),f(g_{2},\alpha )) \in \mathsf {B}\) and \(\alpha \) is an atom of \(\mathsf {B}\), each expression of the form \(\alpha \cap \delta (f(g_{1},\alpha ),f(g_{2},\alpha ))\) is either \(\emptyset \) or \(\alpha \). It follows that \(\delta (g_{1},g_{2}) \in \mathsf {B}\).    \(\square \)

For a Boolean subalgebra B of P(A), we say that a subset T of \({D}^{A}\) is pairwise-complete relative to B if, for each \(f,g \in T\),

  1. 1.

    \(\delta (f,g) \in B\),

  2. 2.

    \(\delta (f,g) \subseteq \beta \cup \gamma \), implies \(\delta (f,h) \subseteq \beta \) and \(\delta (h,g) \subseteq \gamma \) for some \(h \in T\), for each \(\beta ,\gamma \in B\).

Lemma 24

The set \(\mathsf {G}\) is pairwise-complete relative to the Boolean algebra \(\mathsf {B}\).

Proof

Let \(f,g \in \mathsf {G}\) be such that \(\delta (f,g) \subseteq \beta \cup \gamma \). Let \(h \in {D}^{A}\) be defined so that, for each \(\alpha \in \mathsf {at}(\mathsf {B})\), and , otherwise. Obviously, \(h \in \mathsf {G}\).

Observe that \(\alpha \not \subseteq \beta \) if and only if \(\alpha \subseteq \beta ^{\mathsf {c}}\), for each \(\alpha \in \mathsf {at}(\mathsf {B})\), since \(\beta \in \mathsf {B}\). We deduce therefore if \(\alpha \in \mathsf {at}(\mathsf {B})\) and \(\alpha \subseteq \beta ^{\mathsf {c}}\), so \(f(a) = h(a)\) for each \(a \in \beta ^{\mathsf {c}}\). Consequently \(\beta ^{\mathsf {c}} \subseteq Eq(f,h)\) and \(\delta (f,h) \subseteq \beta \).

We also have if \(\alpha \in \mathsf {at}(\mathsf {B})\) and \(\alpha \subseteq \gamma ^{\mathsf {c}}\). As before, this implies \(\delta (h,g) \subseteq \gamma \). Indeed, this is the case if \(\alpha \subseteq \beta \), by definition of h. Suppose now that \(\alpha \not \subseteq \beta \), so \(\alpha \subseteq \beta ^{\mathsf {c}} \cap \gamma ^{\mathsf {c}} = (\beta \cup \gamma )^{\mathsf {c}}\). Since \(\delta (f,g) \subseteq \beta \cup \gamma \), then \(\alpha \subseteq \delta (f,g)^{\mathsf {c}} = Eq(f,g)\), i.e. . Together with (by definition of h) we obtain .    \(\square \)

We can finally bring together the observations developed so far and state our main results.

Theorem 25

If an inclusion \(t \le s \) fails in all the lattices \(\mathsf {R}(D,A)\), then it fails in a finite lattice \(\mathsf {R}(E,A')\), where \(\mathrm {card}(A') \le 2^{p(k)}\) with \(k = \max (size(t),size(s))\), \(p(k) = \frac{2^{k^{2}} + 3k}{2}\), and \(\mathrm {card}(E) \le size(t)\).

Proof

By Proposition 19 the inclusion \(t \le s\) fails in all the lattices \(\mathsf {R}(D,A)_{T}\) where \(T(f,t) \subseteq T\). Once defined \(\mathsf {B}\) as the Boolean subalgebra of P(A) generated by the sets as in the display (6) (with \(T = T(f,T)\)) and \(\mathsf {G}\) as the set of glues of T(ft) and \(\mathsf {B}\) as in Definition 22, the inclusion fails in \(\mathsf {R}(D,A)_{\mathsf {G}}\), since \(T(f,T) \subseteq \mathsf {G}\), and then in \(\mathsf {L}(\mathsf {G},\delta _{\mathsf {at}(\mathsf {B})})\) by Proposition 21. The condition that \(\mathsf {G}\) is pairwise-complete relative to B is equivalent to saying that the space \((\mathsf {G},\delta _{\mathsf {at}(\mathsf {B})})\) is pairwise-complete. This space is therefore isomorphic to a space of the form \(\texttt {Sec}_{\pi }\) for some surjective \(\pi : F \xrightarrow {\;\;}\mathsf {at}(\mathsf {B})\), and \(t \le s\) fails in \(\mathsf {L}(\texttt {Sec}_{\pi })\).

Equation (7) shows that, for each \(\alpha \in \mathsf {at}(\mathsf {B})\), \(F_{\alpha } = \pi ^{-1}(\alpha )\) has cardinality at most \(\mathrm {card}(T(f,t))\) and the size of t is an upper bound for \(\mathrm {card}(T(f,t))\). We can therefore embed the space \(\texttt {Sec}_{\pi }\) into a space of the form \((E^{\mathsf {at}(\mathsf {B})},\delta )\) with the size of t an upper bound for \(\mathrm {card}(E)\). The proof of Proposition 6 exhibits \(\mathsf {L}(\texttt {Sec}_{\pi })\) as a homomorphic image of a sublattice of \(\mathsf {L}(E^{\mathsf {at}(\mathsf {B})},\delta )\) and therefore the inclusion \(t \le s\) also fails within \(\mathsf {L}(E^{\mathsf {at}(\mathsf {B})},\delta ) = \mathsf {R}(E,\mathsf {at}(\mathsf {B}))\). The upper bound on the size of \(\mathsf {at}(\mathsf {B})\) has been extimated in Remark 20.    \(\square \)

Remark 26

In the statement of the previous Theorem, the size of the lattice \(\mathsf {R}(E,A')\) can be estimated out of the sizes of E and \(A'\) considering that

$$ P({E}^{A'}) \subseteq \mathsf {R}(E,A') \subseteq P(A' \cup {E}^{A'})\,. $$

An upper bound for \(\mathrm {card}(\mathsf {R}(E,A'))\) is therefore \(2^{p(k) + k^{2^{p(k)}}}\) where p(k) is the polynomial of degree 2 as in the statement of the Theorem and k is the maximum of size(t), size(s).

A standard argument yields now:

Corollary 27

The equational theory of the relational lattices is decidable.

7 Conclusions

We argued that the equational theory of relational lattices is decidable. We achieved this goal by giving a finite (counter)model construction of bounded size.

Our result leaves open other questions that we might ask on relational lattices. We mentioned in the introduction the quest for a complete axiomatic base for this theory or, anyway, the need of a complete deductive system—so to develop automatic reasoning for the algebra of relational lattices. As part of future researches it is tempting to contribute achieving this goal using the mathematical insights contained in the decidability proof.

Our result also opens new research directions, in primis, the investigation of the complexity of deciding lattice-theoretic equations/inclusions on relational lattices. Of course, the obvious decision procedure arising from the finite model construction is not optimal; few algebraic considerations already suggest how the decision procedure can be improved.

Also, it would be desirable next to investigate decidability of equational theories in signatures extending of the pure lattice signature; many such extensions are proposed in [17]. It is not difficult to adapt the present decidability proof so to add to the signature the header constant.

A further interesting question is how this result translates back to the field of multidimensional modal logic [15]. We pointed out in [22] how the algebra of relational lattices can be encoded into multimodal framework; we conjecture that our decidability result yields the decidability of some positive fragments of well known undecidable logics, such as the products \(\mathbf {S5}^{n}\) with \(n \ge 3\). Moreover connections need to be established with other existing decidability results in modal logic and in database theory [1].