Information --- Staff --- Homework --- Reading/Lecture note --- Newsgroup --- Feedback
Reading: 7.1, 7.3(digraphs), 7.5.

Relations

As mentioned during logic and interpretations:
a Relation is just a subset of (tuples of) the domain.
For instance, the binary relations "likes(.,.)",
"hasCoStarredWith(.,.)", ≥.
Or unary relations like safe?(.), has3?(.).

Binary relations are particularly interesting:
Consider domain {Ian,Gillis,Leebron}
and the relation hasHeardOf(.,.).
We can show this particular relation as a list:
    hasHeardOf = { ,     ,  
                   ,  } 

We can also give a pictorial relation:
- for each element of domain, draw a node ("vertex");
- if a is related to b, draw a directed arrow ("edge") from a to b.
This is called  "directed graph", or sometimes just "digraph".

Graphs can be considered equivalent to listing a particular relation.
But they're common in their own right:
  Def'n: A Graph G is a tuple ⟨V,E⟩ where V is a set of vertices,
         and E ⊆ V×V is a set of directed edges.
Note that a graph is *not* tied to one particular way of drawing;
you can move edges (and stretch incident edges) around in the picture,
change whether edges are drawn crossing over other edges, etc,
and it's still the same graph.
  (We refer to the *embedding* of a graph, if the geometry is important.)

Draw the graphs of some particular relations:
  K_n: the domain of n nodes, where everything is related (including self).
       "The complete graph".
  The discrete graph: nothing related to anything else.
  Equality: things related exactly to themselves.
  Subset-of, on domain P({1,2,3}).
  thinks-is-cute on domain of people.

Properties of Binary Relations:
For each of the following properties, 
 * characterize what the property means in terms of the graph;
 * examples: do equality, thinksIsCute, subset-of have the property?

Def'n: A binary relation R(.,.)  on domain D is...
  - Reflexive: forall d in D, R(d,d).
  - Symmetric: forall d1,d2 in D, R(d1,d2) → R(d2,d1).
        [Do we need to make this iff?]
  - Antisymmetric:  forall d1,d2 in D  (R(d1,d2) ^ R(d2,d1) → (d1==d2)).
       That is, it's not symmetric *anywhere*, with the
       possible exception of self-loops.
       [Reminiscent terminology: 
        Some cities have timed traffic lights:
           passing through one light means that you'll make the next one.
        Some cities have untimed lights: 
           passing through one light may or may not mean you'll make the next.
        Houston seems to have antitimed lights:
           passing through one light guarantees you'll miss the next one.]
   - Transitive:  forall a,b,c in D,  R(a,b)^R(b,c) → R(a,c).

There is a special term for relations which are
  reflexive and symmetric and transitive:  "Equivalence relation".
  Which of the examples above are equivalence relations?
  Some other examples: has-same-zipcode-as(.,.), has-same-zodiac-sign(.,.)
          [Okay, we realize we're perhaps glossing over foreigners,
           homeless, dual residences, people whose birth spanned a cusp,
           and haven't fully specified how the relations work in those cases.]



An equivalence relation *partitions* the domain
into *equivalence classes*.

Def'n: equivalence class:
The equivalence class of a under relation R = { b in domain | R(a,b) }

Def'n: partition [finite]: a set of sets {A1,A2,...,An}
   - everything is in at least one set: 
     ∪i ∈ {1,...n} Ai = domain.
   - everything is in at most  one set:	
     forall 1 ≤ i < j ≤n, Ai ∩ Aj = ∅.
[Alternately, these conditions can be defined closer to the English,
  and then we could prove they're equivalent.]
We can easily extend this to allow infinite partitions:
   a set A* of sets, such that Union_{a in A*} a = domain,
   and forall a,b in A*, a1 ≠ a2  →  a1 ∩ a2 = ∅.

Equivalence relations are interesting because one can create a new
domain whose elements are *just* the original equivalence classes;
it's a way of boosting a relation into its version equality.
Example we'll see later: the relation "remainder upon dividing by 7"
partitions the integers into 7 equivalence classes.
The set Z/7 ("Z mod 7") is a new set with 7 elements.

Information --- Staff --- Homework --- Reading/Lecture note --- Newsgroup --- Feedback

Comp280 Home Please notify us of any broken links, etc. Last modified 2004.Feb.19.