## Characterizing Data Dependencies Then and Now ∗

Phokion G. Kolaitis [ 0000 - 0002 - 8407 - 8563 ] and Andreas Pieris [ 0000 - 0003 - 4779 - 3469 ]

Abstract Data dependencies are integrity constraints that the data of interest must obey. During the 1980s, J´ anos Makowsky made a number of contributions to the study of data dependencies; in particular, he was the first researcher to characterize data dependencies in terms of their structural properties. The goal of this article is to first present an overview of Makowsky's work on characterizing certain classes of data dependencies and then discuss recent developments concerning characterizations of broader classes of data dependencies.

## 1 Introduction

Since E.F. Codd introduced the relational data model in 1970 [9], logic and databases have enjoyed a continuous and fruitful interaction, so much so that it has been said that 'logic and databases are inextricably intertwined' [13]. There are two main uses of logic in databases: the use of logic as a declarative language to express queries posed on databases and the use of logic as a specification language to express data dependencies, i.e., integrity constraints that the data of interest must obey.

Codd [10] had the key insight that first-order logic can be used as a database query language, which he called relational calculus. Furthermore, Codd showed that the expressive power of relational calculus (i.e., first-order logic on databases) coincides with that of relational algebra, which is a procedural database query language based

Phokion G. Kolaitis

University of California Santa Cruz &amp; IBM Research, e-mail: kolaitis@ucsc.edu

Andreas Pieris

University of Edinburgh &amp; University of Cyprus, e-mail: apieris@inf.ed.ac.uk

∗ This is an Author Accepted Manuscript version of the following chapter: Phokion G. Kolaitis and Andreas Pieris, Characterizing Data Dependncies Then and Now, published in Festschrift for Johann A. Makowsky, edited by Klaus Meer, Alexander Rabinovich, Elena Ravve and Andr´ es Villaveces, 2024, Springer Nature Switzerland AG.

on five basic operations on relations (union, difference, cartesian produt, projection, and selection). As regards data dependencies, Codd [11] introduced the class of functional dependencies, which to date constitute the most widely used such class of constraints. Soon after this, researchers introduced and studied several different classes of data dependencies, such as inclusion dependencies, join dependencies, and multi-valued dependencies. This plethora of types of data dependencies raised the question of identifying a unifying formalism for them. Logic came to the rescue as it was eventually realized that the class of embedded implicational dependencies (EIDs) provides such a formalism [4, 14, 29]. Embedded implicational dependencies comprise two classes of first-order sentences, the class of tuple-generating dependencies (tgds) and the class of equality-generating dependencies (egds); the latter generalizes functional dependencies, while the former generalizes, among others, inclusion, join, and multi-valued dependencies. Informally, a tgd asserts that if some tuples belong to some relations, then some other tuples must belong to some (perhaps different) relations, while an egd asserts that if some tuples belong to some relations, then two of the values occurring in some of these tuples must be equal. More precisely, a tgd is a universal-existential first-order sentence of the form

$$\forall \bar { x } \forall \bar { y } \left ( \phi ( \bar { x }, \bar { y } ) \, \rightarrow \, \exists \bar { z } \psi ( \bar { x }, \bar { z } ) \right ),$$

where 𝜙 𝑥, 𝑦 ( ¯ ¯ ) and 𝜓 𝑥, 𝑧 ( ¯ ¯ ) are conjunctions of atomic formulas. Furthermore, an egd is a universal first-order sentence of the form

$$\forall \bar { x } \left ( \phi ( \bar { x } ) \, \rightarrow \, x _ { i } = x _ { j } \right ),$$

where 𝜙 𝑥 ( ¯ ) is a conjunction of atomic formulas, and 𝑥 𝑖 , 𝑥 𝑗 are variables in ¯. 𝑥

During the 1980s, J´ anos Makowsky made remarkable contributions to the study of data dependencies. The first of these contributions concerns the implication problem for data dependencies, which by the late 1970s had emerged as the central problem in this area and, in fact, had been called the fundamental problem of databases (see [21]). This problem takes as input a finite set Σ of data dependencies and a data dependency 𝜎 , and asks whether Σ logically implies 𝜎 . Here, logical implication has two different versions: the first version is that 𝜎 is true on every database (finite or infinite) on which every member of Σ is true; the second version is that this implication holds in the finite, i.e., 𝜎 is true on every finite database on which every member of Σ is true. In the case of functional dependencies, it was known that the two versions of the implication problem coincide and that there is a polynomialtime algorithm for solving this problem. It was not known, however, whether the implication problem for EIDs was decidable or undecidable. Makowsky showed that both versions of the implication problem for EIDs are undecidable. This result appeared in a joint paper with Chandra and Lewis [7], who had independently arrived at the same solution. The proof was via a reduction from the halting problem for two-counter machines. A different reduction that uses undecidability results from equational logic was obtained by Beeri and Vardi [3] around the same time. Chandra, Lewis, and Makowsky [7] also showed that the implication problem is decidable for full tgds and egds, where a tgd is full if it has no existential quantifiers, i.e., it is a

first-order sentence of the form

## ∀ ∀ ¯ 𝑥 ¯ 𝑦 ( 𝜙 𝑥, 𝑦 ( ¯ ¯ ) → 𝜓 𝑥 ( ¯ )) ,

where 𝜙 𝑥, 𝑦 ( ¯ ¯ ) and 𝜓 𝑥 ( ¯ ) are conjunctions of atomic formulas.

Makowsky's second contribution to the study of data dependencies concerns characterizations of classes of data dependencies. To put Makowsky's work in a proper context, let us recall three important topics in mathematical logic. First, in his invited address at the 1950 International Congress of Mathematicians, Tarski articulated his interest in characterizing notions of 'metamathematical origin' in 'purely mathematical terms' [25]. A series of results in model theory eventually led to the following characterization of definability in first-order logic: a class 𝐶 of structures is definable by a finite set of first-order sentences if and only if both the class 𝐶 and its complement 𝐶 are closed under isomorphisms and ultraproducts (see [8]). Thus, the 'metamathematical' notion of definability by a finite set of firstorder sentences can be characterized in terms of purely algebraic closure properties. Second, there is a body of results in model theory, known as preservation theorems , that characterize when a first-order sentence is logically equivalent to a first-order sentence of a restricted syntactic form. The prototypical preservation theorem is the Lo´ s-Tarski Theorem, which asserts that a first-order sentence is logically equivalent to a universal first-order sentence if and only if it is preserved under substructures. Third, Lindstr¨m [19] characterized first-order logic as a maximal logic that has o some mild closure properties and satisfies the compactness theorem and the SkolemL¨ owenheim Theorem. This intrinsic characterization of first-order logic became the catalyst for the development of abstract model theory, which aims at characterizing logical formalisms in terms of their properties.

Leveraging his expertise in mathematical logic, Makowsky worked on characterizations of classes of data dependencies. In [20], he focused on full tgds and egds over uni-relational databases, that is, all data dependencies considered were over a database schema consisting of a single relation symbol. Note that much (but not all) of the work on data dependencies at that time was about uni-relational databases, perhaps because the first data dependencies studied were the functional dependencies, and they involve a single relation symbol. Makowsky obtained a preservation theorem that characterizes when a first-order sentence is logically equivalent to a finite set of full tgds and egds. This preservation theorem entails closure under subdatabases and closure under direct products. It is worth pointing out that, while this result is aligned with Tarski's goal to characterize metamathematical notions in purely mathematical terms, Makowsky questioned its relevance to databases because, as he put it, 'algebraic operations alone is not what is needed in data base theory'. In other words, Makowsky argued that characterizations of data dependencies should involve notions that are more ubiquitous in database practice. With these considerations in mind, Makowsky went on to establish the main result in [20], which is a Lindstr¨m-type theorem for the class of all full tgds and egds. Specifically, he o showed that the class of all full tgds and egds is a maximal collection of first-order sentences that satisfy a locality condition, called securability , and admit Armstrong

relations , which are relations that encapsulate precisely the full tgds and egds that are logically implied by a set of full tgds and egds.

After this, Makowsky and Vardi [22] studied data dependencies over multirelational databases, that is, data dependencies over a database schema that consists of finitely many relation symbols. Makowsky and Vardi [22] characterized when a class of databases is axiomatizable by a set of full tgds and egds, and also when it is axiomatizable by a finite set of full tgds and egds. These characterizations involve closure under subdatabases, closure under direct products, suitable locality properties, and some other structural properties that will be discussed in the sequel.

During the past two decades, data dependencies have found new uses and applications in several different areas of data management and knowledge representation, including data exchange, data integration, and specification of ontologies. As a result, the interest in characterizing data dependencies has been rekindled [12, 26]; furthermore, new preservation theorems about data dependencies have been obtained [30, 31]. In particular, using a novel notion of locality, characterizations of arbitrary tgds and egds were obtained in [12], thus going well beyond the characterizations of full tgds and egds established in [22]. In this article, we present some of these developments in detail and discuss the motivating role played by the concepts and results in [22].

## 2 Relational Databases and Data Dependencies

Let C and V be disjoint countably infinite sets of constants and variables, respectively. For an integer 𝑛 &gt; 0, we may write [ 𝑛 ] for the set { 1 , . . . , 𝑛 } .

Relational Databases. A (relational) schema S is a finite set of relation symbols (or predicates) with positive arity; let ar ( 𝑅 ) be the arity of 𝑅 . A (relational) database 𝐷 over S = { 𝑅 , . . . , 𝑅 1 𝑛 } , or simply S -database , is a tuple ( dom ( 𝐷 , 𝑅 ) 𝐷 1 , . . . , 𝑅 𝐷 𝑛 ) , where dom ( 𝐷 ) ⊆ C is a finite domain and 𝑅 𝐷 1 , . . . , 𝑅 𝐷 𝑛 are relations over dom ( 𝐷 ) , i.e., 𝑅 𝐷 𝑖 ⊆ dom ( 𝐷 ) ar ( 𝑅 𝑖 ) for 𝑖 ∈ [ 𝑛 ] . In logical terms, a database is simply a relational structure with finite domain. A fact of 𝐷 is an expression of the form 𝑅 𝑖 ( ¯ 𝑐 ) , where ¯ 𝑐 ∈ 𝑅 𝐷 𝑖 . Let facts ( 𝐷 ) be the set of facts of 𝐷 . The active domain of 𝐷 , denoted adom ( 𝐷 ) , is the set of elements of dom ( 𝐷 ) that occur in at least one fact of 𝐷 . An S -database 𝐷 ′ is a subdatabase of 𝐷 , denoted 𝐷 ′ ⪯ 𝐷 , if dom ( 𝐷 ′ ) ⊆ dom ( 𝐷 ) and, for each 𝑅 ∈ S , we have that 𝑅 𝐷 ′ = 𝑅 𝐷 | dom ( 𝐷 ′ ) , where 𝑅 𝐷 | dom ( 𝐷 ′ ) is the restriction of 𝑅 𝐷 over dom ( 𝐷 ′ ) , i.e., 𝑅 𝐷 | dom ( 𝐷 ′ ) = GLYPH&lt;8&gt; ¯ 𝑐 ∈ 𝑅 𝐷 | ¯ 𝑐 ∈ dom ( 𝐷 ′ ) ar ( 𝑅 ) GLYPH&lt;9&gt; . A homomorphism from an S -database 𝐷 to an S -database 𝐷 ′ is a function ℎ : dom ( 𝐷 ) → dom ( 𝐷 ′ ) with the following property: for each 𝑖 ∈ [ 𝑛 ] and for each tuple ( 𝑐 1 , . . . , 𝑐 𝑚 ) ∈ 𝑅 𝐷 𝑖 , we have that ( ℎ 𝑐 ( 1 ) , . . . , ℎ ( 𝑐 𝑚 )) ∈ 𝑅 𝐷 ′ 𝑖 . We write ℎ : 𝐷 → 𝐷 ′ to denote that ℎ is a homomorphism from 𝐷 to 𝐷 ′ . We also write ℎ ( facts ( 𝐷 )) for the set { 𝑅 ℎ 𝑐 ( ( ¯ )) | 𝑅 𝑐 ( ¯ ) ∈ facts ( 𝐷 )} . Finally, we say that 𝐷 and 𝐷 ′ are isomorphic , written 𝐷 ≃ 𝐷 ′ , if there is a bijection ℎ : dom ( 𝐷 ) → dom ( 𝐷 ′ ) such that ℎ is a homomorphism from 𝐷 to 𝐷 ′ and ℎ -1 is a homomorphism from 𝐷 ′ to 𝐷 .

