sage icon indicating copy to clipboard operation
sage copied to clipboard

forbid to be both Finite and Infinite

Open fchapoton opened this issue 1 month ago • 7 comments

Currently, one can create

Posets().Finite().Infinite()

and

Posets().Infinite().Finite()

which is not desirable..

:memo: Checklist

  • [x] The title is concise and informative.
  • [x] The description explains in detail what this PR is about.
  • [x] I have created tests covering the changes.

fchapoton avatar Nov 21 '25 15:11 fchapoton

this triggers a doctest failure in src/sage/groups/cubic_braid.py ; to be investigated

fchapoton avatar Nov 21 '25 18:11 fchapoton

@soehms : should the CubicBraidGroup(6) pass its test suite ? It is infinite, so cannot embed into a matrix group over a finite field.

On vanilla sage:

sage: CubicBraidGroup(6).as_matrix_group(GF(3)(2)).category()
Category of finite infinite groups

and the _test_matrix_group method checks that the matrix embedding is faithful.

fchapoton avatar Nov 21 '25 19:11 fchapoton

should the CubicBraidGroup(6) pass its test suite?

I don't think the fix is correct...? the documentation says

    def as_matrix_group(self, root_bur=None, domain=None, characteristic=None, var='t', reduced=False):
        r"""
        Create an epimorphic image of ``self`` as a matrix group by use of
        the burau representation.

epimorphic, not isomorphic. The problem is this line

            matrix_group = MatrixGroup(gen_list, category=self.category())

the resulting group does not necessarily be in the same category as self. The correct fix might be change that line to

            matrix_group = MatrixGroup(gen_list)

maybe in some cases (domain has characteristic 0?) it is actually deducible that the group is infinite, in which case adding .Infinite() would work (and possibly speed up a few things).

(on the positive side, this change caught a legitimate bug)

user202729 avatar Nov 23 '25 12:11 user202729

looks okay to me. Let's wait for a while to see if @soehms have any comment.

Edit: Looks like https://github.com/sagemath/sage/pull/41183 causes failing tests again. But cubic_braid looks fine.

user202729 avatar Nov 23 '25 14:11 user202729

looks okay to me. Let's wait for a while to see if @soehms have any comment.

I agree with your changes! I've no idea why I put the category=self.category() there (maybe I've copy-pasted it from somewhere else). Many thanks!

soehms avatar Nov 23 '25 22:11 soehms

you need to fix doctests. thank you.

cxzhong avatar Nov 23 '25 23:11 cxzhong

Now the CI agree this.

cxzhong avatar Nov 24 '25 11:11 cxzhong