Fall 98, CSE 468:
Lecture 2 (Aug 28)
Preliminary notions: Basic mathematical definitions.
- Sets and operations on sets
(intersection, union, difference, complementation).
Algebraic laws (commutativity, associativity, distributivity etc.).
Venn diagrams.
- Set inclusion.
- Other operation on sets: Cartesian product A x B.
- Relations. A relation R between A and B is a subset of the cartesian product A x B.
If (x,y) is in R, we write x R y.
- Question:
If A has m elements and B has n elements, how many are the possible relations
between A and B?
- Inverse: Given a relation R between A and B, the inverse of
R is the relation R-1 between B and A
defined by
R-1 = {(x,y) | (y,x) is in R}
- Function: a function f : A -> B is a relation between A and B
such that
(1) For every x in A, and y1, y2
in B, if both (x,y1) and (x,y2) are in f,
then y1 = y2.
Because of this property, we can use the more conventional notation
f(x) = y for (x,y) in f.
If, in addition to (1), f satisfies the property
(2) For every x in A, there exists y in B s.t. f(x) = y
then f is a total function.
Note:
There is some confusion about terminology:
Mathematicians usually call "functions" the relations which satisfy
both (1) and (2),
and call "partial functions" the relations which satisfy only
(1) (and not (2)).
We adopt the convention most used in Computer Science,
which is to call "functions" (or "partial functions") the
relations which satisfy (1)
(regardeless of whether they satisfy (2) or not)
and "total functions" the relations which satisfy
both (1) and (2).
In this convention, clearly, the total functions are a subset of the
partial functions.
- Question:
Given a (partial) function f, what are the conditions on f for
- f-1 to be a function
- f-1 to be a total function
- Equivalence relations. A subset R of A x A is an equivalence relation if
- for every x in A, x R x (reflexivity)
- for every x, y in A, if x R y then y R x (symmetry)
- for every x, y, z in A, if x R y and y R z, then x R z (transitivity)
- Examples:
- "x and y have the same parents" IS an e.r.
- "x and y have the same mother" IS an e.r.
- "x and y have one parent in common" IS NOT an e.r. (transitivity is violated)
- "x and y are brothers" IS NOT an e.r. (reflexivity is violated)
- "x is mother of y" IS NOT an e.r. (symmetry is violated)
- "x and y were born in the same year" IS an e.r.
- "x and y's ages differ for at most one year" IS NOT an e.r. (transitivity is violated)