Tuple-Generating Dependencies. An atom over S is an expression of the form 𝑅 𝑣 ( ¯ ) , where 𝑅 ∈ S and ¯ is an 𝑣 ar ( 𝑅 ) -tuple of variables from V . A tuple-generating dependency (tgd) 𝜎 over a schema S is a constant-free first-order sentence

$$\forall \bar { x } \forall \bar { y } \left ( \phi ( \bar { x }, \bar { y } ) \, \rightarrow \, \exists \bar { z } \, \psi ( \bar { x }, \bar { z } ) \right ),$$

where ¯ 𝑥, 𝑦, 𝑧 ¯ ¯ are tuples of variables of V , 𝜙 𝑥, 𝑦 ( ¯ ¯ ) is a (possibly empty) conjunction of atoms over S , and 𝜓 𝑥, 𝑧 ( ¯ ¯ ) is a non-empty conjunction of atoms over S . For brevity, we write 𝜎 as 𝜙 𝑥, 𝑦 ( ¯ ¯ ) → ∃ ¯ 𝑧 𝜓 ( ¯ 𝑥, 𝑧 ¯ ) . We refer to 𝜙 𝑥, 𝑦 ( ¯ ¯ ) and 𝜓 𝑥, 𝑧 ( ¯ ¯ ) as the body and head of 𝜎 , denoted body ( 𝜎 ) and head ( 𝜎 ) , respectively. By an abuse of notation, we may treat a tuple of variables as a set of variables, and we may also treat a conjunction of atoms as a set of atoms. A tgd is called full if it has no existentially quantified variables. Let us stress that, since the head of a tgd is by definition non-empty, full tgds mention at least one universally quantified variable, which in turn implies that their body is non-empty. An S -database 𝐷 satisfies a tgd 𝜎 as the one above, written 𝐷 | = 𝜎 , if the following holds: whenever there is a function ℎ : ¯ 𝑥 ∪ ¯ 𝑦 → dom ( 𝐷 ) such that ℎ 𝜙 𝑥, 𝑦 ( ( ¯ ¯ )) ⊆ facts ( 𝐷 ) (as usual, we write ℎ 𝜙 𝑥, 𝑦 ( ( ¯ ¯ )) for the set { 𝑅 ℎ 𝑣 ( ( ¯ )) | 𝑅 𝑣 ( ¯ ) ∈ 𝜙 𝑥, 𝑦 ( ¯ ¯ )} ), then there exists an extension ℎ ′ of ℎ such that ℎ ′ ( 𝜓 𝑥, 𝑧 ( ¯ ¯ )) ⊆ facts ( 𝐷 ) . The S -database 𝐷 satisfies a set Σ of tgds , written 𝐷 | = Σ , if 𝐷 | = 𝜎 for each 𝜎 ∈ Σ ; in this case, we say that 𝐷 is a model of Σ .

Equality-Generating Dependencies. An equality-generating dependency (egd) 𝜃 over a schema S is a constant-free first-order sentence

$$\forall \bar { x } \left ( \phi ( \bar { x } ) \, \to \, x _ { i } = x _ { j } \right ),$$

where ¯ is a tuple of variables of 𝑥 V , 𝜙 𝑥 ( ¯ ) is a (non-empty) conjunction of atoms over S , and 𝑥 , 𝑥 𝑖 𝑗 ∈ ¯. For brevity, we write 𝑥 𝜃 as 𝜙 𝑥 ( ¯ ) → 𝑥 𝑖 = 𝑥 𝑗 . We refer to 𝜙 𝑥 ( ¯ ) as the body of 𝜃 , denoted body ( 𝜃 ) . An S -database 𝐷 satisfies an egd 𝜃 as the one above, written 𝐷 | = 𝜃 , if, whenever there is a function ℎ : ¯ 𝑥 → dom ( 𝐷 ) such that ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ facts ( 𝐷 ) , then ℎ 𝑥 ( 𝑖 ) = ℎ 𝑥 ( 𝑗 ) . The S -database 𝐷 satisfies a set Σ of egds , written 𝐷 | = Σ , if 𝐷 | = 𝜃 for each egd 𝜃 ∈ Σ , and we say that 𝐷 is a model of Σ .

Finite Axiomatizability. Let 𝐶 be a collection of databases. We say that 𝐶 is finitely axiomatizable by tgds and egds if there are finite sets Σ 𝑇 and Σ 𝐸 of tgds and egds, respectively, such that for every database 𝐷 , it holds that 𝐷 ∈ 𝐶 if and only if 𝐷 | = Σ 𝑇 and 𝐷 | = Σ 𝐸 . Note that in the literature we also have the notion of axiomatizability, where the sets Σ 𝑇 and Σ 𝐸 can be infinite, i.e., if we allow Σ 𝑇 and Σ 𝐸 to be infinite, then we say that 𝐶 is axiomatizable by tgds and egds. In this paper, we focus on finite axiomatizability since it is more relevant to database practice. In what follows, we consider only collections 𝐶 of databases that are closed under isomorphisms , i.e., if 𝐷 ∈ 𝐶 and 𝐷 ′ is a database such that 𝐷 ≃ 𝐷 ′ , then 𝐷 ′ ∈ 𝐶 . In other words, for a collection of databases, we silently assume that it is closed under isomorphisms.

## 3 Finite Axiomatizability by Full TGDs and EGDs

Asdiscussed in Section 1, one of Makowsky's main contributions to the study of data dependencies concerns characterizations of classes of data dependencies. The result that stands out in this context, which we will present here, is the characterization of finite sets of full dependencies obtained by Makowsky and Vardi in 1986 [22, Theorem 5]. By definition, a full dependency is a first-order sentence of the form ∀ ∀ ¯ 𝑥 ¯ 𝑦 ( 𝜙 𝑥, 𝑦 ( ¯ ¯ ) → 𝜓 𝑥 ( ¯ )) , where 𝜙 𝑥, 𝑦 ( ¯ ¯ ) is a non-empty conjunction of relational atoms and 𝜓 𝑥 ( ¯ ) is a non-empty conjunction of relational atoms and equality atoms. Clearly, every full dependency is logically equivalent to a finite set of full tgds and egds. Consequently, given a full dependency 𝜎 , there is a finite set Σ of full tgds and egds such that, for every database 𝐷 , it holds that 𝐷 satisfies 𝜎 if and only if 𝐷 satisfies the tgds and egds of Σ . For this reason, in what follows we will state Theorem 5 of [22] in terms of finite sets of full tgds and egds.

As we shall see, Theorem 5 of [22] involves the property of closure under direct products, which is formally defined below. However, as already mentioned in Section 1, Makowsky questioned the relevance to databases of closure under algebraic operations, such as closure under direct products. With this in mind, we further present an alternative characterization of finite sets of full tgds and egds, which uses the property of closure under intersections instead of closure under direct products.

## 3.1 The Characterization by Makowsky and Vardi

We first introduce the properties that are needed for the characterization of interest and then recall the characterization by Makowski and Vardi from [22].

## Model-theoretic Properties

In the sequel, fix an arbitrary schema S = { 𝑅 , . . . , 𝑅 1 ℓ } .

1 -Criticality. An S -database 𝐷 = ( dom ( 𝐷 , 𝑅 ) 𝐷 1 , . . . , 𝑅 𝐷 ℓ ) is said to be 1 -critical if | dom ( 𝐷 )| = 1, that is, the domain of 𝐷 consists of a single element 𝑐 ∈ C , and 𝑅 𝐷 𝑖 = { 𝑐 } ar ( 𝑅 𝑖 ) for each 𝑖 ∈ [ ℓ ] , i.e., facts ( 𝐷 ) = { 𝑅 𝑖 ( 𝑐, . . . , 𝑐 ) | 𝑖 ∈ [ ℓ ]} . Let us clarify that in [22] 1-critical databases are called trivial databases. A collection of databases over S is 1 -critical if it contains an 1-critical S -database.

Domain Independence. A collection 𝐶 of databases over S is domain independent if, for every S -database 𝐷 ∈ 𝐶 and every database 𝐷 ′ with facts ( 𝐷 ) = facts ( 𝐷 ′ ) , it holds that 𝐷 ′ ∈ 𝐶 . In other words, 𝐶 is domain independent if, for every two S -databases that have the same set of facts, but not necessarily the same domain, either both are in 𝐶 or neither of them is in 𝐶 .

Modularity. A collection 𝐶 of databases over S is 𝑛 -modular , for 𝑛 ≥ 0, if, for every S -database 𝐷 ∉ 𝐶 , there is an S -database 𝐷 ′ ⪯ 𝐷 with | dom ( 𝐷 ′ )| ≤ 𝑛

such that 𝐷 ′ ∉ 𝐶 . We say that 𝐶 is modular if it is 𝑛 -modular for some 𝑛 ≥ 0. Roughly, 𝑛 -modularity provides a 'small' database with at most 𝑛 domain elements as a witness to why a database does not belong to a collection of databases. Let us clarify that in [22], 𝑛 -modularity is called 𝑛 -locality . However, here we adopt the term 𝑛 -modularity, which has been already used in [26] for a similar notion in the context of schema mappings, in order to avoid any confusion with the notion of ( 𝑛, 𝑚 ) -locality from [12], which will be used in the next section to handle arbitrary tgds and egds.

Closure Under Subdatabases. A collection 𝐶 of databases is closed under subdatabases if, for every S -database 𝐷 ∈ 𝐶 , it holds that 𝐷 ′ ∈ 𝐶 for every 𝐷 ′ ⪯ 𝐷 .

Closure Under Direct Products. Assume that 𝐷 = ( dom ( 𝐷 , 𝑅 ) 𝐷 1 , . . . , 𝑅 𝐷 ℓ ) and 𝐷 ′ = ( dom ( 𝐷 ′ ) , 𝑅 𝐷 ′ 1 , . . . , 𝑅 𝐷 ′ ℓ ) are two databases over a schema S . The direct product of 𝐷 and 𝐷 ′ , denoted 𝐷 ⊗ 𝐷 ′ , is defined as the S -database

$$D ^ { \prime \prime } = ( \text{dom} ( D ^ { \prime \prime } ), R _ { 1 } ^ { D ^ { \prime \prime } }, \dots, R _ { \ell } ^ { D ^ { \prime \prime } } ),$$

where dom ( 𝐷 ′′ ) = dom ( 𝐷 ) × dom ( 𝐷 ′ ) , and, for each 𝑖 ∈ [ ℓ ] , 𝑅 𝐷 ′′ 𝑖 is the relation

$$\left \{ \left ( ( a _ { 1 }, b _ { 1 } ), \dots, ( a _ { r _ { i } }, b _ { r _ { i } } ) \right ) \, | \, ( a _ { 1 }, \dots, a _ { r _ { i } } ) \in R _ { i } ^ { D } \text{ and } ( b _ { 1 }, \dots, b _ { r _ { i } } ) \in R _ { i } ^ { D ^ { \prime } } \right \},$$

where 𝑟 𝑖 = ar ( 𝑅 𝑖 ) is the arity of the relation symbol 𝑅 𝑖 . A collection 𝐶 of databases over S is closed under direct products if, for every two S -databases 𝐷, 𝐷 ′ ∈ 𝐶 , it holds that 𝐷 ⊗ 𝐷 ′ ∈ 𝐶 .

## The Characterization

We can now provide the characterization of interest from [22]. We do not discuss here the proof of the characterization since it will be derived from the more general characterization of finite sets of arbitrary tgds and egds presented in Section 4.

Theorem 1 (Theorem 5 in [22]) Let 𝐶 be a collection of databases. The following statements are equivalent:

- 1. 𝐶 is finitely axiomatizable by full tgds and egds.
- 2. 𝐶 is 1 -critical, domain independent, modular, closed under subdatabases, and closed under direct products.

## 3.2 The Alternative Characterization

We will present an alternative characterization of finite sets of full tgds and egds that avoids the use of closure under direct products. This is done by replacing in the characterization of Theorem 1 the property of closure under direct products with

the property of closure under intersections defined as follows. Consider a schema S = { 𝑅 , . . . , 𝑅 1 ℓ } . The intersection of the S -databases 𝐷 = ( dom ( 𝐷 , 𝑅 ) 𝐷 1 , . . . , 𝑅 𝐷 ℓ ) and 𝐷 ′ = ( dom ( 𝐷 ′ ) , 𝑅 𝐷 ′ 1 , . . . , 𝑅 𝐷 ′ ℓ ) , denoted 𝐷 ∩ 𝐷 ′ , is the database

$$( \text{dom} ( D ) \cap \text{dom} ( D ^ { \prime } ), R _ { 1 } ^ { D } \cap R _ { 1 } ^ { D ^ { \prime } }, \dots, R _ { \ell } ^ { D } \cap R _ { \ell } ^ { D ^ { \prime } } ).$$

