The equational theory of the natural join and inner union is decidable

The natural join and the inner union operations combine relations of a database. Tropashko and Spight [24] 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, 22] 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 intepretations 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.


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,24] 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 [3], to the theory of databases.
Roughly speaking, elements of the relational lattice 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: Since we shall focus on lattice-theoretic considerations, we shall use the symbols ∧ and ∨, in place of the symbols ⊲⊳ for ∪ used by database theorists.
A first important attempt to axiomatize these lattices was done by Litak, Mikulás, and Hidders [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 ≥ 3 is undecidable [18].
Their result was further refined by us in [22]: 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 irreducilble lattice can be embedded into a relational latticefrom 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 S5 3 -product frame [11]. In turn, this problem was shown to be undecidable by reducing it to the representability problem of finite simple relation algebras [10].
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 t v = s v , for any valuation v : X − → R(D, A) of variables in a relational lattice 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 2, sounds as follows: if an inclusion t ≤ s fails in a relational lattice R(D, A), then such inclusion fails in a finite lattice 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 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 under two main respects. Firstly, the algebra of the natural join and of the inner union is so spread and used via the SQLlike languages. 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 this algebraic system, its decidability status 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 [18,10,11,17,22] that are used 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 [2]. 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 [21] where the duality theory for finite lattices developed in [20] was used to investigate equational axiomatizations of relational lattices. A key insight from [21] 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 [7] 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 [22] as well as, in the present case, the decidability of the equational theory.
The paper is organised as follows. We recall in Section 2 some definitions and facts about lattices. The relational lattices R(D, A) are introduced in Section 3. In Section 4 we show how to construct a lattice L(X, δ) from a generalized ultrametric space (X, δ). This contruction generalizes the construction of the lattice R(D, A): if X = D A is the set of all functions from A to D and δ is as a sort of Hamming distance, then L(X, δ) = R(D, A). We use the functorial properties of L to argue that when a finite space (X, δ) has the property of being pairwise-complete, then L(X, δ) belongs to the variety generated by the relational lattices. In Section 5 we show that if an inclusion t ≤ s fails in a lattice R(D, A), then we can construct a finite subset T (f, t) ⊆ D A , a "tableau" witnessing the failure, such that if T (f, t) ⊆ T and T is finite, then t ≤ s fails in a finite lattice of the form L(T, δ B ), where the distance δ B takes values in a finite powerset algebra P (B). In Section 6, we show how to extend T (f, t) to a finite bigger set G, so that (G, δ B ) as a space over the powerset algebra P (B) is pairwise-complete. This lattice L(G, δ B ) fails the inclusion t ≤ s; out of it, we build a lattice of the form 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 Section 7.

Elementary notions on orders and lattices
We assume some basic knowledge of order and lattice theory as presented in standard monographs [4,8]. Most of the lattice theoretic tools we use originate from the monograph [6].
A lattice is a poset L such that every finite non-empty subset X ⊆ L admits a smallest upper bound X and a greatest lower bound X. A lattice can also be understood as a structure A for the functional signature (∨, ∧), such that the interpretations of these two binary function symbols both give A the structure of an idempotent commutative semigroup, the two semigroup structures being connected by the absorption laws x ∧ (y ∨ x) = x and x ∨ (y ∧ x) = x. Once a lattice is presented as such structure, the order is recovered by stating that x ≤ y holds if and only if x ∧ y = x.
A lattice L is complete if any subset X ⊆ L admits a smallest upper bound X. It can be shown that this condition implies that any subset X ⊆ L admits a greatest lower bound X. A lattice is bounded if it has a least element ⊥ and a greatest element ⊤. A complete lattice (in particular, a finite lattice) is bounded, since ∅ and ∅ are, respectively, the least and greatest elements of the lattice.
If P and Q are partially ordered sets, then a function f : . If L and M are lattices, then a function f : L − → M is a lattice morphism if it preserves the lattice operations ∨ and ∧. A lattice morphism is always order-preserving. A lattice morphism f : L − → M between bounded lattices L and M is bound-preserving if f (⊥) = ⊥ and f (⊤) = ⊤. A function f : P − → Q is said to be left adjoint to an orderpreserving g : Q − → P if f (p) ≤ q holds if and only if p ≤ g(q) holds, for every p ∈ P and q ∈ Q; such a left adjoint, when it exists, is unique. Dually, a function g : Q − → P is said to be right adjoint to an order-preserving f : P − → Q if f (p) ≤ q holds if and only if p ≤ 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 F of subsets of U which is closed under arbitrary intersections. Given a Moore family F on P (U ), the correspondence , that is, an order-preserving inflationary and idempotent endofunction of P (U ). The subsets in F , called the closed sets, are exactly the fixpoints of this closure operator. A Moore family F has the structure of a complete lattice where 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 F ⊆ L that is closed under arbitrary joins. Such an F determines an interior operator (an order-preserving decreasing and idempotent endofunction on L) by the formula x • = { y ∈ F | y ≤ x } and has the structure of a complete lattice, where F X := L X and F X := ( L X) • . Dual Moore families on L are in bijection with interior operators on L. Finally, let us mention that closure (resp., interior) operators, whence Moore families (resp., dual Moore families), arise from adjoint pairs f and g (with f left adjoint to g) by the formula x = g(f (x)) (resp., x • = f (g(x))).

The relational lattices 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 (α, T ) where α ⊆ A and T ⊆ D α . Elements of the relational lattice R(D, A) 1 are relations on A and D. Informally, a relation (α, T ) represents a table of a relational database, with α 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 R(D, A), let us recall some key operations.
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 argued that the relational lattices R(D, A) are isomorphic to the lattices of closed subsets of A ∪ D A , where Z ⊆ A ∪ D A is said to be closed if it is a fixed-point of the closure operator ( − ) defined as where in the formula above Eq(f, g) is the equalizer of f and g. Letting the above definition of the closure operator is obviously equivalent to the following one: From now on, we rely on this representation of relational lattices.

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,21]. Metrics are well known tools from graph theory, see e.g. [9]. Generalized ultrametric spaces over a Boolean algebra P (A) were introduced in [19] to study equivalence relations.
We have defined an ultrametric space over P (A) as a category (with a small set of objects) enriched over (P (A) op , ∅, ∪), see [16]. We assume in this paper that such a space (X, δ) is also reduced and symmetric, that is, that the following two properties hold for every f, g ∈ X: Obviously, spaces and their morphisms form a category. If δ Y (ψ(f ), ψ(g)) = δ X (f, g), for each f, g ∈ X, then ψ is said to be an isometry. A space (X, δ) is said to be pairwise-complete, see [1], or convex, see [14], if, for each f, g ∈ X and α, β ⊆ A, Proposition 1 (see [19,1]). If A is finite, then a space is injective in the category of spaces if and only if it is pairwise-complete.
If (X, δ X ) is a space and Y ⊆ X, then the restriction of δ X to Y induces a space (Y, δ X ); we say then that (Y, δ 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 , δ), with D A the set of functions from A to D and the distance defined by A second example is a slight generalization of the previous one. Given a surjective function π : D − → A, let Sec π denote the set of all the functions f : Then Sec π ⊆ D A , so Sec π with the distance inherited from (D A , δ) can be made into a space. Considering the first projection π 1 : A × D − → A, we see that (D A , δ) is isomorphic to the space Sec π1 . By identifying f ∈ Sec π with a vector f (a) ∈ π −1 (a) | a ∈ A , we see that That is, the spaces of the form Sec π are naturally related to Hamming graphs in combinatorics [12], dependent function types in type theory [13,5], universal S5 A -product frames in modal logic [11].
Theorem 1 (see [22]). Spaces of the form Sec π 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 R(D, A) can be carried out from any space. Namely, for a space (X, δ) over P (A), say that Z ⊆ X is αclosed if g ∈ Z and δ(f, g) ⊆ α implies f ∈ Z. Clearly, α-closed subsets of X form a Moore family so, for Z ⊆ X, we denote by Z α the least closed subset of X containing Z. Observe that f ∈ Z α if and only if δ(f, g) ⊆ α for some g ∈ Z. Next and in the rest of the paper, we shall exploit the obvious isomorphism between P (A) × P (X) and P (A ∪ X) (where we suppose A and X disjoint) and notationally identify a pair (α, Z) ∈ P (A) × P (X) with its image α ∪ X ∈ P (A ∪ X). Let us say then that (α, Z) is closed if Z is α-closed. Closed subsets of P (A ∪ X) form a Moore family, whence a complete lattice where the order is subset inclusion.
Definition 2. For a space (X, δ), the lattice L(X, δ) is the lattice of closed subsets of P (A ∪ X).
Clearly, for the space (D A , δ), we have L(D A , δ) = R(D, A). Let us mention that meets and joins L(X, δ) are computed using the formulas in (1). In particular, for joins, The above formula yields that, for some We argue next that the above construction is functorial. Below, for a a function ψ : . Therefore, by defining L(ψ)(α, Z) := (α, ψ −1 (Z)), the construction L lifts to a contravariant functor from the category of spaces to the category of complete meet-semilattices.
Notice that L(ψ) might not preserve arbitrary joins. Proof. Clearly, each lattice R(D, A) is of the form L(Sec π ). Thus we only need to argue that every lattice of the form L(Sec π ) belongs to the lattice variety generated by the R (D, A), that is, the least class of lattices containing the lattices R(D, A) and closed under products, sublattices, and homomorphic images. We argue as follows.
Remark 1. For the statement of [23, 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.
Change of Boolean-algebra. We have not distinguished yet among spaces over some P (A) and spaces over some P (B). For our goals, we need to consider the following case. We suppose that P (B) is a sub-Boolean algebra of P (A) via an inclusion i : P (B) − → P (A). If (X, δ B ) is a space over P (B), then we can transform it into a space (X, δ A ) over P (A) by setting δ A (f, g) = i(δ B (f, g)). We have therefore two lattices L(X, δ B ) and L(X, δ A ). Proof. Observe that δ B (f, g) ⊆ β if and only if δ A (f, g) = i(δ B (f, g)) ⊆ i(β). This immediately implies the first statement of the Lemma, but also that, for Y ⊆ X, Y β = Y i(β) . 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:

Failures from big to small lattices
The set of lattice terms is generated by the following grammar: where x belongs to a set of variables X. For lattice terms t 1 , . . . , t n , we use V ars(t 1 , . . . , 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 : X − → 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 t v for it. For t, s two lattice terms, the inclusion t ≤ s is the equation t ∨ 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 ≤ s is valid in a class of lattices K if, for any valuation v : X − → L with L ∈ K, v v ≤ s v ; it fails in K if for some L ∈ K and v : From now on, our goal shall be proving that if an inclusion t ≤ s fails in a lattice R(D, A), then it fails in a lattice L(Sec π ), where Sec π is a finite space over some finite Boolean algebra P (B). The size of B and of the space Sec π , shall be inferred from of the sizes of t and s.
From now on, we us fix terms t and s, a lattice R (D, A), and a valuation v : Lemma 1. If, for some a ∈ A, a ∈ t v \ s v , then the inclusion t ≤ s fails in the lattice R(E, B) with B = ∅ and E a singleton.
Proof. The map sending (α, X) ∈ R(D, A) to α ∈ P (A) is lattice morphism. Therefore if t ≤ s fails because of a ∈ A, then it already fails in the Boolean lattice P (A). Since P (A) is distributive, t ≤ s fails in the two elements lattice. Now, when B = ∅ and E is a singleton R(E, B) is (isomorphic to) the 2 elements lattice, so the same equation fails in R (E, B).
Because of the Lemma, we shall focus on functions f ∈ D A such that f ∈ t v \ s v . In this case we shall say that f witnesses the failure of t ≤ s (in R (D, A), w.r.t. the valuation v).  , δ), which is a complete join-semilattice homomorphism; moreover j T is injective, since L(i T ) is surjective. T (α, X)). The set of elements of the form (α, X ∩ T α ), for α ⊆ A and Proof. It is easily seen that L(i T )(α, X) = (α, X ∩ T ) and that, for (β, Y ) ∈ L(T, δ), It follows that the elements of the form (α, form a sub-complete join-semilattice of R(D, A): indeed, they are the image of lattice L(T, δ) under the complete join-semilattice homomorphism j T . We argue next that, for any pair (α, X) (we do not require that X is α-closed) there is a Z ⊆ D A which is α-closed and such that X ∩ T α = Z ∩ T α . Indeed, the equality Therefore, the set of pairs of the form (α, X ∩ T α ) is a dual Moore family and a complete lattice, where joins are computed as in R(D, A), and where meets are computed in a way that we shall make explicit. For the moment, let us fix the notation. By the proof of Proposition 5, the lattice R(D, A) T is isomorphic to the latttice L(T, δ). We shall use the symbol for meets in R(D, A) T ; these are computed by the formula where, for each (α, X) ∈ R(D, A), (α, X) • is the greatest pair in R(D, A) T that is below (α, X). Standard theory on adjoints yields We obtain in this way the explicit formula for the binary meet in R(D, A) T : .
Remark that we have whenever (α, X) and (β, Y ) are in R(D, A) T .
Proof. This is immediate from the fact that A) is the valuation that we have fixed.

