114/291
\begin{frame}
  \frametitle{Finding a Minimal Key}
  
  \begin{code}{\textwidth}{\small Finding a Minimal Key}
    Let $\mathcal{A}$ be the attributes of the relation $R$, and $\mathcal{F}$ a set of FDs.
    \begin{itemize}
      \item Let $x = \mathcal{A}$.
      \item If $A \in (x - \{\,A\,\})^+_{\mathcal{F}}$ for some $A \in x$, then remove $A$ from $x$.
      \item Repeat the last step until nothing can be removed.
    \end{itemize}
    Finally, $x$ is a minimal key of $R$.
%     \small
%     $
%     \begin{array}{ll}
%       \emph{Input:}  & \mathcal{A} \text{ (set of all attributes of $R$)} \\
%       & \alpha_1 \to \beta_1, \dots, \alpha_n \to
%       \beta_n \text{ (set of FDs $\mathcal{F}$)} \\
%       \emph{Output:} & \alpha \text{ (a minimal key of $R$)} \\
%     \end{array}
%     $
%     \begin{algorithmic}
%       \STATE $x = \mathcal{A}$;
%       \FORALL{attributes $A \in X$} 
%       \IF{$A \in \{x-A\}^+_{\mathcal{F}}$}
%       \STATE $x = x - A$; \text{\quad (remove $A$ from $x$)}
%       \ENDIF
%       \ENDFOR
%       \STATE \textbf{return} $x$;
%     \end{algorithmic}
  \end{code}
  \vspace{-1ex}
  
  We might get different keys depending on the order in which we remove attributes.
\end{frame}