A collection 𝐶 of databases over S is closed under intersections if, for every two S -databases 𝐷, 𝐷 ′ ∈ 𝐶 , it holds that 𝐷 ∩ 𝐷 ′ ∈ 𝐶 .

Before stating and proving the promised characterization, let us briefly discuss the two tools that will be used in the proof: Robinson's method of diagrams and McKinsey's method of eliminating disjunctions . In his Ph.D. thesis in 1949, Abraham Robinson introduced the notion of a diagram of a relational structure, which, together with its variants, became a standard tool in constructing models that contain an isomorphic copy of some structure of interest. In model theory, the method of diagrams is typically combined with the compactness theorem to construct such models (see [8, 24]). In characterizing data dependencies, however, the method of diagrams is combined with closure properties and with suitable notions of locality, instead of the compactness theorem. In 1943, J.C.C. McKinsey [23] introduced the method of eliminating disjunctions, which makes it possible to show that, when a class of structures satisfies certain closure properties, then, on such a class of structures, a first-order sentence of the form ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 )) implies one of the sentences ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 )) , for some 𝑗 ∈ [ 𝑘 ] ; as a consequence of this, on such a class of structures, the sentence ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 )) is equivalent to the sentence ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 )) . McKinsey's original application of this method used closure under direct products, but the method is flexible enough to adapt to other closure properties, such as closure under intersections. It should be noted that the method of diagrams and the method of eliminating disjunctions were already utilized by Makowsky and Vardi [22] in the proof of Theorem 1.

Theorem 2 Let 𝐶 be a collection of databases. The following are equivalent:

- 1. 𝐶 is finitely axiomatizable by full tgds and egds.
- 2. 𝐶 is 1 -critical, domain independent, modular, closed under subdatabases, and closed under intersections.

Proof. The direction ( 1 ) ⇒ ( ) 2 is easy and we leave it as an exercise. We focus on the direction ( 2 ) ⇒ ( 1 . We first need to introduce a couple of auxiliary notions. ) A disjunctive dependency (dd) 𝛿 over a schema S is a constant-free sentence

$$\forall \bar { x } \left ( \phi ( \bar { x } ) \, \rightarrow \, \bigvee _ { i = 1 } ^ { k } \psi _ { i } ( \bar { x } _ { i } ) \right ),$$

where ¯ is a tuple of variables of 𝑥 V , the expression 𝜙 𝑥 ( ¯ ) is a (non-empty) conjunction of atoms over S , and, for each 𝑖 ∈ [ 𝑘 ] , ¯ 𝑥 𝑖 ⊆ ¯ 𝑥 and the expression 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) is either an equality formula 𝑦 = 𝑧 with ¯ 𝑥 𝑖 = { 𝑦, 𝑧 } , or an atom over S . An S -database 𝐷 satisfies the dd 𝛿 , written 𝐷 | = 𝛿 , if, whenever there is a function ℎ : ¯ 𝑥 → dom ( 𝐷 )

with ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ facts ( 𝐷 ) , then there is 𝑖 ∈ [ 𝑘 ] such that, if 𝜓 𝑖 ( ¯ 𝑦 𝑖 ) is 𝑦 = 𝑧 , then ℎ 𝑦 ( ) = ℎ 𝑧 ( ) , and if 𝜓 𝑖 ( ¯ 𝑦 𝑖 ) is 𝑅 𝑥 ( ¯ 𝑖 ) , then ℎ 𝑅 𝑥 ( ( ¯ 𝑖 )) ∈ facts ( 𝐷 ) . We say that the database 𝐷 satisfies a set Σ of dds or that 𝐷 is a model of Σ , written 𝐷 | = Σ , if 𝐷 | = 𝛿 for each 𝛿 ∈ Σ .

We further need the notion of the diagram of a database. Let 𝐷 be an S -database such that facts ( 𝐷 ) ≠ ∅ . Let 𝐴 be the set of atomic formulas that can be formed using predicates from S and constants from dom ( 𝐷 ) . The diagram of 𝐷 , denoted Δ 𝐷 , is

$$\bigwedge _ { \alpha \in \text{facts} ( D ) } \alpha \wedge \bigwedge _ { \alpha \in A \vee \text{facts} ( D ) } \neg \alpha \wedge \bigwedge _ { c, d \in \text{dom} ( D ) \text{ and } c \neq d } \neg ( c = d ).$$

Note that, since facts ( 𝐷 ) ≠ ∅ , the conjunction GLYPH&lt;211&gt; 𝛼 ∈ facts ( 𝐷 ) 𝛼 is non-empty.

Let 𝐶 be collection of databases over S possessing the properties in the second statement of Theorem 2. In particular, since 𝐶 is modular, there is some integer 𝑛 ≥ 0 such that 𝐶 is 𝑛 -modular. Moreover, since 𝐶 is closed under subdatabases, we have that 𝐶 contains the empty database, hence 𝑛 must be a positive integer.

Let Σ ∨ be the set of all dds over S with at most 𝑛 variables that are satisfied by every database 𝐷 ∈ 𝐶 . It is clear that Σ ∨ is finite (up to logical equivalence). We proceed to show the following technical lemma.

## Lemma 1 For each S -database 𝐷 , we have that 𝐷 ∈ 𝐶 if and only 𝐷 | = Σ ∨ .

̸

̸

̸

Proof of Lemma 1. Fix an S -database 𝐷 . From the definition of Σ ∨ , 𝐷 ∈ 𝐶 implies 𝐷 | = Σ ∨ . For the other direction, we will show that if 𝐷 ∉ 𝐶 , then 𝐷 | = Σ ∨ . Assume that 𝐷 ∉ 𝐶 . Since 𝐶 is 𝑛 -modular, there exists an S -database 𝐷 𝑛 such that 𝐷 𝑛 ⪯ 𝐷 , | dom ( 𝐷 𝑛 )| ≤ 𝑛 , and 𝐷 𝑛 ∉ 𝐶 . Since 𝐶 is domain independent, we can assume that dom ( 𝐷 𝑛 ) = adom ( 𝐷 𝑛 ) . We will show that 𝐷 𝑛 | = Σ ∨ , which in turn implies that 𝐷 | = Σ ∨ since every sentence in Σ ∨ is universal and it is well-known that universal first-order sentences are preserved under subdatabases.

̸

To show that 𝐷 𝑛 | = Σ ∨ , it suffices to find a dd 𝛿 ∈ Σ ∨ such that 𝐷 𝑛 | = 𝛿 . We will use the diagram of 𝐷 𝑛 to construct this desired 𝛿 . Let Δ 𝐷 𝑛 be the diagram of 𝐷 𝑛 , and let Φ 𝐷 𝑛 ( ¯ 𝑥 ) be the quantifier-free first-order formula obtained from Δ 𝐷 𝑛 by replacing each 𝑐 ∈ dom ( 𝐷 𝑛 ) with a new variable 𝑥 𝑐 ∈ V . We claim that the following statements are true:

̸

- 1. 𝐷 𝑛 | = ∃ ¯ 𝑥 Φ 𝐷 𝑛 ( ¯ 𝑥 ) .
- 2. For every 𝐷 ′ ∈ 𝐶 , we have that 𝐷 ′ | = ¬∃ ¯ 𝑥 Φ 𝐷 𝑛 ( ¯ 𝑥 ) .
- 3. The sentence ¬∃ ¯ 𝑥 Φ 𝐷 𝑛 ( ¯ 𝑥 ) is logically equivalent to a dd 𝛿 .

The first statement is obviously true by the construction of the sentence ∃ ¯ 𝑥 Φ 𝐷 𝑛 ( ¯ 𝑥 ) (each existential quantifier ∃ 𝑥 𝑐 in ∃ ¯ 𝑥 can be witnessed by the element 𝑐 in dom ( 𝐷 𝑛 ) ). For the second statement, if there is some database 𝐷 ′ ∈ 𝐶 such that 𝐷 ′ | = ∃ ¯ 𝑥 Φ 𝐷 𝑛 ( ¯ 𝑥 ) , then 𝐷 ′ must contain a subdatabase 𝐷 ′′ that is isomorphic to 𝐷 𝑛 . Since 𝐶 is closed under subdatabases and isomorphisms, it follows that 𝐷 𝑛 ∈ 𝐶 , which is a contradiction. For the third statement, observe first that facts ( 𝐷 𝑛 ) ≠ ∅ because 𝐷 𝑛 is not in 𝐶 , while 𝐶 , being closed under subdatabases, contains the empty database. This implies that Δ 𝐷 𝑛 contains at least one positive relational atom

𝛼 ; hence, the conjunction GLYPH&lt;211&gt; 𝛼 ∈ facts ( 𝐷 𝑛 ) 𝛼 is non-empty. Furthermore, since 𝐷 𝑛 is not in 𝐶 and since 𝐶 is 1-critical and closed under isomorphisms, we conclude that 𝐷 𝑛 is not an 1-critical database. This implies that either | dom ( 𝐷 𝑛 )| ≥ 2 or | dom ( 𝐷 𝑛 )| = 1 and there is a relation symbol 𝑅 ∈ S such that 𝑅 𝐷 𝑛 is empty. Therefore, Δ 𝐷 𝑛 contains either the negation of an equality atom 𝛽 or the negation of a relational atom 𝛾 . Consequently, ¬∃ ¯ 𝑥 Φ 𝐷 𝑛 ( ¯ 𝑥 ) is logically equivalent to a dd 𝛿 . Therefore, all three statements have been established.

̸

Taken together, these three statements imply that 𝛿 is a dd in Σ ∨ that is false on 𝐷 𝑛 , and hence, 𝐷 𝑛 | = Σ ∨ . This completes the proof of Lemma 1. ⊓ ⊔

Observe that the property of closure under intersections was not used in the proof of Lemma 1. This property will be used in the proof of the next technical lemma.

Lemma 2 Assume that ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝛼 𝑖 ( ¯ 𝑥 𝑖 )) is a disjunctive dependency that belongs to Σ ∨ . There is 𝑗 ∈ [ 𝑘 ] such that ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑗 )) also belongs to Σ ∨ .

̸

̸

Proof of Lemma 2. Note that for every 𝑗 ∈ [ 𝑘 ] , the sentence ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑗 )) is either a full tgd or an egd, hence it is a disjunctive dependency. Towards a contradiction, assume that none of these sentences belongs to Σ ∨ . Since Σ ∨ consists of all disjunctive dependencies that are satisfied by every database in 𝐶 , it follows that for every 𝑗 ∈ [ 𝑘 ] , there is a database 𝐷 𝑗 ∈ 𝐶 such that 𝐷 𝑗 | = ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑗 )) . Hence, for every 𝑗 ∈ [ 𝑘 ] , there is a tuple ¯ 𝑏 𝑗 of elements in dom ( 𝐷 𝑗 ) such that 𝐷 𝑗 | = 𝜙 𝑏 ( ¯ 𝑗 ) ∧ ¬ 𝛼 𝑗 ( ¯ 𝑏 𝑗 𝑗 ) . Since 𝐶 is closed under isomorphisms, we may assume that these tuples are the same tuple ¯ , 𝑏 i.e., we may assume that for every 𝑗 and ℓ with 𝑗 , ℓ ∈ [ 𝑘 ] , we have that ¯ 𝑏 𝑗 = ¯ 𝑏 ℓ = ¯ . 𝑏 Let 𝐷 ∩ be the intersection of the databases 𝐷 𝑗 , that is, 𝐷 ∩ = GLYPH&lt;209&gt; 𝑗 ∈[ 𝑘 ] 𝐷 𝑗 . Since 𝐶 is closed under intersections, we have that 𝐷 ∩ belongs to 𝐶 ; consequently, we have that 𝐷 ∩ | = ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝛼 𝑖 ( ¯ 𝑥 𝑖 )) . Since the elements of the tuple ¯ 𝑏 belong to dom ( 𝐷 𝑗 ) for every 𝑗 ∈ [ 𝑘 ] , it follows that they also belong to dom ( 𝐷 ∩) . Therefore, and since also 𝜙 𝑏 ( ¯ ) holds, there is some 𝑗 ∈ [ 𝑘 ] such that 𝛼 𝑗 ( ¯ 𝑏 𝑗 ) holds, which contradicts the fact that ¬ 𝛼 𝑗 ( ¯ 𝑏 𝑗 ) holds (since ¯ 𝑏 witnesses that 𝐷 𝑗 | = ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑗 )) . This completes the proof that there is a 𝑗 ∈ [ 𝑘 ] such that the formula ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑖 )) belongs to Σ ∨ . ⊓ ⊔

