Exemplo n.º 1
0
    def transpose(multiclan: 'P(P(M x M) x N)', _checked=True) -> 'P(P(M x M) x N)':
        """Return a multiclan where all relations have their left and right components swapped.

        :return: The :term:`unary multi-extension` of :term:`transposition` from the
            :term:`algebra of relations` to the :term:`algebra of multiclans`, applied to
            ``multiclan``, or `Undef()` if ``multiclan`` is not a :term:`multiclan`.
        """
        if _checked:
            if not is_member(multiclan):
                return _undef.make_or_raise_undef2(multiclan)
        else:
            assert is_member_or_undef(multiclan)
            if multiclan is _undef.Undef():
                return _undef.make_or_raise_undef(2)
        result = _extension.unary_multi_extend(multiclan, _functools.partial(
            _relations.transpose, _checked=False), _checked=False)
        if not result.is_empty:
            result.cache_multiclan(_mo.CacheStatus.IS)
            result.cache_absolute(multiclan.cached_absolute)
            result.cache_functional(multiclan.cached_right_functional)
            result.cache_right_functional(multiclan.cached_functional)
            result.cache_reflexive(multiclan.cached_reflexive)
            result.cache_symmetric(multiclan.cached_symmetric)
            result.cache_transitive(multiclan.cached_transitive)
            result.cache_regular(multiclan.cached_right_regular)
            result.cache_right_regular(multiclan.cached_regular)
        return result
Exemplo n.º 2
0
    def transpose(multiclan: 'P(P(M x M) x N)',
                  _checked=True) -> 'P(P(M x M) x N)':
        """Return a multiclan where all relations have their left and right components swapped.

        :return: The :term:`unary multi-extension` of :term:`transposition` from the
            :term:`algebra of relations` to the :term:`algebra of multiclans`, applied to
            ``multiclan``, or `Undef()` if ``multiclan`` is not a :term:`multiclan`.
        """
        if _checked:
            if not is_member(multiclan):
                return _undef.make_or_raise_undef2(multiclan)
        else:
            assert is_member_or_undef(multiclan)
            if multiclan is _undef.Undef():
                return _undef.make_or_raise_undef(2)
        result = _extension.unary_multi_extend(multiclan,
                                               _functools.partial(
                                                   _relations.transpose,
                                                   _checked=False),
                                               _checked=False)
        if not result.is_empty:
            result.cache_multiclan(_mo.CacheStatus.IS)
            result.cache_absolute(multiclan.cached_absolute)
            result.cache_functional(multiclan.cached_right_functional)
            result.cache_right_functional(multiclan.cached_functional)
            result.cache_reflexive(multiclan.cached_reflexive)
            result.cache_symmetric(multiclan.cached_symmetric)
            result.cache_transitive(multiclan.cached_transitive)
            result.cache_regular(multiclan.cached_right_regular)
            result.cache_right_regular(multiclan.cached_regular)
        return result
Exemplo n.º 3
0
def defined_at(mclan: 'P(P(M x M) x N)', left: '( M )', _checked=True):
    r"""Return the :term:`relation`\s of ``mclan`` that are defined for ``left``."""
    if not is_member(mclan):
        return _undef.make_or_raise_undef(2)
    if left is _undef.Undef():
        return _undef.make_or_raise_undef(2)
    result = _extension.unary_multi_extend(mclan,
                                           _functools.partial(
                                               _relations.defined_at,
                                               left=left,
                                               _checked=_checked),
                                           _checked=_checked)
    if result is _undef.Undef() or not result:
        return _undef.make_or_raise_undef2(result)
    result.cache_multiclan(_mo.CacheStatus.IS)
    if not result.is_empty:
        if mclan.cached_is_functional:
            result.cache_functional(_mo.CacheStatus.IS)
        if mclan.cached_is_right_functional:
            result.cache_right_functional(_mo.CacheStatus.IS)
        if mclan.cached_is_regular:
            result.cache_regular(_mo.CacheStatus.IS)
        if mclan.cached_is_right_regular:
            result.cache_right_regular(_mo.CacheStatus.IS)
    return result
Exemplo n.º 4
0
    def transpose(multiclan: 'P(P(M x M) x N)', _checked=True) -> 'P(P(M x M) x N)':
        """Return the :term:`transposition` of the :term:`multiclan` ``multiclan``.

        :return: The :term:`unary extension` of :term:`transposition` from the :term:`algebra of
            relations` to the :term:`algebra of multiclans`, applied to ``multiclan``, or `Undef()`
            if ``multiclan`` is not a :term:`multiclan`.
        """
        if _checked:
            if not is_member(multiclan):
                return _make_or_raise_undef()
        else:
            assert is_member(multiclan)
        return _extension.unary_multi_extend(multiclan, partial(
            _relations.transpose, _checked=False), _checked=False)
Exemplo n.º 5
0
def defined_at(mclan: 'P(P(M x M) x N)', left: '( M )', _checked=True):
    r"""Return the :term:`relation`\s of ``mclan`` that are defined for ``left``."""
    if not is_member(mclan):
        return _undef.make_or_raise_undef(2)
    if left is _undef.Undef():
        return _undef.make_or_raise_undef(2)
    result = _extension.unary_multi_extend(
        mclan, _functools.partial(_relations.defined_at, left=left, _checked=_checked),
        _checked=_checked)
    if result is _undef.Undef() or not result:
        return _undef.make_or_raise_undef2(result)
    result.cache_multiclan(_mo.CacheStatus.IS)
    if not result.is_empty:
        if mclan.cached_is_functional:
            result.cache_functional(_mo.CacheStatus.IS)
        if mclan.cached_is_right_functional:
            result.cache_right_functional(_mo.CacheStatus.IS)
        if mclan.cached_is_regular:
            result.cache_regular(_mo.CacheStatus.IS)
        if mclan.cached_is_right_regular:
            result.cache_right_regular(_mo.CacheStatus.IS)
    return result