240 likes | 457 Views
Mathematically speaking…. Functions, Powersets , Languages. by Pavel Gladyshev. Tuple. Ordered sequence of objects Same object can appear in a tuple several times Elements of a tuple are referred to with subscripts:. Relation. A collection of links between elements of two or more sets:.
E N D
Mathematically speaking… Functions, Powersets, Languages by Pavel Gladyshev
Tuple • Ordered sequence of objects • Same object can appear in a tuple several times • Elements of a tuple are referred to with subscripts:
Relation A collection of links between elements of two or more sets: A R B a 1 b 2 c 3
Inverse Relation A A R-1 R B B a a 1 1 b b 2 2 c c 3 3
Relation • Formally defined as a set of tuples • The inverse relation
Relation as a predicate • Relation can be viewed as predicate:
Some classes of relations • Relation is reflexive if and only if • For all x in X it holds that xRx • Relation is transitiveif and only if • For all x,y, and zin Xif xRyand yRzthenxRz • Relation is symmetricif and only if • For all x,yin Xif xRythen yRx
Cartesian product of two sets A and B • Set of all pairs whose first element is from A and second element is from B
Observe that any relation between A and B is a subset of A R B a 1 b 2 c 3
Function Special kind of relation Set B (Range of the function) a 1 b 2 c 3 Set A (Domain of the function) Each object in the domain is linked to at most one object in the Range!
Function declaration Function Domain Range
Total vs. Partial function Total – defined on every element of X Partial – defined for some elements of X
Injective function Each element in X is linked to a distinct element in Y
Inverse function If the original function is injective, then its inverse is also function. X X Y Y a a 1 1 b b 2 2 c c 3 3
Inverse of non-injective function • For a non-injective function it is possible to define a kind of “inverse” that maps every element y of Y into a subset of elements of X for which f(x) = y
Language • Suppose that we have a set • The set of all tuples of length 2 is • The set of all tuples of length 3 is • The set of all tuples of length n is
Language (contd.) • Set of all tuples made of elements of • Set A is called Alpabeth • Language L is a subset of tuples from A*
Assignment • Formally define the notion of hard disk drive. • Specifically try to define the following concepts: • Set of all bytes on HDD • Set of all sectors on HDD • Set of all keywords made from bytes on HDD