Operations with relations

Kapitoly: Session, Operations with relations, Binary Sessions, Binary relations on a set, Equivalence relations, Session ordering, Associations

Because relations are actually sets, we can perform classical set operations on them.

Set operations

In the previous article, we defined a session as a set. We can perform operations such as union, intersection, or difference with sets. Let's see what the meaning of this is in the case of relations.

The first thing we need to do is to introduce a condition, because we cannot perform these operations between arbitrary sessions. If we have a "less than" and "being an even number" session, these operations won't make sense because the first session is binary whereas the second is unary. Thus, to get a session again after applying the set operation, all present sessions must have the same arity, i.e., they must all be n-ary for some n.

Unifying

Let us have a "less than" and an "equality" session. What happens if we unify these sessions? In the less-than session, we have all pairs [a, b], for which a < b holds. In the equality session, we have all pairs [a, b], for which a = b holds. Thus, in the < ∪ = session, there will be all pairs [a, b], for which a < b or a = b holds. The number a is either less than b or equal. We know of such a session and call it "less than or equal to" and denote it .

If we have the sessions R1 and R2, then the union produces the session R = R1 ∪ R2, for which the following holds: the element r is in the session R if it is in the session R1 or it is in the session R2. In other words, it will be in the resulting session if it was in at least one of the unified sessions.

Intersection

When we unified, we got a new session whose elements were elements of at least one of the unified sessions. For intersection, it is similar, only the elements must be members of both sessions.

If we again take a session less than and equality (over the real numbers) and do their intersection - what do we get? We should get elements that are both less than and equal in the session. But such a case can't happen, because if a < b, then a = b never holds. We would get an empty session.

Let us have these two sessions: a "divisibility without remainder" and a binary session containing pairs of elements [a, b], where a is an odd number and b is an even number. Let us work over the natural numbers. In the first session there would be pairs of numbers like [5, 15], [6, 30], [3, 123] - always the second number must be divisible by the first number. In the second session there would be pairs of numbers where the first number is odd and the second is even: [1, 4], [5, 14], [3, 24] etc. The intersection of these sessions will result in a new session R and will contain such pairs [a, b], for which b is divisible by a while a is odd and b is even. For example: [5, 30] or [3, 24].

The difference

If we have two sessions R1 and R2, then the difference R1 − R2 will create a new session that includes elements that are in R1, but not in R2. We can again return to the less than or equal and equality sessions. If the session R1 is less than or equal to and the session R2 is equality, then the difference R1 − R2 yields elements that are in the less than or equal to session but not in the equality session. So we get pairs of [a, b], for which a ≤ b holds and at the same time a = b does not hold. In other words, we get a less-than relation: <.

The complement of the session

For each session we can find a complement session. The elements of a complement session R are all elements that do not belong to the original session R. For example, the complement session to an equality session (i.e., = ) is an inequality session. In the first session we have all pairs of elements that are equal (e.g. 5 = 5), in the complement session we have all numbers that are not equal (e.g. 5≠6).

The only thing you need to be careful about when determining the complement of a session is the support set - the set to which the session belongs. We can define the equality relation on the natural numbers, the integers, the real numbers, or even on the set of all people on earth.

If we have a binary relation R such that it is of the sets M1 and M2: R ⊆ M1 × M2, then the complement of the relation, let us denote it S, is equal to S = (M1 × M2) ∖ R: these are the elements that are in the Cartesian product of the supporting sets but not in the relation R. Similarly for sessions of other arities.