Relations

#folder

Tuples

Definition

A tuple is an ordered list of items. A tuple with two items is called a pair, and a tuple with three items is called a triple.

Cartesian Product

Definition

The Cartesian product of two sets and , denoted (or ) is the set of all ordered pairs where and .

(see set builder notation)

More generally, the Cartesian product of sets , denoted is the set of all tuples where for every .

Axiom - Cartesian Product
Example

Relations

Definition

In the most general form, a relation over sets may or may not hold between respective members of each set.

Formally, a relation over sets is a set of tuples of length , where every . This set of tuples is a subset of the Cartesian product of every set: .

We say holds for values (where ) if and only if the tuple .

A unary relation is a relation over 1 set.

A binary relation is a relation over 2 sets. An example would be . We will almost always concern ourselves only with binary relations.

A ternary relation is a relation over 3 sets. An example would be if three points are collinear, or congruency. However, we usually treat congruency as a binary relation, holding the modulo constant.

A finitary relation is a relation over a finite number of sets.

Note that number of sets does not refer to number of distinct sets. That is to say, we may have a binary relation over and .

Binary Relations

Definition

A binary relation over two sets may or may not hold between respective members of each set.

Formally, a relation between two sets and is a set of ordered pairs. This set of pairs is a subset of the Cartesian product of and : , and it follows that (power set).

We say holds for values (where ) if and only if , and we write .

We assign special symbols to certain binary relations, such as

Also see Properties of Binary Relations

Example

The relation "equals" over would be set:

and we say two numbers are equal (, ) if and only if

The relation "less than or equal to" over would be the set:

and we say two numbers are less than or equal to each other (, ) if and only if .

This extreme formalization is useful for understanding further sections IMO.

Example

An example to show that and :

Example

Given sets:

some example relations are:

Example

All the predicate/functions on sets can be applied to relations

  1. The relation from people to cars in which the people fix cars of a model they own (term)
  2. The relation form people to cars in which the people fix cars that they do not own (term)
  3. Everyone who fixes a car owns one of that car (WFF)

Homogeneous Binary Relation

Definition

A homogeneous binary relation is a special case of a heterogeneous binary relation (which we just called "binary relation"). Instead of the relation being over two sets and , we have and the relation is only over one distinct set.

Domain, Range

Definition

For a binary relation, the domain is all the first elements in the pairs of the relation. The range is all the second elements in the pairs of the relation.

Axiom - Domain

For the relation

Axiom - Range

For the relation

Examples

  1. People who own cars
  2. Cars of people who both own and fix the car
  3. Everyone who fixes a car fixes a car fixes at least one car that they don't own

\op{dom}(\text{fix}) & \subseteq \op{dom}(\text{fix} - \text{own}) \
\op{dom}(\text{fix}) & = \op{dom}(\text{fix} - \text{own}) \
\end

Example

Properties

For two relations and :

Domain properties:

Range properties (nearly identical):

Inverse Relation

Definition

For a binary relation , its inverse relation is the relation created by reversing the order of elements of the pairs of , and we write

Intuition

Think about inverse functions. We switch the and around, which is just switching the domain and range.

Axiom - Inverse

Properties

Pretty self evident

Identity Relation

Definition

The identity relation over a set , is a unary relation written as , which is the paring of every element in with itself.

Axiom - Identity

Example

Relational Composition

Definition

For three sets , , and , and two binary relations on them: and , the relational composition of and is the relation containing the pairs , such that there is a , and and , and we say " followed by ", written as .

Axiom - Relational Composition

Intuition

Think about function composition: . Using our notation we would write , which is backwards, but it is "g followed by f", where we are applying first and then after.

Example

Example

Properties

For , , :

  1. Assosiative:
  2. Inverse distributive:
  3. Domain identity:
  4. Range identity:
  5. Identity: ,
Example for (3)

I was confused about why it was a subset. Given , show that is not valid.

Domains:

Syntax Meaning

Relational Image

Definition

For sets where , and relation , the relational image of through denoted by is the set of elements that are in the second element of a pair in whose first elements are in .

Intuition

Think about this almost like indexing a hashmap/dictionary.

Axiom - Relational Image

Example

Properties

Restrictions and Subtractions

For and ,

Definition

Domain restriction retains only the pairs whose first elements are part of a set.
Range restriction retains only the pairs whose second elements are part of a set.
Domain subtraction retains the pairs whose first elements are not part of a set.
Range subtraction retains the pairs whose second elements are not part of a set.

Axiom - Domain Restriction

Axiom - Range Restriction

Axiom - Domain Subtraction

Axiom - Range Subtraction

Example

Properties

For and :

Relational Overriding

Definition

Relational overriding allows us to "update" a relation with another relation where the pairs of are added to the relation and any pairs in with the same element of pairs in are eliminated.

Axiom - Relational Overriding

For , :

Example

Properties

For :

  1. Idempotent:
  2. Associative: