ogposets.OgPoset

class rewalt.ogposets.OgPoset(face_data, coface_data, **params)

Bases: object

Class for oriented graded posets, that is, finite graded posets with an orientation, defined as a {'-', '+'}-labelling of the edges of their Hasse diagram.

In this implementation, the elements of a given dimension (grade) are linearly ordered, so that each element is identified by its dimension and the position in the linear order, encoded as an object of class El.

If El(n, k) covers El(n-1, j) with orientation o, we say that El(n-1, j) is an input face of El(n, k) if o == '-' and an output face of El(n, k) if o == '+'.

Defining an OgPoset directly is not recommended; use constructors of shapes.Shape instead.

Parameters
  • face_data (list[list[dict[set[int]]]]) – Data encoding the oriented graded poset as follows: j in face_data[n][k][o] if and only if El(n, k) covers El(n-1, j) with orientation o, where o == '-' or o == '+'.

  • coface_data (list[list[dict[set[int]]]]) – Data encoding the oriented graded poset as follows: j in coface_data[n][k][o] if and only if El(n+1, j) covers El(n, k) with orientation o, where o == '-' or o == '+'.

Keyword Arguments
  • wfcheck (bool) – Check that the data is well-formed (default is True)

  • matchcheck (bool) – Check that face_data and coface_data match (default is True)

Notes

Each of face_data, coface_data determines the other uniquely. There is an alternative constructor from_face_data() that computes coface_data from face_data.

Examples

Let us construct explicitly the “oriented face poset” of an arrow, or directed edge.

>>> face_data = [
...    [
...        {'-': set(), '+': set()},
...        {'-': set(), '+': set()},
...    ], [
...        {'-': {0}, '+': {1}}
...    ]]
>>> coface_data = [
...    [
...        {'-': {0}, '+': set()},
...        {'-': set(), '+': {0}},
...    ], [
...        {'-': set(), '+': set()}
...    ]]
>>> arrow = OgPoset(face_data, coface_data)

This has two 0-dimensional elements and one 1-dimensional element.

>>> arrow.size
[2, 1]

We can visualise its Hasse diagram, with orientation conveyed by colour (magenta for input, blue for output) and direction of arrows.

>>> arrow.hasse(path='docs/_static/img/OgPoset_arrow.png')
../_images/OgPoset_arrow.png

We can ask for the faces and cofaces of a specific element.

>>> arrow.faces(El(1, 0), '-')
GrSet(El(0, 0))
>>> arrow.cofaces(El(0, 1))
GrSet(El(1, 0))

We can construct other oriented graded posets using various operations, such as suspensions, Gray products, joins, or duals.

>>> print(arrow.suspend())
OgPoset with [2, 2, 1] elements
>>> print(arrow * arrow)
OgPoset with [4, 4, 1] elements
>>> print(arrow >> arrow)
OgPoset with [4, 6, 4, 1] elements
>>> print(arrow.dual())
OgPoset with [2, 1] elements

Methods

all()

Returns the closed subset of all elements.

bot()

Returns the object augmented with a bottom element, covered with orientation '+'.

boundary([sign, dim])

Returns the inclusion of the boundary of a given orientation and dimension into the object.

co()

Returns the dual() in all even dimensions.

cofaces(element[, sign])

Returns the cofaces of an element as a graded set.

coproduct(fst, snd)

Returns the coproduct cospan of two oriented graded posets.

disjoint_union(fst, snd)

Returns the disjoint union of two oriented graded posets, that is, the target of their coproduct cospan.

dual(ogp, *dims)

Returns an oriented graded poset with orientations reversed in given dimensions.

empty()

Returns the initial oriented graded poset, with no elements.

faces(element[, sign])

Returns the faces of an element as a graded set.

from_face_data(face_data, **params)

Alternative constructor computing coface_data from face_data.

gray(*ogps)

Returns the Gray product of any number of oriented graded posets.

hasse(**params)

Bound version of hasse.draw().

id()

Returns the identity map on the object.

image(ogmap)

Returns the image of the object through a map.

join(*ogps)

Returns the join of any number of oriented graded posets.

maximal()

Returns the subset of maximal elements, that is, those that are not covered by any elements.

none()

Returns the empty closed subset.

op()

Returns the dual() in all odd dimensions.

point()

Returns the terminal oriented graded poset, with a single element.

suspend(ogp[, n])

Returns the n-fold suspension of an oriented graded poset.

underset(*elements)

Returns the closure of a set of elements in the object.

Attributes

as_chain

Returns a "chain complex" representation of the face data.

coface_data

Returns the coface data as given to the object constructor.

dim

Returns the dimension of the object, that is, the maximum of the dimensions of its elements.

face_data

Returns the face data as given to the object constructor.

input

Alias for boundary('-').

output

Alias for boundary('+').

size

Returns the number of elements in each dimension as a list.

property face_data

Returns the face data as given to the object constructor.

An OgPoset is meant to be immutable; create a new object if you need to modify the face data.

Returns

face_data – The face data as given to the object constructor.

Return type

list[list[dict[set[int]]]]

property coface_data

Returns the coface data as given to the object constructor.

An OgPoset is meant to be immutable; create a new object if you need to modify the coface data.

Returns

coface_data – The coface data as given to the object constructor.

Return type

list[list[dict[set[int]]]]

property size

Returns the number of elements in each dimension as a list.

Returns

size – The k th entry is the number of k -dimensional elements.

Return type

list[int]

property dim

Returns the dimension of the object, that is, the maximum of the dimensions of its elements.

Returns

dim – The dimension of the object.

Return type

int

property as_chain

Returns a “chain complex” representation of the face data.

Returns

