next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Posets :: poset

poset -- creating a poset

Synopsis

Description

This function allows one to create 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 defining list given is distinct, and operates by taking the transitive and reflexive closure of the relations that it is given. 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 = Poset{cache => CacheTable{}                }
           GroundSet => {a, b, c, d}
           RelationMatrix => | 1 1 1 1 |
                             | 0 1 0 0 |
                             | 0 0 1 1 |
                             | 0 0 0 1 |
           Relations => {(a, b), (a, c), (c, d)}

o3 : Poset
Sometimes in finding "enough" relations one inadverdently finds all of the relations in the poset. In this case, the user can bypass having the function poset calculate the transitive closure of the relations by entering the matrix encoding the relations in when calling the poset function. In this scenario, the function does not check that the resulting object is actually a poset because in order to do this, the function needs to compute the transitive closure of the relations and check that this matches the matrix given. The purpose of entering a matrix is to bypass that computation.
i4 : S = QQ[x,y,z];
i5 : G = {x^2, x*y, z^2, x^2*y*z, x*y*z^3, x^2*y^2*z^3};
i6 : R = select((flatten apply (G, g-> apply (G, h-> if h % g == 0 then (g,h)))), i -> i =!= null) -- finds all pairs where g divides h

        2   2     2   2        2   2 2 3                      2           
o6 = {(x , x ), (x , x y*z), (x , x y z ), (x*y, x*y), (x*y, x y*z), (x*y,
     ------------------------------------------------------------------------
          3          2 2 3     2   2     2       3     2   2 2 3     2    
     x*y*z ), (x*y, x y z ), (z , z ), (z , x*y*z ), (z , x y z ), (x y*z,
     ------------------------------------------------------------------------
      2        2      2 2 3         3       3         3   2 2 3     2 2 3 
     x y*z), (x y*z, x y z ), (x*y*z , x*y*z ), (x*y*z , x y z ), (x y z ,
     ------------------------------------------------------------------------
      2 2 3
     x y z )}

o6 : List
i7 : M = matrix apply (G, g-> apply (G, h-> if h % g == 0 then 1 else 0))

o7 = | 1 0 0 1 0 1 |
     | 0 1 0 1 1 1 |
     | 0 0 1 0 1 1 |
     | 0 0 0 1 0 1 |
     | 0 0 0 0 1 1 |
     | 0 0 0 0 0 1 |

              6        6
o7 : Matrix ZZ  <--- ZZ
i8 : P = poset(G,R,M)

o8 = Poset{cache => CacheTable{}                                                                                                                                                                                                                  }
                          2        2   2          3   2 2 3
           GroundSet => {x , x*y, z , x y*z, x*y*z , x y z }
           RelationMatrix => | 1 0 0 1 0 1 |
                             | 0 1 0 1 1 1 |
                             | 0 0 1 0 1 1 |
                             | 0 0 0 1 0 1 |
                             | 0 0 0 0 1 1 |
                             | 0 0 0 0 0 1 |
                           2   2     2   2        2   2 2 3                      2                 3          2 2 3     2   2     2       3     2   2 2 3     2      2        2      2 2 3         3       3         3   2 2 3     2 2 3   2 2 3
           Relations => {(x , x ), (x , x y*z), (x , x y z ), (x*y, x*y), (x*y, x y*z), (x*y, x*y*z ), (x*y, x y z ), (z , z ), (z , x*y*z ), (z , x y z ), (x y*z, x y*z), (x y*z, x y z ), (x*y*z , x*y*z ), (x*y*z , x y z ), (x y z , x y z )}

o8 : Poset

See also

Ways to use poset :