On Wed, Aug 06, 2014 at 03:44:26PM +0200, Daniel Krenn wrote: > This sounds like a coercion from the monoid to the group, but IMHO > should be the other way round. Each group element is also an monoid > element (therefore the coercion always works).
+1. It might make sense to define the group as a submonoid of the monoid using the Monoids.Subobjects infrastructure. Also, if the elements of your monoid are functions from a finite set to itself, you might want to represent them internally (e.g. using ElementWrapper) as elements of a FiniteSetMaps. Here is an extract of some experimental code doing things along this direction. It's not functional without more stuff around, but this could give you an idea. I won't have so much time in the coming semester (heavy teaching), but we have a bunch of experimental monoid code lurking around that we would like to get in Sage (see [1]). Maybe there is some opportunity to join forces on this. Cheers, Nicolas class SubFiniteMonoidsOfFunctions(Category): @cached_method def super_categories(self): return [Monoids().Finite()] class ParentMethods: def domain(self): return self.ambient().domain() class ElementMethods: def __call__(self, *args): return self.lift()(*args) def image_set(self): return self.lift().image_set() def rank(self): return self.lift().rank() def fibers(self): return self.lift().fibers() def domain(self): return self.lift().domain() def codomain(self): return self.lift().codomain() class HeckeMonoid(AutomaticMonoid): """ The 0-Hecke monoid of a Coxeter group EXAMPLES:: sage: from sage.combinat.j_trivial_monoids import * sage: H = HeckeMonoid(['A',3]) sage: pi = H.semigroup_generators(); pi sage: pi Finite family {1: [1], 2: [2], 3: [3]} sage: H.cardinality() 24 sage: TestSuite(H).run() """ @staticmethod def __classcall__(cls, W): """ EXAMPLES:: sage: from sage.combinat.j_trivial_monoids import * sage: HeckeMonoid(['A',3]).cardinality() 24 """ from sage.categories.coxeter_groups import CoxeterGroups if not W in CoxeterGroups(): from sage.combinat.root_system.weyl_group import WeylGroup W = WeylGroup(W) # CoxeterGroup(W) return super(PiMonoid, cls).__classcall__(cls, W) 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) AutomaticMonoid.__init__(self, pi, one = ambient_monoid.one(), category = (SubFiniteMonoidsOfFunctions(), JTrivialMonoids().Finite())) self.domain = self.W self.codomain = self.W self.cache_element_methods(["rank"]) def _repr_(self): return "zero_hecke monoid for type %s"%self.W.cartan_type() Nicolas PS: [1] http://combinat.sagemath.org/patches/file/tip/finite_semigroup-nt.patch (this address might need massaging; I don't have internet right now to double check it). -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.