Poset test and Hasse diagram in GAP.

207 Views Asked by At

Given a finite set $X=\{x_1,...,x_r\}$ with a function $f: X \times X \rightarrow \mathbb{Z}$ on it, define a relation on it by $m \geq n$ iff $(m=n$ or $f(m,n)>0)$. Now for every element $m \in X$, I can calculate the list $[f(m,x_1),f(m,x_2),...,f(m,x_r)]$. From this information I want to check wheter the relation defines a poset (that is, wheter it is transitive) and get the corresponding Hasse diagram (see https://en.wikipedia.org/wiki/Hasse_diagram ) for the definition. The Hasse diagram may be given by lists showing which elements have to be connected.

Is there an easy way to do this using a programm like GAP or SAGE?

I give a concrete example with a set $X$ with 16 Elements. Here the 16 lists:

[ 0, -8, -7, -7, -8, -8, -10, -12, -10, -12, -13, -10, -12, -14, -15, -14 ]

[ 8, 0, 0, 1, 3, -4, -5, -7, -4, -6, -4, -6, -8, -10, -8, -10 ]

[ 7, 0, 0, 0, 1, -7, -7, -8, -7, -8, -7, -8, -11, -12, -11, -12 ]

[ 7, -1, 0, 0, 0, -6, -7, -8, -7, -8, -8, -10, -12, -13, -13, -14 ]

[ 8, -3, -1, 0, 0, -6, -7, -9, -6, -8, -8, -8, -11, -13, -13, -15 ]

[ 8, 4, 7, 6, 6, 0, 0, 1, -1, 0, 0, -4, -7, -6, -6, -8 ]

[ 10, 5, 7, 7, 7, 0, 0, 0, 0, 0, 0, -5, -7, -7, -7, -10 ]

[ 12, 7, 8, 8, 9, -1, 0, 0, 0, 0, 1, -4, -7, -7, -6, -10 ]

[ 10, 4, 7, 7, 6, 1, 0, 0, 0, 0, -1, -7, -8, -8, -9, -12 ]

[ 12, 6, 8, 8, 8, 0, 0, 0, 0, 0, 0, -6, -8, -8, -8, -12 ]

[ 13, 4, 7, 8, 8, 0, 0, -1, 1, 0, 0, -4, -7, -8, -8, -13 ]

[ 10, 6, 8, 10, 8, 4, 5, 4, 7, 6, 4, 0, 0, -1, -3, -8 ]

[ 12, 8, 11, 12, 11, 7, 7, 7, 8, 8, 7, 0, 0, 0, -1, -7 ]

[ 14, 10, 12, 13, 13, 6, 7, 7, 8, 8, 8, 1, 0, 0, 0, -7 ]

[ 15, 8, 11, 13, 13, 6, 7, 6, 9, 8, 8, 3, 1, 0, 0, -8 ]

[ 14, 10, 12, 14, 15, 8, 10, 10, 12, 12, 13, 8, 7, 7, 8, 0 ]

So the input should be the list of lists and the output should be the hasse diagram in case it is a poset and the answer NO in case it is not.

The question seems natural so maybe there is a program which can do that already maybe even with a picture output?

One might also ask like that: Given the set $X$ with $r$ elements and the function $f$, build the $r \times r$ matrix with the lists as above as rows. Input is this matrix and output the matrix with entries 1,0,-1 which gives the Hasse diagram or NO if its not a poset.