The Equational Theory of the Natural Join and Inner Union is Decidable
Abstract
The natural join and the inner union operations combine relations of a database. Tropashko and Spight [25] realized that these two operations are the meet and join operations in a class of lattices, known by now as the relational lattices. They proposed then lattice theory as an algebraic approach to the theory of databases, alternative to the relational algebra.
Previous works [17, 23] proved that the quasiequational theory of these lattices—that is, the set of definite Horn sentences valid in all the relational lattices—is undecidable, even when the signature is restricted to the pure lattice signature.
We prove here that the equational theory of relational lattices is decidable. That, is we provide an algorithm to decide if two lattice theoretic terms t, s are made equal under all interpretations in some relational lattice. We achieve this goal by showing that if an inclusion \(t \le s\) fails in any of these lattices, then it fails in a relational lattice whose size is bound by a triple exponential function of the sizes of t and s.
1 Introduction
The natural join and the inner union operations combine relations (i.e. tables) of a database. SQLlike 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.
Since we shall focus on latticetheoretic 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 SQLlike languages, see e.g. [17]. We dare to say that most of programmers that use a database—more or less explicitly, for example within serverside 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 latticetheoretic 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 pairwisecomplete, 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(f, t) to a finite bigger set \(\mathsf {G}\), so that \((\mathsf {G},\delta _{B})\) as a space over the powerset algebra P(B) is pairwisecomplete. 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 nonempty 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 orderpreserving (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 orderpreserving. A lattice morphism \(f : L \xrightarrow {\;\;}M\) between bounded lattices L and M is boundpreserving if \(f(\bot ) = \bot \) and \(f(\top ) = \top \). A function \(f : P \xrightarrow {\;\;}Q\) is said to be left adjoint to an orderpreserving \(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 orderpreserving \(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).
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 lattice^{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.
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
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)) .
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 pairwisecomplete.
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.
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)\).
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 meetsemilattices.
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 EAduet 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 EAduet. Yet the implication that derives being a homomorphic image of a sublattice from the existence of an EAduet is still valid under the hypothesis that the two arrows of the EAduet 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
5 Failures from Big to Small Lattices
For t, s two lattice terms, the inclusion \(t \le s\) is the equation \(t \vee s = s\). Any latticetheoretic 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 meetsemilattice 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 joinsemilattice 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 subjoinsemilattice 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 })\).
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 })\).
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 Open image in new window .
Proof
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}\).
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
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

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\(\square \)$$\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}$$
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 )\)
Remark 20
If \(n = \mathrm {card}(T)\) and \(m = \mathrm {card}(Vars(t,s))\), then \(\mathsf {B}\) can have at most \(2^{\frac{n(n1)}{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 overapproximation \(2^{\frac{k^{2} + 3k}{2}}\) on the number of atoms of \(\mathsf {B}\).
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 pairwisecomplete 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 Open image in new window . We denote by \(\mathsf {G}\) the set of all functions that are glues of T and \(\mathsf {B}\).
Lemma 23
If \(g_{1},g_{2} \in \mathsf {G}\), then \(\delta (g_{1},g_{2}) \in \mathsf {B}\).
Proof
 1.
\(\delta (f,g) \in B\),
 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 pairwisecomplete 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})\), Open image in new window and Open image in new window , 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 Open image in new window 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 Open image in new window 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. Open image in new window . Together with Open image in new window (by definition of h) we obtain Open image in new window . \(\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(f, t) 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 pairwisecomplete relative to B is equivalent to saying that the space \((\mathsf {G},\delta _{\mathsf {at}(\mathsf {B})})\) is pairwisecomplete. 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
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 latticetheoretic 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].
Footnotes
 1.
In [17] such a lattice is called full relational lattice. The wording “class of relational lattices” is used there for the class of lattices that have an embedding into some lattice of the form \(\mathsf {R}(D,A)\).
 2.