With the two preceding lemmas at hand, we are now ready to complete the proof of Theorem 2. Let Σ be the set of full tgds and egds in Σ ∨ , i.e.,

$$\Sigma = \left \{ \delta \in \Sigma ^ { \vee } \ | \ \delta \text{is a full } tgd \text{or an egd} \right \}.$$

Note that Σ is a finite set because it is a subset of the finite set Σ ∨ . We proceed to show that, for each S -database 𝐷 , it holds that 𝐷 ∈ 𝐶 if and only if 𝐷 | = Σ .

( ⇒ ) If 𝐷 ∈ 𝐶 , then, by the definition of Σ ∨ , 𝐷 | = Σ ∨ ; hence, 𝐷 | = Σ since Σ ⊆ Σ ∨ .

( ⇐ ) Assume now that 𝐷 is an S -database such that 𝐷 | = Σ . We need to show that 𝐷 ∈ 𝐶 . By Lemma 1, it suffices to show that 𝐷 | = Σ ∨ . Let ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝛼 𝑖 ( ¯ 𝑥 𝑖 )) be a disjunctive dependency in Σ ∨ . By Lemma 2, there is 𝑗 ∈ [ 𝑘 ] such that ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑗 )) belongs to Σ ∨ . Since this sentence is either a full tgd or an

egd, we have that it belongs to Σ ; hence, 𝐷 | = ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑗 )) . It is obvious that ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝛼 𝑗 ( ¯ 𝑥 𝑗 )) logically implies the disjunctive dependency ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝛼 𝑖 ( ¯ 𝑥 𝑖 )) , and therefore, 𝐷 | = ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝛼 𝑖 ( ¯ 𝑥 𝑖 )) . This completes the proof of the above claim.

Thus, we have established that 𝐶 is axiomatizable by the set Σ , which is a finite set of full tgds and egds. This completes the proof of Theorem 2. ⊓ ⊔

## 4 Finite Axiomatizability by TGDs and EGDs

The fact that Theorems 1 and 2 deal only with full tgds, i.e., tgds without existentially quantified variables, leads to the following natural question: is there an analogous characterization for arbitrary tgds and egds? Such a characterization has been recently established in [12] for the case of arbitrary (finite or infinite) relational structures. In what follows, we present the characterization from [12] for databases, i.e., finite relational structures. Apart from the standard properties of 1-criticality and closure under direct products, already used in Section 3, we are going to use a novel locality property. The latter locality property was introduced in [12] for arbitrary structures, but we are going to adapt it for databases. We proceed to introduce this notion of locality and show that every collection 𝐶 of databases that is finitely axiomatizable by tgds and egds enjoys this property. We then present the characterization of arbitrary tgds and egds and discuss how it allows us to derive the characterization for full tgds and egds from [22], namely Theorem 1.

## 4.1 Locality

Thelocality property of interest relies on the notion of local embedding of a collection of databases in a database. Roughly speaking, a collection 𝐶 of databases over a schema S is locally embeddable in an S -database 𝐷 if, for every subdatabase 𝐸 of 𝐷 with a bounded number of active domain elements (i.e., domain elements that occur in facts ( 𝐸 ) ), we can find a database 𝐷 𝐸 ∈ 𝐶 such that every local neighbour of 𝐸 in 𝐷 𝐸 (i.e., subdatabases of 𝐷 𝐸 that contain 𝐸 and have a bounded number of additional active domain elements that do not occur in facts ( 𝐸 ) ), can be embedded in 𝐷 while preserving 𝐸 . We call the collection 𝐶 of databases local if, for every S -database 𝐷 𝐶 , is locally embeddable in 𝐷 implies that 𝐷 belongs to 𝐶 . We proceed to formalize the above high-level description.

Recall that the active domain of a database 𝐷 , denoted adom ( 𝐷 ) , is the set of elements of dom ( 𝐷 ) that occur in at least one fact of 𝐷 . Consider an S -database 𝐷 ′ and an S -database 𝐷 ′′ ⊆ 𝐷 ′ , i.e., facts ( 𝐷 ′′ ) ⊆ facts ( 𝐷 ′ ) . The 𝑚 -neighbourhood of 𝐷 ′′ in 𝐷 ′ is defined as the set of S -databases

- { 𝐸 | adom ( 𝐷 ′′ ) ⊆ adom ( 𝐸 , ) 𝐸 ⪯ 𝐷 ′ and | adom ( 𝐸 )| ≤ | adom ( 𝐷 ′′ )| + 𝑚 , }

Fig. 1 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 .

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01109v1-figure-ef86ccf4-5b33-4c7f-9243-36da6be77ca4.jpg)

that is, all the subdatabases of 𝐷 ′ such that their facts contain constants from adom ( 𝐷 ′′ ) and at most 𝑚 additional elements not occurring in adom ( 𝐷 ′′ ) . It is easy to verify that the 𝑚 -neighbourhood of 𝐷 ′′ in 𝐷 ′ is actually the set of S -databases

$$\{ E \ | \ D ^ { \prime \prime } \subseteq E, \ E \leq D ^ { \prime } \text{ and } | \text{adom} ( E ) | \leq | \text{adom} ( D ^ { \prime \prime } ) | + m \},$$

i.e., the set all subdatabases of 𝐷 ′ that contain 𝐷 ′′ and their facts mention at most 𝑚 additional elements not occurring in the facts of 𝐷 ′′ . Indeed, if 𝐷 ′′ ⊆ 𝐷 ′ and 𝐸 ⪯ 𝐷 ′ , then we have that adom ( 𝐷 ′′ ) ⊆ adom ( 𝐸 ) if and only if 𝐷 ′′ ⊆ 𝐸 .

Consider a collection 𝐶 of databases over S and an S -database 𝐷 . For integers 𝑛, 𝑚 ≥ 0, we say that 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 if, for every 𝐸 ⪯ 𝐷 with | adom ( 𝐸 )| ≤ 𝑛 , there is 𝐷 𝐸 ∈ 𝐶 such that 𝐸 ⊆ 𝐷 𝐸 , and for every 𝐷 ′ in the 𝑚 -neighbourhood of 𝐸 in 𝐷 𝐸 , there is a function ℎ : adom ( 𝐷 ′ ) → adom ( 𝐷 ) such that ℎ is the identity on adom ( 𝐸 ) and ℎ ( facts ( 𝐷 ′ )) ⊆ facts ( 𝐷 ) . The notion of ( 𝑛, 𝑚 ) -local embeddability is illustrated in Figure 1; the circles represent the set of facts of the databases. Clearly, for every S -database 𝐸 , we have that adom ( 𝐸 ) ⊆ dom ( 𝐸 ) , and this containment may be a proper one. Observe, however, that the notion of a collection 𝐶 of databases being ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 only depends on adom ( 𝐸 ) of 𝐸 and the set of facts of 𝐸 , and not on dom ( 𝐸 ) of 𝐸 . In turn, this implies that, when showing that 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 , it suffices to focus our attention on subdatabases 𝐸 of 𝐷 such that adom ( 𝐸 ) = dom ( 𝐸 ) . We state this observation as a separate lemma, which will be used later in the paper.

Lemma 3 Consider a collection 𝐶 of databases, integers 𝑛, 𝑚 ≥ 0 , and a database 𝐷 . The following statement are equivalent:

- 1. 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 .
- 2. For every 𝐸 ⪯ 𝐷 with adom ( 𝐸 ) = dom ( 𝐸 ) and | adom ( 𝐸 )| ≤ 𝑛 , there is 𝐷 𝐸 ∈ 𝐶 such that 𝐸 ⊆ 𝐷 𝐸 , and for every 𝐷 ′ in the 𝑚 -neighbourhood of 𝐸 in 𝐷 𝐸 , there is a function ℎ : adom ( 𝐷 ′ ) → adom ( 𝐷 ) such that ℎ is the identity on adom ( 𝐸 ) and ℎ ( facts ( 𝐷 ′ )) ⊆ facts ( 𝐷 ) .

We are now ready to give the definition of the central notion of locality.

Definition 1 (Locality) Acollection 𝐶 of databases over S is ( 𝑛, 𝑚 ) -local , for 𝑛, 𝑚 ≥ 0, if, for every S -database 𝐷 , the following holds: 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 implies 𝐷 ∈ 𝐶 . We say that 𝐶 is local if it is ( 𝑛, 𝑚 ) -local for some 𝑛, 𝑚 ≥ 0.

Fig. 2 The function 𝜆 = 𝜇 𝐿 ◦ 𝑔 in the proof of Lemma 4.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01109v1-figure-722f1224-2f69-4506-be36-fe6e94f41482.jpg)

We can now show the following technical lemma that essentially states that every collection of databases that is finitely axiomatizable by tgds with at most 𝑛 universally and 𝑚 existentially quantified variables, and egds with at most 𝑛 universally quantified variables, is ( 𝑛, 𝑚 ) -local. A tgd is called ( 𝑛, 𝑚 ) -tgd , for 𝑛 ≥ 0 and 𝑚 &gt; 0, or 𝑛 &gt; 0 and 𝑚 ≥ 0, if it mentions at most 𝑛 universally and 𝑚 existentially quantified variables. Moreover, an egd is called 𝑛 -egd , for 𝑛 &gt; 0, if it mentions at most 𝑛 universally quantified variables. For notational convenience, we also define the corner cases of ( 0 0 -tgd and 0-egd as the truth value , ) true , i.e., as a tautology.

Lemma 4 For integers 𝑛, 𝑚 ≥ 0 , every collection 𝐶 of databases that is finitely axiomatizable by ( 𝑛, 𝑚 ) -tgds and 𝑛 -egds is ( 𝑛, 𝑚 ) -local.

Proof. Let 𝐶 be a collection of databases over a schema S that is finitely axiomatizable by ( 𝑛, 𝑚 ) -tgds and 𝑛 -egds. By definition, there is a finite set Σ 𝑇 of ( 𝑛, 𝑚 ) -tgds and a finite set Σ 𝐸 of 𝑛 -egds such that, for every S -database 𝐷 , we have that 𝐷 ∈ 𝐶 iff 𝐷 | = Σ 𝑇 and 𝐷 | = Σ 𝐸 . Consider an S -database 𝐷 and assume that 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 . We proceed to show that 𝐷 ∈ 𝐶 , i.e., 𝐷 | = Σ 𝑇 and 𝐷 | = Σ 𝐸 .

We first show that 𝐷 | = Σ 𝑇 . Consider a tgd 𝜎 ∈ Σ 𝑇 , other than the ( 0 0 -tgd that , ) is trivially satisfied by 𝐷 , of the form 𝜙 𝑥, 𝑦 ( ¯ ¯ ) →∃ ¯ 𝑧 𝜓 ( ¯ 𝑥, 𝑧 ¯ ) , and assume that there exists a function ℎ : ¯ 𝑥 ∪ ¯ 𝑦 → dom ( 𝐷 ) such that ℎ 𝜙 𝑥, 𝑦 ( ( ¯ ¯ )) ⊆ facts ( 𝐷 ) . We show that there exists an extension 𝜆 of ℎ such that 𝜆 𝜓 𝑥, 𝑧 ( ( ¯ ¯ )) ⊆ facts ( 𝐷 ) ; the existence of 𝜆 is illustrated in Figure 2. Let 𝐸 be the database ( dom ( 𝐸 , 𝑅 ) 𝐸 1 , . . . , 𝑅 𝐸 ℓ ) , where dom ( 𝐸 ) is the set of constants occurring in ℎ 𝜙 𝑥, 𝑦 ( ( ¯ ¯ )) , and, for each 𝑖 ∈ [ ℓ ] , 𝑅 𝐸 𝑖 = 𝑅 𝐷 𝑖 | 𝐸 . It is clear that 𝐸 ⪯ 𝐷 with | adom ( 𝐸 )| ≤ 𝑛 since 𝜙 𝑥, 𝑦 ( ¯ ¯ ) mentions at most 𝑛 variables. Since, by hypothesis, 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 , we get that there exists 𝐷 𝐸 ∈ 𝐶 such that 𝐸 ⊆ 𝐷 𝐸 , and, for every 𝐷 ′ in the 𝑚 -neighbourhood of 𝐸 in 𝐷 𝐸 , there is a function 𝜇 𝐷 ′ : adom ( 𝐷 ′ ) → adom ( 𝐷 ) , which is the identity on adom ( 𝐸 ) , such that 𝜇 𝐷 ′ ( facts ( 𝐷 ′ )) ⊆ facts ( 𝐷 ) . It is clear that ℎ 𝜙 𝑥, 𝑦 ( ( ¯ ¯ )) ⊆ facts ( 𝐷 𝐸 ) . Since 𝐷 𝐸 ∈ 𝐶 , or, equivalently, 𝐷 𝐸 | = Σ , there exists an extension 𝑔 of ℎ such that 𝑔 𝜓 𝑥, 𝑧 ( ( ¯ ¯ )) ⊆ facts ( 𝐷 𝐸 ) . Let 𝐹 = ( dom ( 𝐹 , 𝑅 ) 𝐹 1 , . . . , 𝑅 𝐹 ℓ ) , where dom ( 𝐹 ) are the constants occurring in ℎ 𝜙 𝑥, 𝑦 ( ( ¯ ¯ )) ∪ 𝑔 𝜓 𝑥, 𝑧 ( ( ¯ ¯ )) , and, for each 𝑖 ∈ [ ℓ ] , 𝑅 𝐹 𝑖 = 𝑅 𝐷 𝐸 𝑖 | dom ( 𝐹 ) . It is clear that 𝐹 is in the 𝑚 -neighbourhood of 𝐸 in 𝐷 𝐸 since ¯ 𝑧 has at most 𝑚 variables. Therefore, there is a function 𝜇 𝐹 : adom ( 𝐹 ) → adom ( 𝐷 ) ,

