Opened 8 months ago
Closed 3 months ago
#27881 closed defect (invalid)
allow creation of PermutationGroupElement with 0 in domain
Reported by: | dimpase | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | group theory | Keywords: | |
Cc: | dcoudert, stumpc5 | Merged in: | |
Authors: | Reviewers: | Dima Pasechnik | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Permutation group acting on a domain with 0 and creating its individual elements (moving 0) is working as expected
sage: g = graphs.PetersenGraph() sage: a = p.automorphism_group() sage: a.domain() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} sage: a("(0,1,2,3,8,5)(4,6,7)") (0,1,2,3,8,5)(4,6,7)
The default constructor PermutationGroupElement
constructs permutations on {1, ..., n}
for compatibility with Permutation
. The following raises an error as expected
sage: PermutationGroupElement("(0,2)") --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-1-fa3d3058e13a> in <module>() ----> 1 PermutationGroupElement("(0,2)") /opt/sage/local/lib/python3.7/site-packages/sage/groups/perm_gps/constructor.py in PermutationGroupElement(g, parent, check) 47 raise ValueError("Invalid permutation vector: %s" % g) 48 degree = max([1] + [max(cycle+(1,)) for cycle in v]) ---> 49 v = from_cycles(degree, v) 50 51 if parent is None: /opt/sage/local/lib/python3.7/site-packages/sage/combinat/permutation.py in from_cycles(n, cycles, parent) 7045 # Only positive elements 7046 if int(flattened_and_sorted[0]) < 1: -> 7047 raise ValueError("All elements should be strictly positive " 7048 "integers, and I just found a non-positive one.") 7049 ValueError: All elements should be strictly positive integers, and I just found a non-positive one.
To create a permutation on a domain different from {1, ..., n}
one should use one of
sage: S = SymmetricGroup([0,1,2]) sage: S("(0,2)") (0,2) sage: PermutationGroupElement("(0,2)", S) (0,2)
It is hard to figure out what the code of the original "bug" report reproduced below is supposed to show.
one can create PermutationGroup_generic_with_category acting on a domain with 0, but creating its individual elements (moving 0) is broken.
sage: p=graphs.PetersenGraph() sage: a=p.automorphism_group(); a Permutation Group with generators [(3,7)(4,5)(8,9), (2,6)(3,8)(4,5)(7,9), (1,4,5)(2,3,8,6,9,7), (0,1)(2,4,6,5)(3,9,8,7)] sage: a.domain() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} sage: map(type, a.gens()) [<type 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'>, <type 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'>, <type 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'>, <type 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'>] sage: PermutationGroupElement("(0,2)") --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-15-fa3d3058e13a> in <module>() ----> 1 PermutationGroupElement("(0,2)") /home/dimpase/Sage/sagetrac-mirror/local/lib/python2.7/site-packages/sage/groups/perm_gps/permgroup_element.pyx in sage.groups.perm_gps.permgroup_element.PermutationGroupElement.__init__ (build/cythonized/sage/groups/perm_gps/permgroup_element.c:5852)() 502 503 degree = max([1] + [max(cycle+(1,)) for cycle in v]) --> 504 v = from_cycles(degree, v) 505 506 self.__gap = 'PermList({})'.format(list(v)) # Make sure it is a list /home/dimpase/Sage/sagetrac-mirror/local/lib/python2.7/site-packages/sage/combinat/permutation.pyc in from_cycles(n, cycles, parent) 7041 # Only positive elements 7042 if int(flattened_and_sorted[0]) < 1: -> 7043 raise ValueError("All elements should be strictly positive " 7044 "integers, and I just found a non-positive one.") 7045 ValueError: All elements should be strictly positive integers, and I just found a non-positive one. }}
Change History (12)
comment:1 Changed 7 months ago by
- Milestone sage-8.8 deleted
comment:2 Changed 3 months ago by
- Description modified (diff)
comment:3 Changed 3 months ago by
- Description modified (diff)
- Milestone set to sage-duplicate/invalid/wontfix
- Status changed from new to needs_review
The message is
comment:4 Changed 3 months ago by
one should not edit away the error reports!
comment:5 Changed 3 months ago by
It was not a meaningful error report. The command PermutationGroupElement("(0,2)")
is not working (as expected). And it has nothing to do with the computation of automorphism group of graphs.
comment:6 Changed 3 months ago by
there was some code, meaningful or not, that used to produce errors.
are these errors fixed?
comment:7 Changed 3 months ago by
Indeed PermutationGroupElement("(0,2)")
produced and still produce an error. What do you mean by fixed? The error is intended.
comment:8 Changed 3 months ago by
- Description modified (diff)
comment:9 Changed 3 months ago by
- Description modified (diff)
comment:10 Changed 3 months ago by
- Description modified (diff)
comment:11 Changed 3 months ago by
- Reviewers set to Dima Pasechnik
- Status changed from needs_review to positive_review
OK, thanks. Sorry for noise - indeed it was not a bug.
comment:12 Changed 3 months ago by
- Resolution set to invalid
- Status changed from positive_review to closed
As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).