Partial and Total orders

Due by Fri, 13 Sep 2019

Recall that a relation $R$ on a set $S$ is a subset of $S\times S$. We have defined reflexive, symmetric and transitive relations. Using these we defined equivalence relations. In this exercise we consider another important class of relations, partial orders. We begin with some definitions. Fix a relation $R$ on a set $S$. In the following, it is helpful to think of $(a, b)\in R$ as $a \leq b$.

Implement the following in a programming language of your choice. If you use scala you can use the code from the lectures (by copy-paste).

  1. Define a function to check whether a relation $R$ is anti-symmetric.
  2. Define a function to check whether a relation $R$ is a partial order.
  3. Define a function to check whether a relation $R$ is a total order.
  4. On the set $S=\{2, 3, 4,\dots, 20\}$, construct sets $R$ corresponding to the following relations:
    1. $(a, b)\in R$ if and only if $a - b$ is even.
    2. $(a, b)\in R$ if and only if $a \leq b$.
    3. $(a, b)\in R$ if and only if $a | b$ (i.e., $a$ is a divisor of $b$).
  5. Using the functions you defined, check whether each of the above relations are partial orders.
  6. Using the functions you defined, check whether each of the above relations are total orders.
  7. Define a function that given a relation $R$ that is a total order, finds that the (unique) minimum with respect to $R$.
  8. Use this function to find the minimum for the total order among the relations you defined above.
  9. Define a function that given a relation $R$ on a set $S$ such that $R$ is a partial order, finds all elements $a\in S$ such that $a$ is a minimum with respect to $R$.
  10. Use this function to find all the minima for the partial orders among the three relations you defined above.

All assignments