tusc.posets.poset

class posets.poset.Poset(coverage_list=None, coverage_dict=None)

Class for handling finite posets, representing them as dicts.

Methods

all_elements()

Returns all the elements of the poset.

all_intervals()

Returns a list of all interval bounds (i, j), i leq j, in the poset.

get_one()

Returns the hat{1} of the poset, if it exists.

get_zero()

Returns the hat{0} of the poset, if it exists.

interval(lower, upper[, with_upper])

Returns all items in the interval [lower, upper]

interval_len(lower, upper[, l])

Returns the length of an interval.

is_Eulerian()

Verifies if the poset is Eulerian, assuming it is graded.

is_greaterthan(a, b)

Evaluates if a geq b in the poset.

is_lessthan(a, b)

Evaluates if a leq b in the poset.

is_semi_Eulerian()

Verifies if the poset is semi-Eulerian, assuming it is graded.

mobius(lower, upper)

Evaluates the Mobius function mu(lower, upper) for the poset.

all_elements()

Returns all the elements of the poset.

Returns

  • ~ output ~ (list) – list of all the elements of the poset

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.all_elements())

  • [‘2’, ‘123’, ‘3’, ‘12’, ‘1’, ‘_’, ‘23’, ‘13’]

all_intervals()

Returns a list of all interval bounds (i, j), i leq j, in the poset.

Returns

  • intervals (list) – list of tuples (i, j) representing interval bounds in the poset

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.all_intervals())

  • [(‘_’, ‘23’), (‘_’, ‘3’), (‘_’, ‘13’), (‘_’, ‘123’), (‘_’, ‘1’),

  • (‘_’, ‘12’), (‘_’, ‘2’), (‘23’, ‘123’), (‘3’, ‘23’), (‘3’, ‘13’),

  • (‘3’, ‘123’), (‘13’, ‘123’), (‘1’, ‘13’), (‘1’, ‘123’), (‘1’, ‘12’),

  • (‘12’, ‘123’), (‘2’, ‘23’), (‘2’, ‘123’), (‘2’, ‘12’)]

get_one()

Returns the hat{1} of the poset, if it exists.

Returns

  • i (str) – hat{1} of the poset

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.get_one())

  • 123

get_zero()

Returns the hat{0} of the poset, if it exists.

Returns

  • i (str) – hat{0} of the poset

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.get_zero())

  • _

interval(lower, upper, with_upper=False)

Returns all items in the interval [lower, upper]

Parameters
  • lower (str) –

  • upper (str) –

  • with_upper (bool) – describes whether to include upper in the returned list

Returns

  • ~ output ~ (list) – list of items in the interval

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.interval(“_”, “12”))

  • [‘_’, ‘1’, ‘2’]

interval_len(lower, upper, l=0)

Returns the length of an interval.

Parameters
  • lower (str) –

  • upper (str) –

Returns

  • ~ output ~ (int) – length of the interval

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.interval_len(“1”, “123”))

  • 2

is_Eulerian()

Verifies if the poset is Eulerian, assuming it is graded.

is_greaterthan(a, b)

Evaluates if a geq b in the poset.

Parameters
  • a (str) –

  • b (str) –

Returns

  • ~ output ~ (int) – truth value 1 or 0

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.is_greaterthan(“_”, “12”))

  • 0

is_lessthan(a, b)

Evaluates if a leq b in the poset.

Parameters
  • a (str) –

  • b (str) –

Returns

  • ~ output ~ (int) – truth value 1 or 0

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.is_lessthan(“_”, “12”))

  • 1

is_semi_Eulerian()

Verifies if the poset is semi-Eulerian, assuming it is graded.

mobius(lower, upper)

Evaluates the Mobius function mu(lower, upper) for the poset.

Parameters
  • lower (str) –

  • upper (str) –

Returns

  • ~ output ~ (int) – value of the Mobius function

  • Example Usage

  • ————-

  • >>> p = poset.Poset(coverage)

  • >>> print(p.mobius(“_”, “123”))

  • -1