which is the identity on adom ( 𝐸 ) , such that 𝜇 𝐹 ( facts ( 𝐹 )) ⊆ facts ( 𝐷 ) . Consider the function 𝜆 = 𝜇 𝐹 ◦ 𝑔 . Since 𝑔 is an extension of ℎ , and 𝜇 𝐹 is the identity on the elements occurring in ℎ 𝜙 𝑥, 𝑦 ( ( ¯ ¯ )) , we get that 𝜆 𝑣 ( ) = ℎ 𝑣 ( ) for each variable 𝑣 in 𝜙 𝑥, 𝑦 ( ¯ ¯ ) , and thus, 𝜆 is an extension of ℎ . Moreover, since 𝑔 𝜓 𝑥, 𝑧 ( ( ¯ ¯ )) ⊆ facts ( 𝐹 ) , we get that 𝜆 𝜓 𝑥, 𝑧 ( ( ¯ ¯ )) ⊆ facts ( 𝐷 ) .

We now show that 𝐷 | = Σ 𝐸 . Consider an egd 𝜃 ∈ Σ 𝐸 , other than the 0-egd that is trivially satisfied by 𝐷 , of the form 𝜙 𝑥 ( ¯ ) → 𝑥 𝑖 = 𝑥 𝑗 , and assume there exists a function ℎ : ¯ 𝑥 → dom ( 𝐷 ) such that ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ facts ( 𝐷 ) . We show that ℎ 𝑥 ( 𝑖 ) = ℎ 𝑥 ( 𝑗 ) . Let 𝐸 = ( dom ( 𝐸 , 𝑅 ) 𝐸 1 , . . . , 𝑅 𝐸 ℓ ) , where dom ( 𝐸 ) is the set of constants occurring in ℎ 𝜙 𝑥 ( ( ¯ )) , and, for each 𝑖 ∈ [ ℓ ] , 𝑅 𝐸 𝑖 = 𝑅 𝐷 𝑖 | 𝐸 . It is clear that 𝐸 ⪯ 𝐷 with | adom ( 𝐸 )| ≤ 𝑛 since 𝜙 𝑥 ( ¯ ) mentions at most 𝑛 variables. Since, by hypothesis, 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 , there exists 𝐷 𝐸 ∈ 𝐶 such that 𝐸 ⊆ 𝐷 𝐸 . Observe that 𝐸 ⊆ 𝐷 𝐸 implies that ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ 𝐸 𝐸 . Since 𝐷 𝐸 | = Σ 𝐸 , we get that ℎ 𝑥 ( 𝑖 ) = ℎ 𝑥 ( 𝑗 ) . ⊓ ⊔

It is useful to observe that locality implies domain independence.

Lemma 5 If a collection of databases is local, then it is also domain independent.

Proof. Assume that 𝐶 is a collection of databases over S that is ( 𝑛, 𝑚 ) -local for 𝑛, 𝑚 ≥ 0, and let 𝐷 be an S -database in 𝐶 . Consider an S -database 𝐷 ′ such that facts ( 𝐷 ) = facts ( 𝐷 ′ ) . We need to show that 𝐷 ′ ∈ 𝐶 . This is done by showing that 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 ′ , which implies that 𝐷 ′ ∈ 𝐶 since, by hypothesis, 𝐶 is ( 𝑛, 𝑚 ) -local. Consider an S -database 𝐷 ′′ ⪯ 𝐷 ′ with | adom ( 𝐷 ′′ )| ≤ 𝑛 . Since facts ( 𝐷 ) = facts ( 𝐷 ′ ) , it is clear that 𝐷 ′′ ⊆ 𝐷 . Since 𝐷 ∈ 𝐶 , it suffices to show that, for every 𝐸 in the 𝑚 -neighbourhood of 𝐷 ′′ in 𝐷 , there is a function ℎ 𝐸 : adom ( 𝐸 ) → adom ( 𝐷 ′ ) , which is the identity on adom ( 𝐷 ′′ ) , such that ℎ 𝐸 ( facts ( 𝐸 )) ⊆ facts ( 𝐷 ′ ) . Since 𝐸 ⊆ 𝐷 , which means that facts ( 𝐸 ) ⊆ facts ( 𝐷 ) , we get that facts ( 𝐸 ) ⊆ facts ( 𝐷 ′ ) . Therefore, ℎ 𝐸 is simply the identity on adom ( 𝐸 ) . ⊓ ⊔

## 4.2 The Characterization for TGDs and EGDs

Weare now ready to provide the characterization of interest, which was originally established for arbitrary relational structures in [12], and here is presented for databases (i.e., finite structures).

Theorem 3 Consider a collection 𝐶 of databases, and integers 𝑛, 𝑚 ≥ 0 . The following statements are equivalent:

- 1. 𝐶 is finitely axiomatizable by ( 𝑛, 𝑚 ) -tgds and 𝑛 -egds.
- 2. 𝐶 is 1 -critical, ( 𝑛, 𝑚 ) -local, and closed under direct products.

Clearly, the above result implies a characterization for arbitrary tgds and egds:

Corollary 1 Consider a collection 𝐶 of databases. The following are equivalent:

- 1. 𝐶 is finitely axiomatizable by tgds and egds.
- 2. 𝐶 is 1 -critical, local, and closed under direct products.

The direction ( 1 ) ⇒ ( ) 2 of Theorem 3 is easy and we leave it as an exercise to the reader. We proceed to discuss the non-trivial direction ( 2 ) ⇒ ( ) 1 . To this end, we need to introduce a couple of auxiliary notions, namely existential disjunctive dependencies and relative diagrams of databases.

Existential Disjunctive Dependencies. Existential disjunctive dependencies generalize disjunctive dependencies, already used in the proof of Theorem 2, with existential quantification in the right-hand side of the implication. Moreover, the hypothesis and the conclusion of the implication can be empty. More precisely, an existential disjunctive dependency (edd) 𝛿 over a schema S is a constant-free sentence

$$\forall \bar { x } \left ( \phi ( \bar { x } ) \, \rightarrow \, \bigvee _ { i = 1 } ^ { k } \psi _ { i } ( \bar { x } _ { i } ) \right ),$$

where ¯ 𝑥 is a tuple of variables of V , the expression 𝜙 𝑥 ( ¯ ) is a (possibly empty) conjunction of atoms over S , and, for each 𝑖 ∈ [ 𝑘 ] , ¯ 𝑥 𝑖 ⊆ ¯ 𝑥 and the expression 𝜓 𝑥 ( ¯ 𝑖 ) is either an equality formula 𝑦 = 𝑧 with ¯ 𝑥 𝑖 = { 𝑦, 𝑧 } , or a constant-free formula ∃ ¯ 𝑦 𝑖 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 ) with ¯ 𝑦 𝑖 being a tuple of variables from V \ ¯ and 𝑥 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 ) is a (possibly empty) conjunction of atoms over S . When the conclusion of 𝛿 is empty (i.e., there are no disjuncts), 𝛿 is essentially the sentence ∀ ¯ 𝑥 ( 𝜙 𝑥 ( ¯ ) → false ) . Now, when both the hypothesis and the conclusion of 𝛿 are empty, then 𝛿 is essentially the truth value false , i.e., a contradiction. Assuming that the conclusion of 𝛿 is non-empty, a database 𝐷 satisfies 𝛿 if, whenever there exists a function ℎ : ¯ 𝑥 → dom ( 𝐷 ) such that ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ facts ( 𝐷 ) , then there is 𝑖 ∈ [ 𝑘 ] such that, if 𝜓 𝑖 ( ¯ 𝑦 𝑖 ) is 𝑦 = 𝑧 , then ℎ 𝑦 ( ) = ℎ 𝑧 ( ) ; otherwise, if 𝜓 𝑖 ( ¯ 𝑦 𝑖 ) is of the form ∃ ¯ 𝑦 𝑖 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 ) , then there is an extension ℎ ′ of ℎ such that ℎ ′ ( 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 )) ⊆ facts ( 𝐷 ) . In case the conclusion of 𝛿 is empty and 𝛿 is not a contradiction, 𝐷 satisfies 𝛿 if there is no function ℎ : ¯ 𝑥 → dom ( 𝐷 ) such that ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ facts ( 𝐷 ) . We write 𝐷 | = 𝛿 for the fact that 𝐷 satisfies 𝛿 . The database 𝐷 satisfies a set Σ of edds, written 𝐷 | = Σ ( 𝐷 is a model of Σ ), if 𝐷 | = 𝛿 for each 𝛿 ∈ Σ .

Relative Diagram of a Database. Consider an integer ℓ ≥ 0, an S -database 𝐸 , and an S -database 𝐷 such that 𝐸 ⪯ 𝐷 . We are going to define the notion of the ℓ -diagram of 𝐸 relative to 𝐷 , which can be regarded as a refinement of the standard notion of diagram of a database, already used in the proof of Theorem 2. Let 𝐴 𝐸,ℓ be the set of all atomic formulas of the form 𝑅 𝑢 ( ¯ ) that can be formed using predicates from S , constants from dom ( 𝐸 ) , and ℓ distinct variables 𝑦 1 , . . . , 𝑦 ℓ from V , i.e., 𝑅 ∈ S and ¯ 𝑢 ∈ ( dom ( 𝐸 ) ∪ { 𝑦 1 , . . . , 𝑦 ℓ }) ar ( 𝑅 ) . Let 𝐶 𝐸,ℓ be the set of all conjunctions of atomic formulas from 𝐴 𝐸,ℓ . Note that both 𝐴 𝐸,ℓ and 𝐶 𝐸,ℓ are finite sets because dom ( 𝐸 ) is finite. Given a formula 𝛾 𝑦 , . . . , 𝑦 ( 1 ℓ ) ∈ 𝐶 𝐸,ℓ , we can naturally talk about the satisfaction of the sentence ∃ 𝑦 1 · · · ∃ 𝑦 ℓ 𝛾 𝑦 , . . . , 𝑦 ( 1 ℓ ) by a database 𝐷 ′ , in which case we simply write 𝐷 ′ | = ∃ 𝑦 1 · · · ∃ 𝑦 ℓ 𝛾 𝑦 , . . . , 𝑦 ( 1 ℓ ) . The ℓ -diagram of 𝐸 relative to 𝐷 , denoted Δ 𝐷 𝐸,ℓ , is the first-order sentence

̸

$$\bigwedge _ { \alpha \in \text{facts} ( E ) } \alpha \wedge \bigwedge _ { \substack { c, d \in \text{dom} ( E ), \\ c \neq d } } \neg ( c = d ) \wedge \bigwedge _ { \substack { \gamma ( y _ { 1 }, \dots, y _ { \ell } ) \in C _ { E, \ell }, \\ D \neq \exists y _ { 1 } \cdots \exists y _ { \ell } \gamma ( y _ { 1 }, \dots, y _ { \ell } ) } } \neg ( \exists y _ { 1 } \cdots \exists y _ { \ell } \gamma ( y _ { 1 }, \dots, y _ { \ell } ) ) \,.$$