Preservation of the failure in the lattices
More explicitley, we have The valuation v T takes values in R(D, A) T , while v takes value in R(D, A). It is possible then to evaluate a lattice term t in R(D, A) T using v T and to evaluate it in R(D, A) using v. To improve readability, we shall use the notation t T for the result of evaluating the term in R(D, A) T , and the notation t for the result of evaluating it in R(D, A). Since both t and t T are subsets of P (A ∪ X), it is possible to compare them using inclusion. Proof. The proof of the Lemma is a straightforward induction, considering that v T (x) ⊆ v(x) for all x ∈ X. For example, using s i T ⊆ s i , for i = 1, 2, A straightforward induction also yields: Lemma 4. Let T ⊆ D A be a finite subset, let t be a lattice term and suppose that t = (β, Y ). Then t T is of the form (β, Y ′ ) for some Y ′ ⊆ D A .
Definition 5. Let us define, for each term t and f ∈ D A such that f ∈ t , a finite set T (f, t) ⊆ D A as follows: • If t = s 1 ∨ s 2 and s i = (α i , X i ) for i = 1, 2, then f ∈ s 1 ∨ s 2 gives that, for some i ∈ { 1, 2 } there exists g ∈ X i such that δ(f, g) ⊆ α 1 ∪ α 2 . We set then T (f, t) := { f } ∪ T (g, s i ).
Obviously, we have: Lemma 5. For each lattice term t and f ∈ D A such that f ∈ t , f ∈ T (f, t).
Proposition 6. For each lattice term t and f ∈ D A such that f ∈ t , if T (f, t) ⊆ T , then f ∈ t T .
Proof. We prove the statement by induction on t.
• Suppose t = s 1 ∧ s 2 so f ∈ s 1 ∧ s 2 yields f ∈ s 1 and f ∈ s 2 . We have defined T (f, t) = T (f, s 1 ) ∪ T (f, s 2 ) ⊆ T and so, using T (f, s i ) ⊆ T and the induction hypothesis, f ∈ s i T for i = 1, 2. By Lemma 5 f ∈ T , so we can use Lemma 2 asserting that by the induction hypothesis, g ∈ s i T . According to Lemma 4, for each Proof. As f witnesses t ≤ s in R(D, A), f ∈ t and f ∈ s . By Lemma 6 f ∈ t T . If f ∈ s T , then s T ⊆ s (Lemma 3) implies f ∈ s , a contradicition. Therefore f ∈ s T , so f witnesses t ≤ s in R(D, A) T .

