Questions tagged [functional-dependencies]

A functional dependency is a constraint between two sets of attributes in a relation, in relational algebra, databases and type systems.

Functional dependencies (FD) are fundamental to the process of normalization.

Given a relation R, a set of attributes X in R is said to functionally determine a set of attributes Y, also in R, (written X → Y) if, and only if, whenever two tuples coincide on all attributes of X, they also coincide on all attributes of Y. Sound, complete and non-redundant axiomatisation of functional dependencies is given by Armstrong rules. Functional dependencies are also used in the Haskell programming language to describe relations between types, to support type level relational programming.

In other words, a dependency FD: X → Y means that the values of Y are determined by the values of X. Two tuples sharing the same values of X will necessarily have the same values of Y.

Enter image description here

544 questions
5
votes
4 answers

Decomposition that does not preserve functional dependency

When can a BCNF decomposition not preserve functional dependency... I am trying to figure this out for say R=(V,W,X,Y,Z)
5
votes
1 answer

Lossless decomposition vs Dependency Preservation

Does anyone of them implies the other? My logic is that if all dependencies are preserved, then there is no loss of information and similarly, if decomposition is lossless then no functional dependency must have been violated. So essentially,…
5
votes
3 answers

What does the symbol "⊇" mean?

In the attached picture there's a symbol I don't understand. To understand additive functional dependency I need to know what the symbol means. Please advice? It's the symbol where it says: "Suppose that X ⊇ Y and that..." ⊇ = ? Thanks!
Phil
  • 3,934
  • 12
  • 38
  • 62
5
votes
1 answer

Overlapping instances error when trying to write fallback instance

I'm trying to do something similar to the advanced overlap trick to define an instance with overlapping behavior. I'm trying to derive an instance for a tuple that will use an instance for the fst field if one exists, otherwise use the instance for…
5
votes
3 answers

algorithm for computing closure of a set of FDs

I'm looking for an easy to understand algorithm to compute (by hand) a closure of a set of functional dependencies. Some sources, including my instructor says I should just play with Armstrong's axioms and see what I can get at. To me, that's not a…
dbmonster
  • 73
  • 1
  • 4
5
votes
1 answer

Reflexivity axiom for inferring functional dependencies

As you know, there are three Armstrong's Axioms for inferring all the functional dependencies on a relational database. (X, Y and Z are set of attributes) Reflexivity: If X ⊆ Y, then Y → X Augmentation: If X → Y, then XZ → YZ for any…
Templar
  • 1,843
  • 7
  • 29
  • 42
4
votes
1 answer

Overlapping instances to flatten tuples

I'm trying to write code to remove empty tuples from a tuple chain. The compiler rejects the program: Code: {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE…
Thomas Eding
  • 35,312
  • 13
  • 75
  • 106
4
votes
1 answer

How can I use a type parameter determined via the functional dependency of an instance constraint as the RHS of an associated type family equation?

I have a typeclass like this: class (Coercible a b) => Foo a b | a -> b I would like to declare the following instance of Generic: data Thing a where Thing :: Foo a b => b -> Thing a -- If the @b@ uniquely determined by @a@ is @Generic@, so is…
Asad Saeeduddin
  • 46,193
  • 6
  • 90
  • 139
4
votes
1 answer

Functional dependencies for adjoint functors in Haskell

It's easy to describe adjunction in Haskell: class Functor f where map :: (a -> b) -> f a -> f b class Functor m => Monad m where return :: a -> m a join :: m (m a) -> m a class Functor w => Comonad w where extract :: w a -> a duplicate…
4
votes
1 answer

Why does this type annotation make my functional dependency conflict go away? (and why does it only happen on some versions of GHC?)

So I've been playing around with MonadState class and I have encountered something I consider very strange. I can try to write a monad like the following: test :: ( MonadState Int m , MonadState Bool m ) => m () test = do ((+1) <$> get)…
Wheat Wizard
  • 3,982
  • 14
  • 34
4
votes
3 answers

Consider the following set F of functional dependencies on the relation schema r(A,B,C,D,E,F):

I have tried to reach out to my instructor with no luck and I really want to understand this process, but no matter how much I read the material I cannot seem to make this fit in my little brain. Can someone please help me with the following…
Sam
  • 41
  • 1
  • 1
  • 3
4
votes
1 answer

Functional dependencies in database

I have the following set of functional dependencies on the relation schema r(A, B, C, D, E, F ) : A -> BCD BC -> DE B -> D D -> A Can anyone show with explanation how to find the candidate keys for this relation ?
4
votes
1 answer

Is there an example of any functional dependency violating 1NF?

Is it possible for a functional dependency to violate 1NF? for example R={A,B,C,D,E} F=Any FD that violates 1NF What kind of functional dependency will violate 1NF? I understand examples of function dependencies violating 2NF, 3NF and BCNF but I've…
4
votes
1 answer

Role of functional dependency in `Unfoldable` typeclass of Haskell Collection API

Im trying to understand the design of Haskell's Data.Collection library, coming from a Scala-literate background. It uses Functional Dependencies (which have a Scala analog) but the way they're used doesn't make sense to me. In the Unfoldable class,…
Ben Hutchison
  • 2,433
  • 2
  • 21
  • 25
4
votes
1 answer

Prolog union fails

I'm trying to understand the use of union (the built in predicate) in Prolog. In many cases it seems to fail when it should succeed. It seems it has something to do with the order of the elements of the lists. All of the below cases fail (they come…
uncreative
  • 341
  • 5
  • 11