Bernstein's synthesis is a synthesis algorithm for normalisation of a set of
dependencies into a set of relations that are in third normal form. This
implementation is based on the version given in the referenced paper.
The implementation also includes a common additional step, to ensure that the
resulting decomposition is lossless, i.e. a relation satisfying the given
dependencies can be perfectly reconstructed from the relations given by the
decomposition. This is done by adding an additional relation, containing a
key for all the original attributes, if one is not already present.
As an additional optional step, schemas are checked for "avoidable"
attributes, that can be removed without loss of information.
Constant attributes, i.e. those whose only determinant set is empty, get
assigned to a relation with no keys.
Output is independent of the order of the input dependencies: schemas are
sorted according to their simplest keys.
Schemas are sorted before ensuring for losslessness, or removing avoidable
attributes. As a result, neither optional step changes the order of the
schemas, and ensuring losslessness can only add an extra schema to the end of
the output vector.