arrow-left

All pages
gitbookPowered by GitBook
1 of 4

Loading...

Loading...

Loading...

Loading...

Primitive terms in set theory

hashtag
Relations

When a relation is used in a term, it stands for the set of pairs it contains at the moment it is evaluated. That set (also referred to as the contents of the relation) can change over time as users add or delete pairs from it.

When a relation is used in a term, we can simply use its name if that is unambiguous. For instance the name owner refers to RELATION owner[Person*Building] if that is the only relation the ampersand-compiler can link it to. In some cases, however the name alone is ambiguous. For example if there are two relations with the same name and different signatures. In such cases Ampersand will try to infer the type from the context. That however does not always succeed. In such cases, Ampersand generates an error message that asks you to remove the ambiguity by adding the correct type.

If a pair is an element of a relation , we write . Alternatively we may write .

hashtag
Identity

For every concept , the term represents the identity relation. It is defined by:

The type of is . In Ampersand code you write I[C].

hashtag
Complete relation

For every pair of concepts and the term represents the complete relation. It is defined by:

The type of is . In Ampersand code you write V[A*B].

hashtag
Other explanation

Would you like a different explanation of the primitive terms? explains the primitive terms in logic. for the explanation of primitive terms in natural language.

(a,b)(a,b)(a,b)
rrr
(a,b)∈r(a,b)\in r(a,b)∈r
a r ba\ r\ ba r b
CCC
I[C]I_{[C]}I[C]​
I[C] = {(c,c)∣ c∈C}I_{[C]}\ =\ \{(c,c) |\ c\in C\}I[C]​ = {(c,c)∣ c∈C}
I[C]I_{[C]}I[C]​
[C∗C][C*C][C∗C]
AAA
BBB
V[A∗B]V_{[A*B]}V[A∗B]​
V[A∗B] = {(a,b)∣ a∈A ∧ b∈B}V_{[A*B]}\ =\ \{(a,b) |\ a\in A\ \wedge\ b\in B\}V[A∗B]​ = {(a,b)∣ a∈A ∧ b∈B}
V[A∗B]V_{[A*B]}V[A∗B]​
[A∗B][A*B][A∗B]
This page
Click here

Semantics in sets

Relational operators in set theory

hashtag
Purpose of relational operators

To say things such as "the name of the owner", we want to string together multiple relations (viz. name and owner). Relational operators allow us to make such statements.

hashtag
Converse

A relation that contains pairs of the form can be altered by swapping the elements of every pair in the relation. Mathematically, is a different from . This operation is called the converse operator. It produces a new relation from an existing one. It is denoted by writing (pronounced 'wok' or ’flip’) after the relation name. This is how converse is defined:

If has type , then has type .

hashtag
Composition

The composition operator is denoted by a semicolon ; between two terms. It is pronounced as 'composed with', in this case: composed with .

The composition operation is defined as follows: Let and be two relations, with the target of r being the same as the source of s. Then the composition of and , is a relation with signature

hashtag
Other explanation

Would you like a different explanation of the relational operators? explains the relational operators in logic. explains them in natural language. for some algebraic rules about relational operators.

Boolean operators in set theory

A relation is by definition a subset of the Cartesian Product of the source and target sets. So, if two different relations r and s are defined on the same source A and target B, then the ordinary set operators can be applied to produce a new relation.

  • intersection : is the set that contains the elements that are contained in relation as well as in , or

  • union : is the set that contains all elements that are contained either in relation

or in
, or
  • difference : r−sr - sr−s is the set that contains the elements of relation rrr that are not contained in sss, or r−s = {(x,y) ∣ (x,y)∈r∧(x,y)∉s}r - s\ =\ \{ (x,y)\ |\ (x,y) ∈ r ∧ (x,y) ∉ s \}r−s = {(x,y) ∣ (x,y)∈r∧(x,y)∈/s}

  • The complement (or negation) of a relation r[AxB]r_{[A x B]}r[AxB]​ is defined by means of the difference operator:

    • complement : If rrr is defined as rA×Br_{A\times B}rA×B​, then r‾\overline{r}r is the set of all tuples in A×BA\times BA×B (the Cartesian product) that are not contained in rrr. So r‾=V[A×B]−r\overline{r} = V_{[A\times B]} - rr=V[A×B]​−r

    Note that the complement is defined in terms of AAA and BBB. So, two relations with the identical population yet a different type may have different complements.

    hashtag
    How to type boolean operators in your script

    This page shows how you can write these things in your Ampersand script.

    hashtag
    Other explanation

    Would you like a different explanation of the boolean operators? This page explains the boolean operators in logic.

    r∩sr ∩ sr∩s
    rrr
    sss
    r∩s = {(x,y) ∣ (x,y)∈r∧(x,y)∈s}r ∩ s\ =\ \{ (x,y)\ |\ (x,y) ∈ r ∧ (x,y) ∈ s \}r∩s = {(x,y) ∣ (x,y)∈r∧(x,y)∈s}
    r∪sr ∪ sr∪s
    rrr
    sss
    r∪s = {(x,y) ∣ (x,y)∈r∨(x,y)∈s}r ∪ s\ =\ \{ (x,y)\ |\ (x,y) ∈ r ∨ (x,y) ∈ s \}r∪s = {(x,y) ∣ (x,y)∈r∨(x,y)∈s}
    (a,b)(a, b)(a,b)
    (a,b)(a, b)(a,b)
    (b,a)(b,a)(b,a)
    \smallsmile\
    r⌣ = {(b,a)∣(a,b)∈r}r\smallsmile\ =\ \{ (b, a) | (a, b)∈r \}r⌣ = {(b,a)∣(a,b)∈r}
    rrr
    [A×B][A\times B][A×B]
    r\smallsmile\
    [B×A][B\times A][B×A]
    rrr
    sss
    r[A×B]r_{[A\times B]}r[A×B]​
    s[B×C]s_{[B\times C]}s[B×C]​
    rrr
    sss
    (r;s)[A×C] = {(a,c)∣∃b∈B ∙ a r b∧b s c}(r;s)_{[A\times C]}\ =\ \{ (a, c) | ∃ b∈B\ ∙\ a\ r\ b ∧ b\ s\ c \}(r;s)[A×C]​ = {(a,c)∣∃b∈B ∙ a r b∧b s c}
    This page
    This page
    Click here