ogposets.OgMap

class rewalt.ogposets.OgMap(source, target, mapping=None, **params)

Bases: object

Class for (partial) maps of oriented graded posets, compatible with boundaries.

To define a map on one element, it must have been defined on all elements below it. The assignment can be made all at once, or element by element. Once the map has been defined on an element, the assignment cannot be modified.

Parameters
  • source (OgPoset) – The source (domain) of the map.

  • target (OgPoset) – The target (codomain) of the map.

  • mapping (list[list[El]], optional) – Data specifying the partial map as follows: mapping[n][k] == El(m, j) if the map sends El(n, k) to El(m, j), and None if the map is undefined on El(n, k) (default is the nowhere defined map).

Keyword Arguments

wfcheck (bool) – Check whether the data defines a well-formed map compatible with all boundaries (default is True).

Notes

Objects of the class are callable on objects of type El (returning the image of an element) and of type GrSubset and GrSet (returning the image of a subset of their source).

Examples

Let us create two simple oriented graded posets, the “point” and the “arrow”.

>>> point = OgPoset.point()
>>> arrow = point >> point

We define the map that collapses the arrow onto the point. First we create a nowhere defined map.

>>> collapse = OgMap(arrow, point)
>>> assert not collapse.istotal

We declare the assignment first on the 0-dimensional elements, then on the single 1-dimensional element. Trying to do otherwise results in a ValueError.

>>> collapse[El(0, 0)] = El(0, 0)
>>> collapse[El(0, 1)] = El(0, 0)
>>> collapse[El(1, 0)] = El(0, 0)

We can check various properties of the map.

>>> assert collapse.istotal
>>> assert collapse.issurjective
>>> assert not collapse.isinjective

Alternatively, we could have defined the map all at once, as follows.

>>> mapping = [[El(0, 0), El(0, 0)], [El(0, 0)]]
>>> assert collapse == OgMap(arrow, point, mapping)

Methods

bot()

Functorial extension of OgPoset.bot() to maps.

boundary([sign, dim])

Returns the map restricted to a specified boundary of its source.

co()

Returns the dual in all even dimensions.

dual(ogmap, *dims)

Functorial extension of OgPoset.dual() to maps of oriented graded posets.

gray(*maps)

Functorial extension of OgPoset.gray() to maps of oriented graded posets.

hasse(**params)

Bound version of hasse.draw().

image()

Returns the image of the map.

inv()

Returns the inverse of the map if it is an isomorphism.

isdefined(element)

Returns whether the map is defined on a given element.

join(*maps)

Functorial extension of OgPoset.join() to maps of oriented graded posets.

op()

Returns the dual in all odd dimensions.

then(other, *others)

Returns the composite with other maps or pairs of maps of oriented graded posets, when defined.

Attributes

input

Alias for boundary('-').

isinjective

Returns whether the map is injective.

isiso

Returns whether the map is an isomorphism, that is, total, injective, and surjective.

issurjective

Returns whether the map is surjective.

istotal

Returns whether the map is total.

mapping

Returns the data specifying the map's assignments.

output

Alias for boundary('+').

source

Returns the source (domain) of the map.

target

Returns the target (codomain) of the map.

property source

Returns the source (domain) of the map.

Returns

source – The source of the map.

Return type

OgPoset

property target

Returns the target (codomain) of the map.

Returns

target – The target of the map.

Return type

OgPoset

property mapping

Returns the data specifying the map’s assignments.

Returns

mapping – The mapping data.

Return type

list[list[El]]

property istotal

Returns whether the map is total.

Returns

istotalTrue if and only if the map is total.

Return type

bool

property isinjective

Returns whether the map is injective.

Returns

isinjectiveTrue if and only if the map is injective.

Return type

bool

property issurjective

Returns whether the map is surjective.

Returns

issurjectiveTrue if and only if the map is surjective.

Return type

bool

property isiso

Returns whether the map is an isomorphism, that is, total, injective, and surjective.

Returns

isisoTrue if and only if the map is an isomorphism.

Return type

bool

isdefined(element)

Returns whether the map is defined on a given element.

Parameters

element (El) – The element to check.

Returns

isdefinedTrue if and only if the map is defined on the element.

Return type

bool

then(other, *others)

Returns the composite with other maps or pairs of maps of oriented graded posets, when defined.

If given an OgMapPair as argument, it returns the pair of composites of the map with each map in the pair.

Parameters
  • other (OgMap | OgMapPair) – The first map or pair of maps to follow.

  • *others (OgMap | OgMapPair, optional) – Any number of other maps or pair of maps to follow.

Returns

composite – The composite with all the other arguments.

Return type

OgMap | OgMapPair

Notes

If all the maps have type shapes.ShapeMap, their composite has the same type.

inv()

Returns the inverse of the map if it is an isomorphism.

Returns

inv – The inverse of the map, if defined.

Return type

OgMap

Raises

ValueError – If the map is not an isomorphism.

image()

Returns the image of the map.

Returns

image – The image of the source through the map.

Return type

Closed

boundary(sign=None, dim=None)

Returns the map restricted to a specified boundary of its source.

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 map restricted to the requested boundary.

Return type

OgMap

property input

Alias for boundary('-').

property output

Alias for boundary('+').

bot()

Functorial extension of OgPoset.bot() to maps.

Returns

bot – The map extended to a map from source.bot to target.bot.

Return type

OgMap

static gray(*maps)

Functorial extension of OgPoset.gray() to maps 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, that is, fst.gray(*maps) is equivalent to gray(fst, *maps).

Parameters

*maps (OgMap) – Any number of maps of oriented graded posets.

Returns

gray – The Gray product of the arguments.

Return type

OgMap

Notes

If all the arguments have type shapes.ShapeMap, so does their Gray product.

static join(*maps)

Functorial extension of OgPoset.join() to maps 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, that is, fst.join(*maps) is equivalent to join(fst, *maps).

Parameters

*maps (OgMap) – Any number of maps of oriented graded posets.

Returns

join – The join of the arguments.

Return type

OgMap

Notes

If all the arguments have type shapes.ShapeMap, so does their join.

static dual(ogmap, *dims)

Functorial extension of OgPoset.dual() to maps of oriented graded posets.

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

This static method can be also used as a bound method, that is, self.dual(*dims) is equivalent to dual(self, *dims).

Parameters
  • ogmap (OgMap) – A map of oriented graded posets.

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

Returns

dual – The map dualised in the given dimensions.

Return type

OgMap

Notes

If the map is a ShapeMap, so is its dual.

op()

Returns the dual in all odd dimensions.

co()

Returns the dual in all even dimensions.

hasse(**params)

Bound version of hasse.draw().

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