Embedded dependency

In relational database theory, an embedded dependency (ED) is a certain kind of constraint on a relational database. It is the most general type of constraint used in practice, including both tuple-generating dependencies and equality-generating dependencies. Embedded dependencies can express functional dependencies, join dependencies, multivalued dependencies, inclusion dependencies, foreign key dependencies, and many more besides.

An algorithm known as the chase takes as input an instance that may or may not satisfy a set of EDs, and, if it terminates (which is a priori undecidable), output an instance that does satisfy the EDs.

Definition
An embedded dependency (ED) is a sentence in first-order logic of the form:
 * $$\forall x_1,\ldots,x_n . \phi(x_1,\ldots,x_n) \rightarrow \exists z_1, \ldots, z_k . \psi(y_1,\ldots,y_m)$$

where $$\{z_1,\ldots,z_k\} = \{y_1,\ldots,y_m\} \setminus \{x_1,\ldots,x_n\}$$ and $$\phi$$ and $$\psi$$ are conjunctions of relational and equality atoms. A relational atom has the form $$R(w_1,\ldots,w_h)$$ and an equality atom has the form $$w_i = w_j$$, where each of the terms $$w, ..., w_h, w_i, w_j$$ are variables or constants.

Actually, one can remove all equality atoms from the body of the dependency without loss of generality. For instance, if the body consists in the conjunction $$A(x,y) \land B(y,z,w) \land y=3 \land z=w$$, then it can be replaced with $$A(x,3)\land B(3,z,z)$$ (analogously replacing possible occurrences of the variables $$y$$ and $$w$$ in the head). Analogously, one can replace existential variables occurring in the head if they appear in some equality atom.

Restrictions
In literature there are many common restrictions on embedded dependencies, among with:
 * full (or universal) dependencies, which are the ones without existentially-quantified variables ($$\exists z_i$$)
 * tuple-generating dependencies (TGDs)
 * equality-generating dependencies (EGDs)
 * single-head (or 1-head) dependencies, which have only one atom in the head
 * unirelational dependencies, in which only one relation symbol occurs

When all atoms in $$\psi$$ are equalities, the ED is an EGD and, when all atoms in $$\psi$$ are relational, the ED is a TGD. Every ED is equivalent to an EGD and a TGD.

Extensions
A common extension of embedded dependencies are disjunctive embedded dependencies (DED), which can be defined as follows:
 * $$\forall x_1,\ldots,x_n . \phi(x_1,\ldots,x_n) \rightarrow \bigvee_{i=1}^\ell \exists z_1^i, \ldots, z_k^i . \psi(y_1^i,\ldots,y_m^i)$$

where $$\{z_1^i,\ldots,z_k^i\} = \{y_1^i,\ldots,y_m^i\} \setminus \{x_1,\ldots,x_n\}$$ and $$\phi$$ and $$\psi$$ are conjunctions of relational and equality atoms.

Disjunctive embedded dependencies are more expressive than simple embedded dependencies, because DEDs in general can not be simulated using one or more EDs. An even more expressive constraint is the disjunctive embedded dependency with inequalities (indicated with DED$$^\ne$$), in which every $$\psi$$ may contain also inequality atoms.

All the restriction above can be applied also to disjunctive embedded dependencies. Beside them, DEDs can also be seen as a generalization of disjunctive tuple-generating dependencies (DTGD).