In fact, we are interested in the first-order formula Φ 𝐷 𝐸,ℓ ( ¯ 𝑥 ) obtained from the firstorder sentence Δ 𝐷 𝐸,ℓ by replacing each constant element 𝑐 ∈ dom ( 𝐸 ) with a new variable 𝑥 𝑐 ∈ V \ { 𝑦 1 , . . . , 𝑦 ℓ } . As was the case with the formulas of 𝐶 𝐸,ℓ , we can naturally talk about the satisfaction of ∃ ¯ 𝑥 Φ 𝐷 𝐸,ℓ ( ¯ 𝑥 ) by a database 𝐷 ′ , in which case we simply write 𝐷 ′ | = ∃ ¯ 𝑥 Φ 𝐷 𝐸,ℓ ( ¯ 𝑥 ) . It is straightforward to verify that:

Lemma 6 For every integer ℓ ≥ 0 , S -database 𝐸 , and S -database 𝐷 with 𝐸 ⪯ 𝐷 , it holds that 𝐷 | = ∃ ¯ 𝑥 Φ 𝐷 𝐸,ℓ ( ¯ 𝑥 ) .

Let E 𝑛,𝑚 , for some integers 𝑛, 𝑚 ≥ 0, be the set of all edds over S of the form ∀ ¯ 𝑥 GLYPH&lt;16&gt; 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) GLYPH&lt;17&gt; such that ¯ 𝑥 consists of at most 𝑛 distinct variables, and, for each 𝑖 ∈ [ 𝑘 ] , the formula 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) mentions at most 𝑛 + 𝑚 distinct variables. The latter means that, if 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) is a formula of the form ∃ ¯ 𝑦 𝑖 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 ) (i.e., it is not an equality expression), then ¯ 𝑦 𝑖 consists of at most 𝑚 distinct variables. Note that E 𝑛,𝑚 is a finite set (up to logical equivalence) since S is finite and the number of variables in each element of E 𝑛,𝑚 is finite. We can show the following auxiliary lemma.

Lemma 7 Let 𝑛, 𝑚 ≥ 0 and assume that 𝐷, 𝐸 are two S -databases such that adom ( 𝐸 ) = dom ( 𝐸 ) , | adom ( 𝐸 )| ≤ 𝑛 , and 𝐸 ⪯ 𝐷 . It holds that there exists a sentence 𝛿 ∈ E 𝑛,𝑚 such that 𝛿 ≡ ¬∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) .

Proof. Recall that the formula Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) is obtained from the 𝑚 -diagram of 𝐸 relative to 𝐷 by renaming each 𝑐 ∈ dom ( 𝐸 ) to a new variable 𝑥 𝑐 ; let 𝜌 be the renaming function, i.e., 𝜌 𝑐 ( ) = 𝑥 𝑐 for each 𝑐 ∈ dom ( 𝐸 ) . Thus, Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) is of the form

̸

$$\underbrace { \bigwedge _ { \alpha \in \text{facts} ( E ) } \rho ( \alpha ) } _ { \Psi _ { 1 } } \wedge \underbrace { \bigwedge _ { \substack { c, d \in \text{dom} ( E ), \\ c \neq d } } _ { \substack { \gamma ( \bar { y } ) \in C _ { E, m }, \\ D \not \equiv \exists \bar { y } \gamma ( \bar { y } ) } } _ { \Psi _ { 2 } } \neg \exists \bar { y } \rho ( \gamma ( \bar { y } ) ) } \,.$$

Note that Ψ 1 and Ψ 2 might be empty (i.e., they have no conjuncts). In particular, Ψ 1 is empty if 𝐸 is empty, whereas Ψ 2 is empty if 𝐷 is 1-critical, and thus, 𝐷 | = ∃ ¯ 𝑦 𝛾 ( ¯ 𝑦 ) for each 𝛾 𝑦 ( ¯ ) ∈ 𝐶 𝐸,𝑚 . It is clear that ¬∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) is equivalent to the sentence

$$\delta \, = \, \forall \bar { x } \left ( \phi ( \bar { x } ) \, \rightarrow \, \psi ( \bar { x } ) \right ),$$

where

$$\phi ( \bar { x } ) \ = \ \bigwedge _ { \alpha \in \text{facts} ( E ) } \rho ( \alpha )$$

and the shape of 𝜓 𝑥 ( ¯ ) depends on whether Ψ 1 and Ψ 2 are empty or not. If both are empty, then 𝛿 is the truth constant false , i.e., a contradiction, and thus, 𝛿 ∈ E 𝑛,𝑚 . If Ψ 1 is non-empty and Ψ 2 is empty, then, for an S -database 𝐷 ′ , it holds that

𝐷 ′ | = ¬∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) if there is no function ℎ : ¯ 𝑥 → dom ( 𝐷 ′ ) such that ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ facts ( 𝐷 ′ ) . Hence, in this case, 𝛿 is the edd ∀ ¯ 𝑥 ( 𝜙 𝑥 ( ¯ ) → false ) . Since, by hypothesis, | adom ( 𝐸 )| ≤ 𝑛 , we get that 𝜙 𝑥 ( ¯ ) mentions at most 𝑛 variables, and thus, 𝛿 ∈ E 𝑛,𝑚 . Now, if Ψ 1 is either empty or non-empty, and Ψ 2 is non-empty, then we have that

̸

$$\psi ( \bar { x } ) \, = \, \underset { c \neq d } { \bigvee } \, \rho ( c ) = \rho ( d ) \vee \underset { \substack { \gamma ( \bar { y } ) \in C _ { E, m }, \\ D \not \equiv \exists \bar { y } \, \gamma ( \bar { y } ) } } \exists \bar { y } \, \rho ( \gamma ( \bar { y } ) ),$$

and hence, 𝛿 is an edd. It remains to show that 𝛿 ∈ E 𝑛,𝑚 . To this end, we need to show the following two statements: (i) each variable in 𝜓 𝑥 ( ¯ ) is either existentially quantified or appears in 𝜙 𝑥 ( ¯ ) , and (ii) 𝛿 mentions at most 𝑛 universally quantified variables and at most 𝑚 existentially quantified variables. Statement (i) is true since, by hypothesis, adom ( 𝐸 ) = dom ( 𝐸 ) . Concerning statement (ii), 𝛿 has at most 𝑛 universally quantified variables since, by hypothesis, | adom ( 𝐸 )| ≤ 𝑛 , and 𝛿 has 𝑚 existentially quantified variables because so does the formula ¬ Φ 𝐷 𝐸,𝑚 by the construction of Φ 𝐷 𝐸,𝑚 . ⊓ ⊔

We can now discuss the non-trivial direction ( 2 ) ⇒ ( ) 1 of Theorem 3. Assume that 𝐶 is a collection of databases over S . The proof proceeds in two main steps:

- 1. We construct a finite set Σ ∨ of edds over S , which mention at most 𝑛 universally andat most 𝑚 existentially quantified variables, and show that Σ ∨ has the following property: a database 𝐷 is in 𝐶 if and only if 𝐷 satisfies Σ ∨ . To this end, we exploit the fact that 𝐶 is ( 𝑛, 𝑚 ) -local.
- 2. We then show that there is a finite set Σ ∃ , = of ( 𝑛, 𝑚 ) -tgds and 𝑛 -egds over S such that a database 𝐷 is in 𝐶 if and only if 𝐷 satisfies Σ ∃ , = ; in fact, Σ ∃ , = is the set of the tgds and egds occurring in Σ ∨ . To this end, we exploit the fact that 𝐶 is 1-critical and closed under direct products.

In what follows, we give the details for each of the above steps.

## Step 1: The finite set Σ ∨ of edds that axiomatizes 𝐶

Recall that E 𝑛,𝑚 is the set of all edds over S of the form ∀ ¯ 𝑥 GLYPH&lt;16&gt; 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) GLYPH&lt;17&gt; such that ¯ consists of at most 𝑥 𝑛 distinct variables, and, for each 𝑖 ∈ [ 𝑘 ] , the formula 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) mentions at most 𝑛 + 𝑚 distinct variables. The latter means that, if 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) is a formula of the form ∃ ¯ 𝑦 𝑖 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 ) (i.e., it is not an equality expression), then ¯ 𝑦 𝑖 consists of at most 𝑚 distinct variables. Recall also that E 𝑛,𝑚 is finite (up to logical equivalence). Define Σ ∨ to be the set of all edds from E 𝑛,𝑚 that are satisfied by every database of 𝐶 , that is,

$$\Sigma ^ { \vee } \, = \, \left \{ \delta \in \mathbf E _ { n, m } \, | \text{ for each $D\in C$, it holds that $D\models\delta$} \right \}.$$

It is clear that Σ ∨ is finite (up to logical equivalence) since Σ ∨ ⊆ E 𝑛,𝑚 . We will show that 𝐶 is precisely the set of databases that satisfy Σ ∨ .

Lemma 8 For every S -database 𝐷 , we have that 𝐷 ∈ 𝐶 if and only if 𝐷 | = Σ ∨ .

Proof. The (⇒) direction follows from the definition of Σ ∨ . We proceed with the (⇐) direction. We have to show that if 𝐷 | = Σ ∨ , then 𝐷 ∈ 𝐶 . We will show that 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 , which, since 𝐶 is ( 𝑛, 𝑚 ) -local, will imply that 𝐷 ∈ 𝐶 . By Lemma 3, to show that 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 , we have to show that, for every 𝐸 ⪯ 𝐷 with adom ( 𝐸 ) = dom ( 𝐸 ) and | adom ( 𝐸 )| ≤ 𝑛 , there is a database 𝐷 𝐸 ∈ 𝐶 such that 𝐸 ⊆ 𝐷 𝐸 , and for every 𝐷 ′ in the 𝑚 -neighbourhood of 𝐸 in 𝐷 𝐸 , there is a function ℎ : adom ( 𝐷 ′ ) → adom ( 𝐷 ) such that ℎ is the identity on adom ( 𝐸 ) and ℎ ( facts ( 𝐷 ′ )) ⊆ facts ( 𝐷 ) .

̸

̸

Let 𝐸 be a database such that 𝐸 ⪯ 𝐷 , adom ( 𝐸 ) = dom ( 𝐸 ) , and | adom ( 𝐸 )| ≤ 𝑛 . By Lemma 7, the sentence ¬∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) is logically equivalent to a sentence 𝛿 ∈ E 𝑛,𝑚 . We claim that 𝛿 ∉ Σ ∨ . Indeed, otherwise, we would have that 𝐷 | = 𝛿 , which is a contradiction, since, by Lemma 6, 𝐷 | = ∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) . Since 𝛿 ∉ Σ ∨ , there must exist a database 𝐷 𝐸 ∈ 𝐶 such that 𝐷 𝐸 | = 𝛿 , which means that 𝐷 𝐸 | = ∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) . Thus, there exists a database 𝐸 ′ ⊆ 𝐷 𝐸 such that 𝐸 ≃ 𝐸 ′ , i.e., 𝐸 and 𝐸 ′ are isomorphic databases. Therefore, and without loss of generality, we can assume that 𝐸 ⊆ 𝐷 𝐸 . To show that 𝐶 is ( 𝑛, 𝑚 ) -locally embeddable in 𝐷 , it remains to show that for every database 𝐷 ′ in the 𝑚 -neighbourhood of 𝐸 in 𝐷 𝐸 , there exists a function ℎ : adom ( 𝐷 ′ ) → adom ( 𝐷 ) such that ℎ is the identity on adom ( 𝐸 ) and ℎ ( facts ( 𝐷 ′ )) ⊆ facts ( 𝐷 ) . Towards a contradiction, assume that there exists 𝐷 ′ in the 𝑚 -neighbourhood of 𝐸 in 𝐷 𝐸 for which there is no function ℎ : adom ( 𝐷 ′ ) → adom ( 𝐷 ) that is the identity on adom ( 𝐸 ) with ℎ ( facts ( 𝐷 ′ )) ⊆ facts ( 𝐷 ) . Let 𝐹 be the S -database defined as the difference between 𝐷 ′ and 𝐸 , i.e., 𝐹 is such that facts ( 𝐹 ) = facts ( 𝐷 ′ ) \ facts ( 𝐸 ) , while dom ( 𝐹 ) consists of all the constants occurring in facts ( 𝐷 ′ ) \ facts ( 𝐸 ) , and hence, dom ( 𝐹 ) = adom ( 𝐹 ) . Clearly, there is no function ℎ : adom ( 𝐹 ) → adom ( 𝐷 ) that is the identity on adom ( 𝐸 ) and ℎ ( facts ( 𝐹 ) ⊆ 𝐷 . Observe that | adom ( 𝐹 ) \ adom ( 𝐸 )| ≤ 𝑚 ; we assume that adom ( 𝐹 ) \ adom ( 𝐸 ) = { 𝑑 , . . . , 𝑑 1 𝑚 ′ } for 𝑚 ′ ≤ 𝑚 . Let 𝛾 𝑦 ( ¯ ) be the formula obtained from GLYPH&lt;211&gt; 𝛼 ∈ facts ( 𝐹 ) 𝛼 after renaming each constant 𝑑 𝑖 to the variable 𝑦 𝑖 ; thus, ¯ 𝑦 = 𝑦 1 , . . . , 𝑦 𝑚 ′ . Since there is no function ℎ : adom ( 𝐹 ) → adom ( 𝐷 ) that is the identity on adom ( 𝐸 ) and ℎ ( facts ( 𝐹 ) ⊆ 𝐷 , we can conclude that 𝐷 | = ∃ ¯ 𝑦 𝛾 ( ¯ 𝑦 ) . Observe now that, by construction, ¬∃ ¯ 𝑦 𝛾 ( ¯ 𝑦 ) is a conjunct of Δ 𝐷 𝐸,𝑚 , which in turn implies that the formula ¬∃ ¯ 𝑧 𝛾 ( ¯ 𝑧 ) obtained from ¬∃ ¯ 𝑦 𝛾 ( ¯ 𝑦 ) after renaming each constant 𝑐 ∈ dom ( 𝐸 ) = adom ( 𝐸 ) to the variable 𝑥 𝑐 is a conjunct of Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) . Since 𝐹 ⊆ 𝐷 𝐸 , we conclude that 𝐷 𝐸 | = ∃ ¯ 𝑧 𝛾 ( ¯ 𝑧 ) , which implies that 𝐷 𝐸 | = ∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) . But this contradicts the fact that 𝐷 𝐸 | = ∃ ¯ 𝑥 Φ 𝐷 𝐸,𝑚 ( ¯ 𝑥 ) . This completes the proof that 𝐶 is ( 𝑛, 𝑚 ) -embeddable in 𝐷 . ⊓ ⊔

