Objective

To use the data structure called set

We are going to create a type to store relations on a set A={a1,a2,a3,a4,a5}

The relation will be represented as a subset of AXA

Every element of the set will be a pair of the type (ai,aj)

The set requires three things from the pair type

a function mapping from a pair to an integer

a function mapping from an integer to a pair

Look at as6.cpp:

we have defined an element type as enumerated

a pair type as a pair of elements

we have established mapping from integer to pair using the constructor

we have established mapping from pair to integer using a type casting operator: operator int()

The last thing we need in an output operator for pair

two stages

wrote an output operator to output an element

wrote an output operator to output a pair

Now we can create relation as a set of pairs

We are supposed to write functions to determine if the relation is:

reflexive (done)

symmetric (done)

antisymmetric

transitive

write another function that inputs a relation as a list of integers (or hard code the relation), check to see if the relation is equivalence (reflexive,symmetric,transitive) and partial order (reflexive,antisymmetric,transitive).