# fournew - Four Relations and Functions Set theory provides...

This preview shows pages 1–4. Sign up to view the full content.

Four. Relations and Functions Set theory provides a formal foundation for studying objects that are interesting and useful in computer applications. When objects of several sets are related, we use more complex sets called relations and functions to model their relationships. For example, the student body and the academic departments in a college are related through the “Majors” relationship, relating each student to the student’s current major(s). In another example, the set of students and the set of classes offered in a given semester, are related based on the classes taken by each student. In this chapter, we will first study the formal definitions and properties of relations. We will then study a restricted type of relations known as functions. 4.1. Relations 4.1.1. Notations and Definitions Definition. A relation R defined over sets A and B is a (i.e. any) subset of A × B , that is, R A × B . Such a relation is a binary relation; the degree of R is 2. For each element ( a , b ) R of a binary relation R , we also write it as aRb . Example. Let A = {Adam, John, Smith} be a set of students and B = {Art, History, mathematics} be a set of departments. A relation, Student-major , showing the students and their major(s) could be Student-major = {(Adam, History), (Adam, Mathematics), (John, Art), (Smith, History)}. 4-1, © Dr. S. Lang

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A binary relation R can be conveniently depicted by a directed graph, in which each pair ( a , b ) R corresponds to a directed edge from vertex a to vertex b . Example. The following digraph represents the Student-major relation defined in the preceding example (p. 2-1). More generally, A relation can be defined over n sets, n 2. Definition. An n -ary relation R over sets A 1 , A 2 , …, A n , n 2, is a subset of the cartesian product , that is, R . The degree of R is n . Example. Consider the purchase of a new car, which frequently involves a buyer, a salesperson, a new car, and a trade-in. Thus, a car purchase is a relation of degree 4, because it can be considered as a subset of B × S × N × T , where B , S , N , and T stand for, respectively, the sets of buyers, salespersons, new cars, and trade-ins. Adam John Smith Art History Mathematics = n i i A 1 = n i i A 1 4-2, © Dr. S. Lang
We note here that a (finite) relation of any degree n can be conveniently represented by a (two-dimensional) table of n columns, in which the rows of the table represent the tuples of the relation. For example, a car sales table as described by the preceding example could be depicted as follows: In fact, the now popular relational database systems have their origin rooted in the theories and properties of relations as studied in set theory, supplemented with implementation techniques. 4.1.2. Properties and Manipulations of Binary Relations Binary relations receive the most thorough studies because their simplicity, and because that they form the basis for studying relations of higher degrees. We will consider the following definitions and notations for binary relations.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 30

fournew - Four Relations and Functions Set theory provides...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online