̸

## Step 2: The finite set Σ ∃ , = of tgds and egds that axiomatizes 𝐶

The next lemma, which is an elimination-of-disjunctions result, provides a stepping stone towards proving that the class 𝐶 is finitely axiomatizable by tgds and egds.

Lemma 9 Assume that ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 𝑖 )) , where, for each 𝑖 ∈ [ 𝑘 ] , 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) is either an equality formula or a non-empty conjunction of atoms, is an edd that belongs to Σ ∨ . There is 𝑗 ∈ [ 𝑘 ] such that ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) also belongs to Σ ∨ .

̸

Proof. Note that for every 𝑗 ∈ [ 𝑘 ] , the sentence ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) is either an egd or a tgd, hence it is an edd. Towards a contradiction, assume that none of these sentences belongs to Σ ∨ . Since Σ ∨ consists of all edds in E 𝑛,𝑚 that are satisfied by every database in 𝐶 , for every 𝑗 ∈ [ 𝑘 ] , there is an S -database 𝐷 𝑗 ∈ 𝐶 such that 𝐷 𝑗 | = ∀ ¯ 𝑥 ( 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) , or, equivalently, 𝐷 𝑗 | = ∃ ¯ 𝑥 ( 𝜙 𝑥 ( ¯ ) ∧ ¬ 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) . Let

$$E \, = \, D _ { 1 } \otimes \cdots \otimes D _ { k }.$$

̸

Since, by hypothesis, 𝐶 is closed under direct products, we have that 𝐸 ∈ 𝐶 . We will show that 𝐸 | = 𝛿 , which leads to a contradiction since 𝛿 ∈ Σ ∨ and 𝐸 ∈ 𝐶 , which means that 𝐸 | = 𝛿 .

Since 𝐷 𝑗 | = ∃ ¯ 𝑥 ( 𝜙 𝑥 ( ¯ ) ∧ ¬ 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) for each 𝑗 ∈ [ 𝑘 ] , there is a function ℎ 𝑗 : ¯ 𝑥 → dom ( 𝐷 𝑗 ) such that ℎ 𝑗 ( 𝜙 𝑥 ( ¯ )) ⊆ facts ( 𝐷 𝑗 ) and 𝐷 𝑗 | = ¬ 𝜓 𝑗 ( ℎ 𝑗 ( ¯ 𝑥 𝑗 )) . Let ℎ : ¯ 𝑥 → dom ( 𝐸 ) be the function such that, for each variable 𝑥 ∈ ¯, 𝑥 we have ℎ 𝑥 ( ) = ( ℎ 1 ( 𝑥 , . . . , ℎ ) 𝑘 ( 𝑥 )) . By the definition of direct products, we have that ℎ 𝜙 𝑥 ( ( ¯ )) ⊆ facts ( 𝐸 ) . It remains to show that, for each 𝑗 ∈ [ 𝑘 ] , if 𝜓 𝑗 ( ¯ 𝑥 𝑗 ) is an equality formula 𝑦 = 𝑧 , then ℎ 𝑦 ( ) ≠ ℎ 𝑧 ( ) , while if 𝜓 𝑗 ( ¯ 𝑥 𝑗 ) is not an equality formula, then there is no extension ℎ ′ of ℎ such that ℎ ′ ( 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) ⊆ facts ( 𝐸 ) . We proceed by case analysis on the form of 𝜓 𝑗 ( ¯ 𝑥 𝑗 ) .

Case 1: Assume first that 𝜓 𝑗 ( ¯ 𝑥 𝑗 ) is the equality expression 𝑦 = 𝑧 . By the properties of the function ℎ 𝑗 , we have that ℎ 𝑗 ( 𝑦 ) ≠ ℎ 𝑗 ( 𝑧 ) . Hence, by the definition of ℎ , we conclude that ℎ 𝑦 ( ) ≠ ℎ 𝑧 ( ) .

̸

Case2: Assumenowthat 𝜓 𝑗 ( ¯ 𝑥 𝑗 ) is a formula of the form ∃ ¯ 𝑦 𝑗 𝜒 𝑗 ( ¯ 𝑥 𝑗 , 𝑦 ¯ 𝑗 ) , and assume, by contradiction, that there exists an extension ℎ ′ of ℎ such that ℎ ′ ( 𝜒 𝑗 ( ¯ 𝑥 𝑗 , 𝑦 ¯ 𝑗 )) ⊆ facts ( 𝐸 ) . For a constant 𝑐 ∈ dom ( 𝐸 ) , we write 𝑐 𝑖 [ ] for the 𝑖 -th component of 𝑐 , which is actually a constant from dom ( 𝐷 𝑖 ) . We define the function ℎ ′ 𝑗 : ¯ 𝑥 ∪ ¯ 𝑦 𝑗 → dom ( 𝐷 𝑗 ) such that ℎ ′ 𝑗 ( 𝑣 ) = ℎ ′ ( 𝑣 ) [ 𝑗 ] , for each variable 𝑣 ∈ ¯ 𝑥 ∪ ¯ 𝑦 𝑗 . Since ℎ ′ is an extension of ℎ and ℎ 𝑗 ( 𝑣 ) = ℎ 𝑣 ( ) [ 𝑗 ] , for each variable 𝑣 ∈ ¯, we conclude that 𝑥 ℎ ′ 𝑗 is an extension of ℎ 𝑗 . By hypothesis, ℎ ′ ( 𝛼 ) ∈ facts ( 𝐸 ) for each conjunct 𝛼 of 𝜒 𝑗 ( ¯ 𝑥 𝑗 , 𝑦 ¯ 𝑗 ) . Assume that ℎ ′ ( 𝛼 ) = 𝑅 𝑐 , . . . , 𝑐 ( ¯ 𝑖 ¯ 𝑚 ) . By the definition of the direct product, we conclude that 𝑅 𝑐 ( ¯1 [ 𝑗 ] , . . . , 𝑐 𝑚 [ 𝑗 ]) ∈ facts ( 𝐷 𝑗 ) . Consequently, ℎ ′ 𝑗 ( 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) ⊆ facts ( 𝐷 𝑗 ) , which in turn implies that 𝐷 𝑗 | = 𝜓 𝑗 ( ℎ 𝑗 ( ¯ 𝑥 𝑗 ) , which contradicts the fact that 𝐷 𝑗 | = 𝜓 𝑗 ( ℎ 𝑗 ( ¯ 𝑥 𝑗 ) . This completes the proof of Lemma 9. ⊓ ⊔

We are now ready to complete the proof of Theorem 3. Define Σ ∃ , = to be the set of all tgds and egds occurring in Σ ∨ , that is,

$$\Sigma ^ { \exists, = } \, = \, \left \{ \delta \in \Sigma ^ { \vee } \, | \, \delta \text{ is a } t g d \text{ or an egd} \right \}.$$

Note that Σ ∃ , = is a finite set because it is a subset of the finite set Σ ∨ . We proceed to show that, for each S -database 𝐷 , it holds that 𝐷 ∈ 𝐶 if and only if 𝐷 | = Σ ∃ , = .

( ⇒ ) If 𝐷 ∈ 𝐶 , then, by definition, 𝐷 | = Σ ∨ ; hence, 𝐷 | = Σ ∃ , = since Σ ∃ , = ⊆ Σ ∨ . ( ⇐ ) Assume now that 𝐷 is an S -database such that 𝐷 | = Σ ∃ , = . We need to show that 𝐷 ∈ 𝐶 . By Lemma 8, it suffices to show that 𝐷 | = Σ ∨ . Let 𝛿 be a sentence in Σ ∨ . Since 𝐶 is 1-critical, we get that 𝛿 is not an implication with the truth constant false

being its conclusion. Therefore, 𝛿 is an edd of the form ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 𝑖 )) , where each expression 𝜓 𝑖 ( ¯ 𝑥 𝑖 ) is either an equality 𝑦 = 𝑧 with 𝑦 and 𝑧 among the variables in ¯ 𝑥 or a constant-free formula ∃ ¯ 𝑦 𝑖 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 ) with 𝜒 𝑖 ( ¯ 𝑥 , 𝑦 𝑖 ¯ 𝑖 ) non-empty, the variables in ¯ 𝑥 𝑖 among those in ¯, 𝑥 and the variables in ¯ 𝑦 𝑖 different from those in ¯. 𝑥 By Lemma 9, there is 𝑗 ∈ [ 𝑘 ] such that the sentence ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) belongs to Σ ∨ . Since this sentence is either an egd or a tgd, we have that it belongs to Σ = , ∃ , and hence, 𝐷 | = ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) . It is obvious that the formula ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → 𝜓 𝑗 ( ¯ 𝑥 𝑗 )) logically implies the edd ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 𝑖 )) , hence 𝐷 | = ∀ ( ¯ 𝑥 𝜙 𝑥 ( ¯ ) → GLYPH&lt;212&gt; 𝑘 𝑖 = 1 𝜓 𝑖 ( ¯ 𝑥 𝑖 )) . This completes the proof of the above claim.

Therefore, we have established that the class 𝐶 is axiomatizable by the set Σ = , ∃ , which is a finite set of tgds and egds. This completes the proof of Theorem 3 .

## 4.3 From Theorem 3 to Theorem 1

We conclude this section by discussing how we can derive the characterization for full tgds and egds from [22], that is, Theorem 1 in Section 3, by exploiting the characterization for ( 𝑛, 𝑚 ) -tgds and 𝑛 -egds presented above, that is, Theorem 3. We first present the following consequence of Theorem 3, which forms a relevant characterization for finite sets of full tgds and egds in its own right.

Corollary 2 Consider a collection 𝐶 of databases. The following are equivalent:

- 1. 𝐶 is finitely axiomatizable by full tgds and egds.
- 2. 𝐶 is 1 -critical, ( 𝑛, 0 ) -local for some integer 𝑛 ≥ 0 , and closed under direct products.

Observe that for obtaining Theorem 1 it suffices to replace in Corollary 2 the property of ( 𝑛, 0 -locality for some integer ) 𝑛 ≥ 0 with the properties of domain independence, modularity, and closure under subdatabases. We proceed to show that this is indeed the case. But let us first state a simple fact that provides a useful characterization of the notion of ( 𝑛, 0 -local embeddability. )

Recall that, for a schema S and an integer 𝑚 ≥ 0, the 𝑚 -neighbourhood of an S -database 𝐷 ′′ in an S -database 𝐷 ′ with 𝐷 ′′ ⊆ 𝐷 ′ is the set of S -databases

$$\{ E \ | \ D ^ { \prime \prime } \subseteq E, \, E \leq D ^ { \prime } \text{ and } | \text{adom} ( E ) | \leq | \text{adom} ( D ^ { \prime \prime } ) | + m \}.$$