As P(A) is not totally ordered, we avoid calling a morphism “nonexpanding map” as it is often done in the literature.
References
 1.Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases: The Logical Level, 1st edn. AddisonWesley Longman Publishing Co., Inc., Boston (1995)Google Scholar
 2.Ackerman, N.: Completeness in generalized ultrametric spaces. pAdic Numbers Ultrametric Anal. Appl. 5(2), 89–105 (2013)MathSciNetCrossRefGoogle Scholar
 3.Caucal, D.: On infinite transition graphs having a decidable monadic theory. Theoret. Comput. Sci. 290(1), 79–115 (2003)MathSciNetCrossRefGoogle Scholar
 4.Codd, E.F.: A relational model of data for large shared data banks. Commun. ACM 13(6), 377–387 (1970)CrossRefGoogle Scholar
 5.Davey, B.A., Priestley, H.A.: Introduction to Lattices and Order. Cambridge University Press, New York (2002)CrossRefGoogle Scholar
 6.Dyckhoff, R., Tholen, W.: Exponentiable morphisms, partial products and pullback complements. J. Pure Appl. Algebra 49(1–2), 103–116 (1987)MathSciNetCrossRefGoogle Scholar
 7.Freese, R., Ježek, J., Nation, J.: Free Lattices. American Mathematical Society, Providence (1995)CrossRefGoogle Scholar
 8.Gabbay, D.M.: Selective filtration in modal logic I. Semantic tableaux method. Theoria 36, 323–330 (1970)MathSciNetCrossRefGoogle Scholar
 9.Grätzer, G.: General Lattice Theory. Birkhäuser Verlag, Basel (1998). New appendices by the author with B. A. Davey, R. Freese, B. Ganter, M. Greferath, P. Jipsen, H. A. Priestley, H. Rose, E. T. Schmidt, S. E. Schmidt, F. Wehrung and R. WilleMATHGoogle Scholar
 10.Hammack, R., Imrich, W., Klavzar, S.: Handbook of Product Graphs, 2nd edn. CRC Press Inc., Boca Raton (2011)MATHGoogle Scholar
 11.Hirsch, R., Hodkinson, I.: Representability is not decidable for finite relation algebras. Trans. Amer. Math. Soc. 353, 1403–1425 (2001)MathSciNetCrossRefGoogle Scholar
 12.Hirsch, R., Hodkinson, I., Kurucz, A.: On modal logics between \({\bf K} \times {\bf K} \times {\bf K} \) and \( {\bf S5} \times {\bf S5} \times {\bf S5} \). J. Symbolic Log. 67(3), 221–234 (2002)Google Scholar
 13.Imrich, W., Klavar, S.: Product Graphs. WileyInterscience Series in Discrete Mathematics and Optimization. WileyInterscience, New York (2000). Structure and recognition, With a foreword by Peter WinklerGoogle Scholar
 14.Jacobs, B.: Categorical Logic and Type Theory. Studies in Logic and the Foundations of Mathematics, vol. 141. NorthHolland Publishing Co., Amsterdam (1999)MATHGoogle Scholar
 15.Kurucz, A.: Combining modal logics. In: Patrick Blackburn, J.V.B., Wolter, F. (eds.) Handbook of Modal Logic, vol. 3 (Studies in Logic and Practical Reasoning), pp. 869–924. Elsevier (2007)CrossRefGoogle Scholar
 16.Lawvere, F.W.: Metric spaces, generalized logic and closed categories. Rendiconti del Seminario Matematico e Fisico di Milano XLIII, pp. 135–166 (1973)Google Scholar
 17.Litak, T., Mikulás, S., Hidders, J.: Relational lattices: from databases to universal algebra. J. Logic. Algebraic Methods Program. 85(4), 540–573 (2016)MathSciNetCrossRefGoogle Scholar
 18.Maddux, R.: The equational theory of \({C}{A}_{3}\) is undecidable. J. Symbolic Logic 45(2), 311–316 (1980)MathSciNetCrossRefGoogle Scholar
 19.Pouzet, M.: Une approche métrique de la rétraction dans les ensembles ordonnés et les graphes. In: Proceedings of the Conference on Infinitistic Mathematics (Lyon, 1984), pp. 59–89. Publ. Dp. Math. Nouvelle Sér. B, 85–2, Univ. ClaudeBernard, Lyon (1985)Google Scholar
 20.PriessCrampe, S., Ribemboim, P.: Equivalence relations and spherically complete ultrametric spaces. C. R. Acad. Sci. Paris 320(1), 1187–1192 (1995)MathSciNetMATHGoogle Scholar
 21.Santocanale, L.: A duality for finite lattices, September 2009. http://hal.archivesouvertes.fr/hal00432113
 22.Santocanale, L.: Relational lattices via duality. In: Hasuo, I. (ed.) CMCS 2016. LNCS, vol. 9608, pp. 195–215. Springer, Cham (2016)CrossRefGoogle Scholar
 23.Santocanale, L.: Embeddability into relational lattices is undecidable. In: Höfner, P., Pous, D., Struth, G. (eds.) RAMICS 2017. LNCS, vol. 10226, pp. 258–273. Springer, Cham (2017). https://hal.archivesouvertes.fr/hal01474822CrossRefGoogle Scholar
 24.Santocanale, L., Wehrung, F.: The equational theory of the weak order on finite symmetric groups, P. 41, September 2014Google Scholar
 25.Spight, M., Tropashko, V.: Relational lattice axioms (2008). http://arxiv.org/abs/0807.3795
 26.Tropashko, V.: Relational algebra as nondistributive lattice (2006). http://arxiv.org/abs/cs/0501053
Copyright information
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made. The images or other third party material in this book are included in the book's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the book's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.