https://trac.sagemath.org/ticket/33784 is now ready for review.

I am still open for discussion, of course.  In particular, we might want to 
discuss whether we should also provide a separate class which models a 
group action, and not only the homomorphic image of the acting group.

Martin

On Tuesday, 3 May 2022 at 15:57:49 UTC+2 Martin R wrote:

> You just need to git Trac try the branch, there are examples in the 
> docstring of PermutationGroup
>
> On Tuesday, 3 May 2022 at 15:27:06 UTC+2 David Joyner wrote:
>
>> On Tue, May 3, 2022 at 7:12 AM 'Martin R' via sage-devel
>> <sage-...@googlegroups.com> wrote:
>> >
>> > I implemented (well, the implementation is trivial) the following, and 
>> I'd like feedback. I am not completely sure whether the interface for the 
>> second variant, where the generators of the acting group are required, is 
>> ideal, but I think it looks useable.
>> >
>> > A more serious problem is that orbits are currently computed twice: 
>> once when creating the generators of the permutation group, and another 
>> time, when asking for them.
>> >
>> > Martin
>> >
>>
>> Hi Martin:
>>
>> Thanks for programming this. I'd like to test it's functionality but
>> don't know your function's syntax. Something like
>>
>> def PermutationGroup2(gens=None, gap_group=None, domain=None,
>> canonicalize=True, category=None, action=None):
>>
>> maybe?
>>
>> - David
>>
>>
>> > """
>> > ...
>> > We can create a permutation group from a group action::
>> >
>> > sage: A = lambda x: (2*x) % 6
>> > sage: X = [0,1,2,3,4,5]
>> > sage: G = PermutationGroup(action=A, domain=X)
>> > sage: G.orbits()
>> > [[0], [1, 2, 4], [3], [5]]
>> >
>> > sage: A = lambda g, x: vector(g*x, immutable=True)
>> > sage: X = [vector(x, immutable=True) for x in GF(3)^2]
>> > sage: G = SL(2,3); G.gens()
>> > (
>> > [1 1] [0 1]
>> > [0 1], [2 0]
>> > )
>> > sage: H = PermutationGroup(G.gens(), action=A, domain=X)
>> > sage: H.orbits()
>> > [[(0, 0)], [(1, 0), (0, 2), (2, 2), (2, 0), (1, 2), (2, 1), (0, 1), (1, 
>> 1)]]
>> > sage: H.gens()
>> > [((0,1),(1,1),(2,1))((0,2),(2,2),(1,2)),
>> > ((1,0),(0,2),(2,0),(0,1))((1,1),(1,2),(2,2),(2,1))]
>> > ...
>> > """
>> > if not is_ExpectElement(gens) and hasattr(gens, '_permgroup_'):
>> > return gens._permgroup_()
>> > if gens is not None and not isinstance(gens, (tuple, list, GapElement)):
>> > raise TypeError("gens must be a tuple, list, or GapElement")
>> > gap_group = kwds.get("gap_group", None)
>> > domain = kwds.get("domain", None)
>> > canonicalize = kwds.get("canonicalize", True)
>> > category = kwds.get("category", None)
>> > action = kwds.get("action", None)
>> > if action is not None:
>> > if domain is None:
>> > raise ValueError("you must specify the domain for an action")
>> > from sage.combinat.cyclic_sieving_phenomenon import orbit_decomposition
>> > if gap_group is not None:
>> > raise ValueError("gap_group is not supported with action")
>> > if gens is None and gap_group is None:
>> > gens = [tuple(o) for o in orbit_decomposition(domain, action)]
>> > else:
>> > gens = [[tuple(o) for o in orbit_decomposition(domain, lambda x: 
>> action(g, x))]
>> > for g in gens]
>> > if args:
>> > from sage.misc.superseded import deprecation
>> > deprecation(31510, "gap_group, domain, canonicalize, category will 
>> become keyword only")
>> > if len(args) > 4:
>> > raise ValueError("invalid input")
>> > args = list(args)
>> > gap_group = args.pop(0)
>> > if args:
>> > domain = args.pop(0)
>> > if args:
>> > canonicalize = args.pop(0)
>> > if args:
>> > category = args.pop(0)
>> > return PermutationGroup_generic(gens=gens, gap_group=gap_group, 
>> domain=domain,
>> > canonicalize=canonicalize, category=category)
>> >
>> >
>> > On Monday, 2 May 2022 at 23:01:42 UTC+2 David Joyner wrote:
>> >>
>> >> On Mon, May 2, 2022 at 11:24 AM 'Martin R' via sage-devel
>> >> <sage-...@googlegroups.com> wrote:
>> >> >
>> >> > I am actually not sure anymore, which methods or functionality this 
>> class should provide.
>> >> >
>> >> > Would it possibly be better to enhance PermutationGroup with an 
>> additional optional "from_action" and "from_cyclic_action" argument? Eg.:
>> >> >
>> >> > PermutationGroup(domain = X, cyclic_action = lambda x: f(x))
>> >> >
>> >> > PermutationGroup(domain = X, group_action = (G, lambda g, x: f(g, 
>> x)))
>> >> >
>> >>
>> >> I like this idea!
>> >>
>> >> > Martin
>> >> > On Monday, 2 May 2022 at 14:20:57 UTC+2 kcrisman wrote:
>> >> >>
>> >> >> On Sunday, May 1, 2022 at 7:32:01 PM UTC-4 Travis Scrimshaw wrote:
>> >> >>>>>
>> >> >>>>> Sorry, I don't know an easy way. I've always just defined them 
>> by hand
>> >> >>>>> whenever needed.
>> >> >>>>> However, I agree with you that a better way is needed.
>> >> >>>>
>> >> >>>>
>> >> >>>> I would love for there to be some standard way to define a group 
>> action on a set - preferably maintaining other algebraic properties of the 
>> set, such as addition! But I don't know if there is even close to a 
>> standard way to do this either.
>> >> >>>
>> >> >>>
>> >> >>> - There is a standard way to do this, but not a generic 
>> method/class for it IIRC. You can do this by implementing an _act_on_() 
>> method on a wrapper class. Yet, this requires some manual input.
>> >> >>> - For cyclic actions, there is the DiscreteDynamicalSystem class 
>> introduced in https://trac.sagemath.org/ticket/24128.
>> >> >>> - There is also the Representation class in 
>> modules/with_basis/representation.py if you want to want to extend the 
>> action on the set to the module with a basis given by that set.
>> >> >>>
>> >> >>> Likely we will want to implement a class SetWithAction that 
>> automates a collects the orbit_decomposition functions and similar together 
>> as methods as a single global entry point.
>> >> >>>
>> >> >>
>> >> >> Hmm, maybe a tutorial is needed for this. I would imagine that a 
>> lot of people who aren't familiar with how to create a new wrapper class 
>> would be the ones who need this. Of course, the FiniteGroupAction 
>> suggestion sounds quite welcome, too, though really having both options 
>> would be best.
>> >> >
>> >> > --
>> >> > 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+...@googlegroups.com.
>> >> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-devel/694a16d8-b59d-43bc-8b68-033c704284abn%40googlegroups.com
>> .
>> >
>> > --
>> > 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+...@googlegroups.com.
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-devel/641f204b-f89c-49f5-97d2-4ce8741ef04cn%40googlegroups.com
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/46e0ca70-1be0-469d-bafc-b35117b9f5d1n%40googlegroups.com.

Reply via email to