Algorithm Search⌘K

Definitionadvanced

Equality-generating dependency

Also called EGD.

A first-order constraint that whenever some tuples are present, two of their values must be equal; functional dependencies are a case.

An equality-generating dependency (EGD) says that whenever some pattern of tuples occurs in a database, two values of that pattern are equal. The pattern is a conjunction of atoms, as in a conjunctive query. Every functional dependency and every key constraint is an EGD, but an EGD can also join several relations. Beeri and Vardi (1984) named the class, and it is one half of the embedded implicational dependencies of Fagin (1982). The other half are the tuple-generating dependencies. In the chase, an EGD makes two values equal, or fails when they are two different constants.

Definition

We use set semantics: a relation is a set of tuples.

Definition (Beeri and Vardi 1984). An equality-generating dependency is a first-order sentence

∀xˉ (φ(xˉ)→xi=xj),\forall \bar x \, \big( \varphi(\bar x) \rightarrow x_i = x_j \big),

where φ\varphi is a nonempty conjunction of relational atoms and xix_i and xjx_j are variables of φ\varphi. In ASCII it is written phi(x) -> x_i = x_j. A database DD satisfies the EGD if every valuation vv with v(φ)⊆Dv(\varphi) \subseteq D has v(xi)=v(xj)v(x_i) = v(x_j). The EGD is trivial if xix_i and xjx_j are the same variable.

A conclusion with several equalities, x1=y1∧⋯∧xp=ypx_1 = y_1 \wedge \cdots \wedge x_p = y_p, is the same as pp EGDs with the same body. Some authors also allow a constant on the right side, as in xi=cx_i = c.

As a query. DD satisfies the EGD if and only if the conjunctive query Q(xi,xj): ⁣−φQ(x_i, x_j) \mathbin{:\!-} \varphi returns only pairs of equal values on DD.

The chase step. If v(φ)⊆Dv(\varphi) \subseteq D and a=v(xi)a = v(x_i) differs from b=v(xj)b = v(x_j), the chase acts as follows.

  • If bb is a labeled null, replace bb by aa everywhere in DD. If aa is a null and bb is a constant, replace aa by bb.
  • If aa and bb are two different constants, the chase fails: no way of replacing the nulls of DD by values gives a database that satisfies the EGD.

Each step that does not fail makes the number of distinct values smaller by one. So a chase with EGDs alone stops after fewer steps than there are values in DD. In a test for implication, the values are the variables of a tableau, and they are all treated as nulls, so this chase never fails.

Examples and non-examples

  • Functional dependency. On R(A,B,C)R(A, B, C), the FD A→BA \to B is the EGD
    ∀a,b,c,b′,c′ (R(a,b,c)∧R(a,b′,c′)→b=b′).\forall a, b, c, b', c' \, \big( R(a, b, c) \wedge R(a, b', c') \rightarrow b = b' \big).
    An FD X→YX \to Y with several attributes in YY is one EGD for each attribute of YY.
  • Key. AA is a key of R(A,B,C)R(A, B, C) if A→BA \to B and A→CA \to C hold, which are two EGDs. See candidate key.
  • Across two relations. With Emp(name,dept)\mathit{Emp}(\mathit{name}, \mathit{dept}) and Head(dept,name)\mathit{Head}(\mathit{dept}, \mathit{name}), the EGD
    Head(d,m)∧Emp(m,d′)→d=d′\mathit{Head}(d, m) \wedge \mathit{Emp}(m, d') \rightarrow d = d'
    says that the head of a department works in that department. It is not an FD, because its body has atoms of two relations.
  • A chase step with nulls. Let R={(a,n1,c), (a,b,n2)}R = \{(a, n_1, c),\ (a, b, n_2)\} with nulls n1n_1 and n2n_2, and the FD A→BA \to B. The chase replaces n1n_1 by bb, and RR becomes {(a,b,c), (a,b,n2)}\{(a, b, c),\ (a, b, n_2)\}.
  • A failing chase. R={(a,b,c), (a,b′,c)}R = \{(a, b, c),\ (a, b', c)\} with constants b≠b′b \ne b' violates A→BA \to B, and the chase fails. In data exchange, a failed chase with the target EGDs means that there is no solution.
  • Non-example: inclusion dependency. "Each order has a known customer" asks for a tuple to exist, not for two values to be equal. It is an inclusion dependency, which is a TGD.
  • Non-example: inequality. R(x,y)→x≠yR(x, y) \rightarrow x \ne y is not an EGD. It is a denial constraint, and the chase can not repair it by equating values.
  • Tuple-generating dependency. A TGD has a conjunction of atoms as its conclusion. EGDs and TGDs together are the embedded implicational dependencies of Fagin.
  • Functional dependency and Armstrong's axioms. FDs are the EGDs over one relation whose body has two atoms that share exactly the variables of the left side. Armstrong's axioms are complete for them, and attribute closure decides implication in linear time.
  • Implication. For EGDs, possibly with full TGDs, the chase on the body of the goal stops and decides implication. With embedded TGDs the chase may not stop, and implication of TGDs and EGDs together is undecidable. See the dependency implication problem.
  • Interaction with TGDs in the chase. Steps of EGDs and TGDs can alternate. An EGD step can make a TGD step needed or not needed, so the order of the steps can change the result, and with embedded TGDs it can change whether the chase stops. A chase that stops without failure gives a universal solution.

References

  1. Catriel Beeri and Moshe Y. Vardi, A proof procedure for data dependencies, Journal of the ACM 31(4), 718 to 741 (1984), equality-generating dependencies, and the chase step that equates two values
  2. Ronald Fagin, Horn clauses and database dependencies, Journal of the ACM 29(4), 952 to 985 (1982), embedded implicational dependencies with equalities in the conclusion
  3. Serge Abiteboul, Richard Hull and Victor Vianu, Foundations of Databases, Addison-Wesley (1995), Chapter 8 (functional and join dependency), the chase for functional dependencies, and Chapter 10 (a larger perspective), equality-generating dependencies

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/8F8GKB/text.yaml