Macaulay2 » Documentation
Packages » Posets :: compare
next | previous | forward | backward | up | index | toc

# compare -- compares two elements in a poset

- Usage:
    `r = compare(P, a, b)`
- Inputs:
  - P, an instance of the type Poset,
  - a, a thing, an element of the poset
  - b, a thing, an element of the poset
- Outputs:
  - r, a Boolean value, whether $a \leq b$ in $P$

## Description

This method determines if two elements are comparable and further if $a$ is less than or equal to $b$ in $P$.

    i1 : P = poset {{a,b},{a,c}};

    i2 : compare(P, a, b)

    o2 = true

    i3 : compare(P, c, a)

    o3 = false

If two elements are incomparable, then the result is false.

    i4 : compare(P, b, c)

    o4 = false

## Ways to use compare:

- `compare(Poset,Thing,Thing)`

## For the programmer

The object compare is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Posets.m2:4244:0.