5.3.
Preservation of the failure in a finite lattice L(X, δ). From now on, we suppose that T ⊆ D A is finite and T (f, t) ⊆ T with f witnessing the failure of t ≤ s. Consider the sub-Boolean-algebra of P (A) generated by the sets Let us call B this Boolean algebra (yet, notice the dependency of this definition on T , as well as on t, s and v). It is well known that a Boolean algebra generated by a finite set is finite. Let us also recall that B is isomorphic to the powerset P (at(B)), where at(B) is the set of atoms of B. Let i : P (at(B)) − → P (A) be an injectve homomorphism of Boolean algebras whose image is B. Since δ(f, g) ∈ B for every f, g ∈ T , we can transform the metric space (T, δ) induced from (D A , δ) into a metric space (T, δ at(B) ) whose distance takes values in the powerset algebra P (at(B)):  Proof. By Proposition 7 the inclusion t ≤ s fails in the lattice R(D, A) T . This lattice is isomorphic to the lattice L(T, δ) via the map sending (α, X) ∈ R(D, A) T to (α, X ∩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 L(T, δ at(B) ) via i * , so t T , s T belong to this sublattice and the inclusion fails in this lattice, and therefore also in L(T, δ at(B) ). 6. Preservation of the failure in a finite lattice L(Sec π ) We have seen up to now that if t ≤ s fails in R(D, A), then it fails in many lattices of the form L(T, δ at(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 G while keeping B fixed, so that (G, δ at(B) ) is a pairwise-complete space over P (at(B)). Thus, the inclusion t ≤ s fails in the finite lattice L(G, δ at(B) ). Since (G, δ at(B) ) is isomorphic to a space of the form Sec π with π : E − → at(B), the inclusion t ≤ s fails in a lattice L(Sec π ) which we have seen belongs to the variety generated by the relational lattices. This also leads to construct a finite relational lattice R(at(B), E) in which the equation t ≤ s fails. By following the chain of constructions, the sizes of at(B) and E can also be estimated, leading to decidability of the equational theory of relational lattices. Definition 6. A glue of T and B is a function g ∈ D A such that, for all α ∈ at(B), there exists f ∈ T with f ↾α = g. We denote by G the set of all functions that are glues of T and B.
Observe that T ⊆ G and that G is finite, with card(G) ≤ card(T ) card(at(B)) .
Lemma 7. The set G is pairwise-complete relative to the Boolean algebra B.
We can finally bring together the observations developed so far and state our main results. Proof. By Proposition 7 the inclusion t ≤ s fails in all the lattices R(D, A) T where T (f, t) ⊆ T . Once defined B as the Boolean subalgebra of P (A) generated by the sets as in the display (4) (with T = T (f, T )) and G as the set of glues of T (f, t) and B as in Definition 6, the inclusion fails in R(D, A) G , since T (f, T ) ⊆ G, and then in L(G, δ at(B) ) by Proposition 8. The condition that G is pairwise-complete relative to B is equivalent to saying that the space (G, δ at(B) ) is pairwise-complete. This space is therefore isomorphic to a space of the form Sec π for some surjective π : F − → at(B), and t ≤ s fails in L(Sec π ).
Equation (5) shows that, for each α ∈ at(B), F α = π −1 (α) has cardinality at most card(T (f, t)) and the size of t is an upper bound for card(T (f, t)). We can therefore embed the space Sec π into a space of the form (E at(B) , δ) with the size of t an upper bound for card(E). The proof of Proposition 3 exhibits L(Sec π ) as a homomorphic image of a sublattice of L(E at(B) , δ) and therefore the inclusion t ≤ s also fails within L(E at(B) , δ) = R(E, at(B)). The upper bound on the size of at(B) has been extimated in Remark 2.
Remark 3. In the statement of the previous Theorem, the size of the lattice R(E, A ′ ) can be estimated out of the sizes of E and A ′ considering that An upper bound for card(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 1. The equational theory of the relational lattices is decidable.

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. We are confident that the mathematical insights contained in the decidability proof will contribute to achieve this goal.
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 [21] 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 S5 n with n ≥ 3.