chain – Encodes the face data as follows: chain[n][i][j] == 1 if El(n, i) is an output face of El(n+1, j), -1 if it is an input face, 0 otherwise.

Return type

list[numpy.array]

all()

Returns the closed subset of all elements.

Returns

all – The closed subset of all elements of the object.

Return type

Closed

none()

Returns the empty closed subset.

Returns

none – The closed subset with no elements.

Return type

Closed

underset(*elements)

Returns the closure of a set of elements in the object.

Parameters

elements (El) – Any number of elements.

Returns

underset – The downwards closure of the given elements.

Return type

Closed

maximal()

Returns the subset of maximal elements, that is, those that are not covered by any elements.

Returns

maximal – The subset of maximal elements.

Return type

GrSubset

faces(element, sign=None)

Returns the faces of an element as a graded set.

Parameters
  • element (El) – An element of the object.

  • sign (str, optional) – Orientation: '-' for input, '+' for output, None (default) for both.

Returns

faces – The set of faces of the given element.

Return type

GrSet

cofaces(element, sign=None)

Returns the cofaces of an element as a graded set.

Parameters
  • element (El) – An element of the object.

  • sign (str, optional) – Orientation: '-' for input, '+' for output, None (default) for both.

Returns

cofaces – The set of cofaces of the given element.

Return type

GrSet

id()

Returns the identity map on the object.

Returns

id – The identity map on the object.

Return type

OgMap

image(ogmap)

Returns the image of the object through a map.

Parameters

ogmap (OgMap) – A map from the object to another OgPoset.

Returns

image – The image of the object through the given map.

Return type

Closed

boundary(sign=None, dim=None)

Returns the inclusion of the boundary of a given orientation and dimension into the object.

Parameters
  • sign (str, optional) – Orientation: '-' for input, '+' for output, None (default) for both.

  • dim (int, optional) – Dimension of the boundary (default is self.dim - 1).

Returns

boundary – The inclusion of the requested boundary into the object.

Return type

OgMap

property input

Alias for boundary('-').

property output

Alias for boundary('+').

classmethod from_face_data(face_data, **params)

Alternative constructor computing coface_data from face_data.

Parameters

face_data (list[list[dict[set[int]]]]) – As in the main constructor.

Keyword Arguments

wfcheck (bool) – Check that the data is well-formed (default is True).

static empty()

Returns the initial oriented graded poset, with no elements.

Returns

empty – The empty oriented graded poset.

Return type

OgPoset

static point()

Returns the terminal oriented graded poset, with a single element.

Returns

point – The oriented graded poset with a single element.

Return type

OgPoset

static coproduct(fst, snd)

Returns the coproduct cospan of two oriented graded posets.

Parameters
  • fst (OgPoset) – The first factor of the coproduct.

  • snd (OgPoset) – The second factor of the coproduct.

Returns

coproduct – The coproduct cospan.

Return type

OgMapPair

static disjoint_union(fst, snd)

Returns the disjoint union of two oriented graded posets, that is, the target of their coproduct cospan.

This method can be called with the math operator +, that is, fst + snd is equivalent to disjoint_union(fst, snd).

Parameters
  • fst (OgPoset) – The first factor of the disjoint union.

  • snd (OgPoset) – The second factor of the disjoint union.

Returns

disjoint_union – The disjoint union of the two.

Return type

OgPoset

static suspend(ogp, n=1)

Returns the n-fold suspension of an oriented graded poset.

This static method can be also used as a bound method after an object is initialised, that is, ogp.suspend(n) is equivalent to suspend(ogp, n).

Parameters
  • ogp (OgPoset) – The object to suspend.

  • n (int, optional) – The number of iterations of the suspension (default is 1).

Returns

suspension – The suspended object.

Return type

OgPoset

static gray(*ogps)

Returns the Gray product of any number of oriented graded posets.

This method can be called with the math operator *, that is, fst * snd is equivalent to gray(fst, snd).

This static method can also be used as a bound method after an object is initialised, that is, fst.gray(*ogps) is equivalent to gray(fst, *ogps).

Parameters

*ogps (OgPoset) – Any number of oriented graded posets.

Returns

gray – The Gray product of the arguments.

Return type

OgPoset

bot()

Returns the object augmented with a bottom element, covered with orientation '+'.

Returns

bot – The object augmented with a bottom element.

Return type

OgPoset

static join(*ogps)

Returns the join of any number of oriented graded posets.

This method can be called with the shift operators >> and <<, that is, fst >> snd is equivalent to join(fst, snd) and fst << snd is equivalent to join(snd, fst).

This static method can also be used as a bound method after an object is initialised, that is, fst.join(*ogps) is equivalent to join(fst, *ogps).

Parameters

*ogps (OgPoset) – Any number of oriented graded posets.

Returns

join – The join of the arguments.

Return type

OgPoset

static dual(ogp, *dims)

Returns an oriented graded poset with orientations reversed in given dimensions.

The dual in all dimensions can also be called with the bit negation operator ~, that is, ~ogp is equivalent to ogp.dual().

This static method can be also used as a bound method after an object is initialised, that is, ogp.dual(*dims) is equivalent to dual(ogp, *dims).

Parameters
  • ogp (OgPoset) – An oriented graded poset.

  • *dims (int) – Any number of dimensions; if none, defaults to all dimensions.

Returns

dual – The oriented graded poset, dualised in the given dimensions.

Return type

OgPoset

op()

Returns the dual() in all odd dimensions.

co()

Returns the dual() in all even dimensions.

hasse(**params)

Bound version of hasse.draw().

Calling x.hasse(**params) is equivalent to calling hasse.draw(x, **params).