Subtyping

Statically typed programming languages often define a poset of types ordered by the subtyping relation; Scala is one such language. Consider the following Scala program.

A scala program with class inheritance

When a programmer defines a class hierarchy in an object-oriented language, they are actually defining a poset of types. The above program defines the simple poset shown in the following Hasse diagram.

Hasse diagram for the nominal subtyping relation defined by the above program

Now consider the expression if (b) dog else cat. If b is true, then it evaluates to a value of type Dog. If b is false, then it evaluates to a value of type Cat. What type, then, should if (b) dog else cat have? Its type should be the join of Dog and Cat, which is Animal.

Power sets

Let be a set. Consider the poset , the power set of ordered by inclusion. In this poset, joins are unions: for all , . This can be shown as follows. Let . Then is an upper bound of because a union contains each of its constituent sets. Furthermore, is the least upper bound of . For let be an upper bound of . Then implies for some , and since , we have . Since implies , we have . Hence, .

Divisibility

Consider the poset of divisibility on the positive integers. In this poset, the upper bounds of an integer are exactly its multiples. Thus, the join of a set of positive integers in is their least common multiple. Dually, the meet of a set of positive integers in is their greatest common divisor.