# poset -- creates a new Poset object

## Synopsis

• Usage:
P = poset R
P = poset(G, cmp)
P = poset(G, R)
P = poset(G, R, M)
• Inputs:
• G, a list, elements in the ground set of $P$
• R, a list, pairs {$a,b$} which indicate that $a \leq b$
• M, , with entries $(i,j)$ equal to 1 if $G_j \leq G_i$ and 0 otherwise
• cmp, , a binary function such that $cmp(G_i, G_j)$ is true if and only if $G_i \leq G_j$ in the partial order
• Optional inputs:
• AntisymmetryStrategy => , default value rank, either "digraph", "none", or "rank"
• Outputs:
• P, an instance of the type Poset,

## Description

This method creates a Poset by defining the set and giving the order relations between the elements in the set. The function assumes that each element in the ground set $G$ is distinct and operates by taking the transitive and reflexive closure of the relations in $R$. The function returns an error if the input relations are incompatible with creating a poset.

 i1 : G = {a,b,c,d}; i2 : R = {{a,b}, {a,c}, {c,d}}; i3 : P = poset(G, R) o3 = P o3 : Poset

It is unnecessary to pass the ground set if every vertex of the poset is a member of at least one relation in $R$.

 i4 : poset {{1,2},{2,3},{3,4}} o4 = Relation Matrix: | 1 1 1 1 | | 0 1 1 1 | | 0 0 1 1 | | 0 0 0 1 | o4 : Poset

Sometimes it is easier to create a poset by passing the ground set and a binary function which compares elements in the ground set.

 i5 : cmp = (a,b) -> b % a == 0; i6 : G = toList(1..10); i7 : P = poset(G, cmp) o7 = P o7 : Poset

And, in other cases, it may be easy to find all relations in the poset. In this case, if the matrix encoding all the relations is passed to the poset method, then it is not necessary to compute the transitive closure. However, it should be noted that the method makes no checks on either the relations or the matrix in this case.

 i8 : S = QQ[x,y,z]; i9 : G = {x^2, x*y, z^2, x^2*y*z, x*y*z^3, x^2*y^2*z^3}; i10 : R = flatten for g in G list for h in G list if h %g == 0 then {g,h} else continue; i11 : M = matrix apply(G, g -> apply(G, h -> if h %g == 0 then 1 else 0)); 6 6 o11 : Matrix ZZ <--- ZZ i12 : P = poset(G, R, M) o12 = P o12 : Poset

In the previous example the vertices of the poset were RingElements. In fact, the Posets package does not require the vertices to be of any particular type. However, this also means when the package makes calls to external methods, it sometimes must relabel the vertices (usually to the index of the vertex in $G$).

The option AntisymmetryStrategy determines how the method checks the input relations for antisymmetry (a necessary condition for a poset). The default, "rank", checks that the RelationMatrix has maximal rank. The choice "digraph" uses the isCyclic method on the Digraph of the given relations. Last, the choice "none" skips the check all together.

## Caveat

Care should be taken when using the AntisymmetryStrategy option. If "none" is specified but the relations are cyclic, then the returned Poset will not actually be a Poset. In this case, the behavior of the package is unknown.