Functional dependency - adding any attribute to X will still yield a FD?

43 Views Asked by At

I have heard my professor saying that when X → Y is a functional dependency, adding any attribute to X or removing any attribute from Y will still yield a functional dependency. I do not understand how this could be true? If I add any attribute into X, how could it imply the same Y?

1

There are 1 best solutions below

0
On BEST ANSWER

Informally, this is because if we know that the values of a set of attributes $X$ uniquely determine the values of a set of attributes $Y$, then obviously the values of some set $X' \supset X$ of attributes also determines the values of attributes $Y$ uniquely. And if the values of all attributes in $Y$ are determined uniquely, so are, of course, the values of all attributes in $Y' \subset Y$.

Formally, if $X$ of $n$-tuples, functional dependency $$ (x_1,\ldots,x_k) \to (x_{n-l+1},\ldots,x_n) $$ means that whenever two tuples in $X$ have the same first $k$ components, they also have the same last $l$ components, i.e. that $$ \text{For all }x,y\in X \,:\, x_1=y_1,\ldots,x_k=y_k \,\Rightarrow\, x_{n-l+1}=y_{n-l+1},\ldots,x_n=y_n $$

Now, if we replace $k$ by $k' \geq k$ and $l$ by $l' \leq l$, which amounts to adding attributes to the left-hand side and removing attribute from the right-hand side of the function dependency, that statement remains true. Observe that obviously $$\begin{eqnarray} x_1&=&y_1,&\ldots&,x_{k'}&=&y_{k'} &\Rightarrow& x_1&=&y_1,&\ldots&,x_k&=&y_k &\text{ if $k \leq k'$} \\ x_{n-l+1}&=&y_{n-l+1},&\ldots&,x_n&=&y_n &\Rightarrow& x_{n-l'+1}&=&y_{n-l'+1},&\ldots&,x_n&=&y_n &\text{ if $l' \leq l$,} \end{eqnarray}$$ and by combining that with the definition of functional dependency above, we get (again assuming $k \leq k'$, $l' \leq l$) that $$ \begin{eqnarray} \text{For all }x,y\in X \,:& x_1=y_1,\ldots,x_{k'}=y_{k'} \\ \Rightarrow& x_1=y_1,\ldots,x_k=y_k \\ \Rightarrow& x_{n-l+1}=y_{n-l+1},\ldots,x_n=y_n \\ \Rightarrow& x_{n-l'+1}=y_{n-l'+1},\ldots,x_n=y_n \text{.} \end{eqnarray} $$ Leaving out the middle part of the chain of implications yields exactly what we wanted $$ \text{For all }x,y\in X \,:\, x_1=y_1,\ldots,x_{k'}=y_{k'} \,\Rightarrow\, x_{n-l'+1}=y_{n-l'+1},\ldots,x_n=y_n \text{.} $$