def __init__(self, automaton, alphabet, category, side):
        """
            sage: automaton = DiGraph( [ (1, 1, "b"), (1, 2, "a"),
            ...                          (2, 2, "a"), (2, 2, "c"), (2, 3, "b"),
            ...                          (3, 2, "a"), (3, 3, "b"), (3, 3, "c") ] )
            sage: from sage.monoids.transition_monoid import TransitionMonoidOfDeterministicAutomaton
            sage: M = TransitionMonoidOfDeterministicAutomaton(automaton)
            sage: M.cardinality()
            7
            sage: M.list()
            [[], ['a'], ['b'], ['c'], ['a', 'b'], ['b', 'c'], ['c', 'a']]
            sage: TestSuite(M).run()

        Since ``automaton`` is mutable, we made a private copy of it::

            sage: M.automaton() == automaton
            True
            sage: M.automaton() is automaton
            False
        """

        # Should check that automaton is deterministic
        self._automaton = automaton
        # We would want to have FiniteSetPartialMaps
        ambient = FiniteSetMaps( list(automaton.vertices())+[None], action=side)
        def generator(a):
            return ambient( functools.partial(automaton.transition, a = a) )
        generators = Family( alphabet, generator )
        AutomaticMonoid.__init__(self, generators, ambient, ambient.one(), operator.mul, category)
示例#2
0
    def __init__(self, n=3, action="left"):
        r"""
        EXAMPLES::

            sage: from sage_semigroups.categories.examples.finite_h_trivial_monoids import MonoidOfOrderPreservingMaps
            sage: p = MonoidOfOrderPreservingMaps(4)
            sage: TestSuite(p).run()
        """
        assert n in NN
        domain = IntegerRange(Integer(1), Integer(n + 1))
        index_set = IntegerRange(Integer(1), Integer(n))
        ambient_monoid = FiniteSetMaps(domain, action=action)

        def pi(i):
            return ambient_monoid.from_dict(
                dict([(k, k) for k in domain if k != i + 1] + [(i + 1, i)]))

        def opi(i):
            return ambient_monoid.from_dict(
                dict([(k, k) for k in domain if k != i] + [(i, i + 1)]))

        piopi = Family(
            dict([[i, pi(i)] for i in index_set] + [[-i, opi(i)]
                                                    for i in index_set]))

        AutomaticMonoid.__init__(
            self,
            piopi,
            ambient_monoid,
            one=ambient_monoid.one(),
            mul=operator.mul,
            category=Monoids().HTrivial().Finite().FinitelyGenerated()
            & Monoids().Transformation().Subobjects())
示例#3
0
 def __init__(self, n):
     ambient_monoid = FiniteSetMaps(range(-n, 0) + range(1, n + 1),
                                    action="right")
     pi = Family(
         range(1, n), lambda j: ambient_monoid.from_dict(
             dict([(i, i) for i in range(1, n + 1) if i != j + 1] + [(
                 j + 1, j)] + [(i, i) for i in range(-n, 0)
                               if i != -j] + [(-j, -j - 1)])))
     category = Monoids().JTrivial().Finite() & Monoids().Transformation(
     ).Subobjects()
     AutomaticMonoid.__init__(self,
                              pi,
                              ambient_monoid,
                              one=ambient_monoid.one(),
                              mul=operator.mul,
                              category=category)
示例#4
0
 def __init__(self, W):
     self.lattice = W.domain()
     self.W = W
     from sage.sets.finite_set_maps import FiniteSetMaps
     ambient_monoid = FiniteSetMaps(self.W, action="right")
     pi = self.W.simple_projections(
         length_increasing=True).map(ambient_monoid)
     category = Monoids().JTrivial().Finite() & Monoids().Transformation(
     ).Subobjects()
     AutomaticMonoid.__init__(self,
                              pi,
                              ambient_monoid,
                              one=ambient_monoid.one(),
                              mul=operator.mul,
                              category=category)
     self.domain = self.W
     self.codomain = self.W
示例#5
0
    def __init__(self, n, action="right"):
        ambient_monoid = FiniteSetMaps(range(1, n + 1), action=action)

        def pii(i):
            return ambient_monoid.from_dict(
                {j: j - 1 if j == i + 1 else j
                 for j in range(1, n + 1)})

        pi = Family(range(1, n), pii)
        category = Monoids().JTrivial().Finite() & Monoids().Transformation(
        ).Subobjects()
        AutomaticMonoid.__init__(self,
                                 pi,
                                 ambient_monoid,
                                 one=ambient_monoid.one(),
                                 mul=operator.mul,
                                 category=category)
示例#6
0
    def __init__(self, poset):
        self.poset = poset
        support = poset.list()
        ambient_monoid = FiniteSetMaps(support, action="right")

        def genij(ij):
            (i, j) = ij
            return ambient_monoid.from_dict(
                {k: i if k == j else k
                 for k in support})

        index = map(tuple,
                    poset.cover_relations())  # index elems must be hashable
        self.pi = Family(index, genij)
        category = Monoids().JTrivial().Finite() & Monoids().Transformation(
        ).Subobjects()
        AutomaticMonoid.__init__(self,
                                 self.pi,
                                 ambient_monoid,
                                 one=ambient_monoid.one(),
                                 mul=operator.mul,
                                 category=category)
    def __init__(self, n = 3, action="left"):
        r"""
        EXAMPLES::

            sage: from sage_semigroups.categories.examples.finite_h_trivial_monoids import MonoidOfOrderPreservingMaps
            sage: p = MonoidOfOrderPreservingMaps(4)
            sage: TestSuite(p).run()
        """
        assert n in NN
        domain    = IntegerRange(Integer(1),Integer(n+1))
        index_set = IntegerRange(Integer(1),Integer(n))
        ambient_monoid = FiniteSetMaps(domain, action=action)
        def pi(i):
            return ambient_monoid.from_dict(dict([(k, k) for k in domain if k != i+1]+[(i+1,i)]))
        def opi(i):
            return ambient_monoid.from_dict(dict([(k, k) for k in domain if k != i  ]+[(i,i+1)]))
        piopi = Family(dict([ [ i,  pi(i) ] for i in index_set] +
                            [ [-i, opi(i) ] for i in index_set]))

        AutomaticMonoid.__init__(self, piopi,
            ambient_monoid, one=ambient_monoid.one(), mul=operator.mul,
            category=Monoids().HTrivial().Finite().FinitelyGenerated() &
                     Monoids().Transformation().Subobjects()
            )