Note that if 𝐷 ′′ ⊆ 𝐸 , we have that adom ( 𝐷 ′′ ) ⊆ adom ( 𝐸 ) . Furthermore, if 𝐸 is in the 0-neighbourhood of 𝐷 ′′ in 𝐷 ′ , then | adom ( 𝐸 )| ≤ | adom ( 𝐷 ′′ )| , and thus, adom ( 𝐷 ′′ ) = adom ( 𝐸 ) . Since both 𝐷 ′′ and 𝐸 are contained in 𝐷 ′ , it follows that facts ( 𝐸 ) = facts ( 𝐷 ′ ↾ adom ( 𝐷 ′′ )) = facts ( 𝐷 ′′ ) , where 𝐷 ′ ↾ adom ( 𝐷 ′′ ) is the restriction of 𝐷 ′ over adom ( 𝐷 ′′ ) , that is, the database { 𝑅 𝑐 ( ¯ ) ∈ 𝐷 ′ | ¯ 𝑐 ∈ adom ( 𝐷 ′′ ) ar ( 𝑅 ) } . It follows that the 0-neighborhood of 𝐷 ′′ in 𝐷 ′ is the set of S -databases

{ 𝐸 | 𝐸 ⪯ 𝐷 ′ and facts ( 𝐸 ) = facts ( 𝐷 ′ ↾ adom ( 𝐷 ′′ )) = facts ( 𝐷 ′′ )} .

Characterizing Data Dependencies Then and Now

Consequently, we have that the following holds.

Lemma 10 Consider a collection 𝐶 of databases over a schema S . The following are equivalent:

- 1. An S -database 𝐷 is ( 𝑛, 0 ) -locally embeddable in 𝐶 .
- 2. For every 𝐸 ⪯ 𝐷 with adom ( 𝐸 ) = dom ( 𝐸 ) and | adom ( 𝐸 )| ≤ 𝑛 , there is an S -database 𝐷 𝐸 ∈ 𝐶 such that facts ( 𝐷 𝐸 ↾ adom ( 𝐸 )) = facts ( 𝐸 ) .

Byexploiting the above lemma, we can show that ( 𝑛, 0 -locality can be replaced by ) the properties of domain independence, modularity, and closure under subdatabases.

Proposition 1 Consider a collection 𝐶 of databases over a schema S and an integer 𝑛 ≥ 0 . The following statements are equivalent:

- 1. 𝐶 is ( 𝑛, 0 ) -local.
- 2. 𝐶 is domain independent, 𝑛 -modular, and closed under subdatabases.

Proof. Wefirst show the direction ( 1 ) ⇒ ( 2 . Since, by hypothesis, ) 𝐶 is ( 𝑛, 0 -local, ) Lemma 5 implies that 𝐶 is domain independent. To show that 𝐶 is 𝑛 -modular, let 𝐷 be an S -database such that every 𝐷 ′ ⪯ 𝐷 with dom ( 𝐷 ′ ) ≤ 𝑛 belongs to 𝐶 . We proceed to show that 𝐷 ∈ 𝐶 by showing that 𝐶 is ( 𝑛, 0 -locally embeddable ) in 𝐷 . This follows from Lemma 10 by taking 𝐷 𝐸 = 𝐷 ′ . Finally, to show that 𝐶 is closed under subdatabases, consider an arbitrary S -database 𝐷 ∈ 𝐶 and let 𝐷 ′ be a subdatabase of 𝐷 . We proceed to show that 𝐷 ′ ∈ 𝐶 by showing that 𝐶 is ( 𝑛, 0 -locally embeddable in ) 𝐷 ′ . The latter again follows from Lemma 10 by taking 𝐷 𝐸 = 𝐷 .

We now show ( 2 ) ⇒ ( 1 . Assume that ) 𝐶 is domain independent, 𝑛 -modular, and closed under subdatabases. We need to show that if 𝐶 is ( 𝑛, 0 -locally embeddable ) in an S -database 𝐷 , then 𝐷 ∈ 𝐶 . By Lemma 10, for every 𝐸 ⪯ 𝐷 with adom ( 𝐸 ) = dom ( 𝐸 ) and | adom ( 𝐸 )| ≤ 𝑛 , there is an S -database 𝐷 𝐸 ∈ 𝐶 such that facts ( 𝐷 𝐸 ↾ adom ( 𝐸 )) = facts ( 𝐸 ) . Since 𝐶 is closed under subdatabases, we have that 𝐷 𝐸 ↾ adom ( 𝐸 ) belongs to 𝐶 . Since 𝐶 is domain independent and facts ( 𝐷 𝐸 ↾ adom ( 𝐸 )) = facts ( 𝐸 ) , we get that 𝐸 ∈ 𝐶 . Thus, every subdatabase 𝐸 of 𝐷 with at most 𝑛 elements in its active domain is in 𝐶 . Since 𝐶 is 𝑛 -modular, it follows that 𝐷 is also in 𝐶 . ⊓ ⊔

Theorem 1 readily follows from Corollary 2 and Proposition 1.

## 5 Concluding Remarks

When J´ anos Makowsky retired as President of the European Association for Computer Science Logic (EACSL), he gave an invited address at the 2011 CSL conference in which he reflected on his experience in research [21]. In particular, he reflected on his work in database theory, highlighted the undecidability of the implication problem for EIDs, and concluded the section on his contributions to database theory by writing that 'After that I tried to learn the true problems of database theory.

However, J. Ullman changed his mind and declared that Dependency Theory and Design Theory had run their course. As a result, papers dealing with these topics were almost banned from the relevant conferences.' Here, Makowsky refers to Ullman's invited talk and paper, titled 'Database Theory: Past and Future', at the 1987 ACM Symposium on Principles of Database Systems (PODS) [28]. When it came to the past of dependency theory, Ullman stated that 'We quickly learned far more about the subject than was necessary, a process that continues to this day' and then, contemplating the future, he delegated dependency theory to the section titled 'Last Gasps of the Dying Swans'.

The pronouncement of the demise of dependency theory, however, turned out to be premature. Indeed, about a decade later, data dependencies found numerous uses in formalizing and analyzing data inter-operability tasks, such as data exchange and data integration (see, e.g., the surveys [16, 18] and the books [1, 17]). As a matter of fact, the study of data dependencies has enjoyed a renaissance that continues to date. In particular, tgds have been used to specify data transformation tasks (i.e., how data structured under one schema should be transformed into data structured under a different schema) and as building blocks of ontology languages [2, 5, 6]. In the case of data exchange and data integration, a subclass of tgds, called sourceto-target tgds (s-t tgds), has played a central role. These are the tgds of the form ∀ ∀ ¯ 𝑥 ¯ 𝑦 ( 𝜙 𝑥, 𝑦 ( ¯ ¯ ) → ∃ ¯ 𝑧𝜓 𝑥, 𝑧 ( ¯ ¯ )) , where all relations in 𝜙 𝑥, 𝑦 ( ¯ ¯ ) are from a source schema, while all relations in 𝜓 𝑥, 𝑧 ( ¯ ¯ ) are from a disjoint target schema. The study of s-t tgds led to the discovery of new structural properties for this class of tgds, the most prominent of which is the existence of universal solutions in data exchange [15]. In turn, this motivated the pursuit of characterizations of s-t tgds and of natural subclasses of them using structural properties relevant to data inter-operability, such as the existence of universal solutions and conjunctive query rewriting [26, 27]. And now we have come full circle with the structural characterizations of arbitrary tgds and egds discussed in this paper. In conclusion, J´ anos Makowsky's work on data dependencies was well ahead of its time.

## References

- 1. Marcelo Arenas, Pablo Barcel´ o, Leonid Libkin, and Filip Murlak. Foundations of Data Exchange . Cambridge University Press, 2014.
- 2. Jean-Franc ¸ois Baget, Michel Lecl` ere, Marie-Laure Mugnier, and Eric Salvat. On rules with existential variables: Walking the decidability line. Artif. Intell. , 175(9-10):1620-1654, 2011.
- 3. Catriel Beeri and Moshe Y. Vardi. The implication problem for data dependencies. In ICALP , pages 73-85, 1981.
- 4. Catriel Beeri and Moshe Y. Vardi. A proof procedure for data dependencies. J. ACM , 31(4):718-741, 1984.
- 5. Andrea Cal` ı, Georg Gottlob, and Thomas Lukasiewicz. A general datalog-based framework for tractable query answering over ontologies. J. Web Semant. , 14:57-83, 2012.
- 6. Andrea Cal` ı, Georg Gottlob, and Andreas Pieris. Towards more expressive ontology languages: The query answering problem. Artif. Intell. , 193:87-128, 2012.
- 7. Ashok K. Chandra, Harry R. Lewis, and Johann A. Makowsky. Embedded implicational dependencies and their inference problem. In STOC , pages 342-354, 1981.

- 8. Chen C. Chang and H. Jerome Keisler. Model theory, Third Edition , volume 73 of Studies in logic and the foundations of mathematics . 1992.
- 9. E. F. Codd. A relational model of data for large shared data banks. Commun. ACM , 13(6):377387, 1970.
- 10. E. F. Codd. Relational completeness of data base sublanguages. Research Report / RJ / IBM / San Jose, California , RJ987, 1972.
- 11. Edgar F Codd. Further normalization of the data base relational model. Data base systems , 6:33-64, 1972.
- 12. Marco Console, Phokion G. Kolaitis, and Andreas Pieris. Model-theoretic characterizations of rule-based ontologies. In PODS , pages 416-428, 2021.
- 13. Chris J. Date. Logic and Relational Theory . Technics Publications, 2020.
- 14. Ronald Fagin. Horn clauses and database dependencies. J. ACM , 29(4):952-985, 1982.
- 15. Ronald Fagin, Phokion G. Kolaitis, Ren´ ee J. Miller, and Lucian Popa. Data exchange: semantics and query answering. Theor. Comput. Sci. , 336(1):89-124, 2005.
- 16. Phokion G. Kolaitis. Schema mappings, data exchange, and metadata management. In PODS , pages 61-75, 2005.
- 17. Phokion G. Kolaitis, Maurizio Lenzerini, and Nicole Schweikardt, editors. Data Exchange, Integration, and Streams , volume 5 of Dagstuhl Follow-Ups . Schloss Dagstuhl - LeibnizZentrum f¨ ur Informatik, 2013.
- 18. Maurizio Lenzerini. Data integration: A theoretical perspective. In PODS , pages 233-246, 2002.
- 19. Per Lindstr¨m. On extensions of elementary logic. o Theoria , 35(1), 1969.
- 20. Johann A. Makowsky. Characterizing data base dependencies. In ICALP , pages 86-97, 1981.
- 21. Johann A. Makowsky. Model theory in computer science: My own recurrent themes. In CSL , pages 553-567, 2011.
- 22. Johann A. Makowsky and Moshe Y. Vardi. On the expressive power of data dependencies. Acta Informatica , 23(3):231-244, 1986.
- 23. John Charles Chenoweth McKinsey. The decision problem for some classes of sentences without quantifiers. The Journal of Symbolic Logic , 8(3):61-76, 1943.
- 24. Abraham Robinson. Introduction to model theory and to the metamathematics of algebra . North-Holland Publishing Company, Amsterdam, 1963.
- 25. Alfred Tarski. Some notions and methods on the borderline of algebra and metamathematics. In Proceedings of the International Congress of Mathematicians , volume 1, pages 705-720, 1950.
- 26. Balder ten Cate and Phokion G. Kolaitis. Structural characterizations of schema-mapping languages. In ICDT , pages 63-72, 2009.
- 27. Balder ten Cate and Phokion G. Kolaitis. Structural characterizations of schema-mapping languages. Commun. ACM , 53(1):101-110, 2010.
- 28. Jeffrey D. Ullman. Database theory: Past and future. In PODS , pages 1-10, 1987.
- 29. Mihalis Yannakakis and Christos H. Papadimitriou. Algebraic dependencies (extended abstract). In FOCS , pages 328-332, 1980.
- 30. Heng Zhang and Guifei Jiang. Characterizing the program expressive power of existential rule languages. In AAAI , pages 5950-5957, 2022.
- 31. Heng Zhang, Yan Zhang, and Guifei Jiang. Model-theoretic characterizations of existential rule languages. In IJCAI , 2020.
Phokion G. Kolaitis Andreas Pieris
Characterizing Data Dependencies Then and Now
Data dependencies are integrity constraints that the data of interest must
obey. During the 1980s, Janos Makowsky made a number of contributions to the
study of data dependencies; in particular, he was the first researcher to
characterize data dependencies in terms of their structural properties. The
goal of this article is to first present an overview of Makowsky's work on
characterizing certain classes of data dependencies and then discuss recent
developments concerning characterizations of broader classes of data
dependencies.