Skip to content

Conversation

mantepse
Copy link
Contributor

@mantepse mantepse commented Mar 18, 2024

The LazyCompletionGradedAlgebra used a univariate FreeAlgebra as _internal_poly_ring, which doesn't work for 'exact' lazy series, i.e., when the degree is finite and all coefficients are known.

This was done, because it was assumed that there are issues with univariate polynomials over a non-commutative base ring. However, it seems that these issues are not visible anymore.

Fixes #37625.

@mantepse
Copy link
Contributor Author

There might be further issues when using the completion of the FreeAlgebra, because the arity is not detected correctly. The test we currently use is

        if basis in Algebras.TensorProducts:
            self._arity = len(basis._sets)
        else:
            if basis not in GradedAlgebrasWithBasis:
                raise ValueError("basis should be in GradedAlgebrasWithBasis")
            self._arity = 1

Therefore, we have

            sage: R = algebras.Free(QQ, ('a', 'b'), degrees=(1, 2))
            sage: L = R.completion()
            sage: L._arity
            1

Here is a concrete bug that entails:

            sage: e = L(R.gen(0))
            sage: e, e.valuation(), e.shift(1), e.shift(1).valuation()
            (a, 1, a, 2)

(The method shift should actually raise an error.)

I think, however, that this bug is less problematic than not having the completion of the free algebra at all.

Copy link

Documentation preview for this PR (built with commit 36d2c6b; changes) is ready! 🎉

@tscrim
Copy link
Collaborator

tscrim commented Mar 18, 2024

Arity doesn’t make much sense for general graded algebras. It makes some sense for the free algebra, as we can consider that a tensor product of univariate free algebras (from the functorial properties of tensor algebras). We might want to just special case the free algebra in most (lazy) completions since it has extra properties.

@mantepse
Copy link
Contributor Author

Arity doesn’t make much sense for general graded algebras. It makes some sense for the free algebra, as we can consider that a tensor product of univariate free algebras (from the functorial properties of tensor algebras). We might want to just special case the free algebra in most (lazy) completions since it has extra properties.

I just checked the LazyCompletionGradedAlgebraElement class - this has only the inherited methods from LazyCauchyProductSeries, and the only method that check _arity is shift. Other than that, _arity is used in the _element_constructor.

I guess that there are some methods that would use _arity and could be applied to the completion of the free algebra. For example, composition (from LazyPowerSeries) should just work.

Maybe it would be best to make arity a mandatory argument to LazyCompletionGradedAlgebra.__init__?

I just realised that the shift bug I mentioned above is also present for LazySymmetricFunction.

I would suggest not to worry too much about this right now. I am sure we can find a solution once some feature is requested. If you want to, I can turn this discussion into a new issue, so it doesn't get lost.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@mantepse
Copy link
Contributor Author

Thank you!

@tscrim
Copy link
Collaborator

tscrim commented Mar 19, 2024

It probably would be good to make a separate issue for potentially changing the completion of the free algebra into its own special case (I think there will be a number of things that would benefit from this) and one for the arity issues.

Perhaps it would be useful for the arity to be an optional __init__ argument, so each parent could more easily handle this (with possibly the user giving it too). However, I am not entirely sure about the best way to handle this.

@mantepse
Copy link
Contributor Author

mantepse commented Mar 19, 2024

see #37633

@vbraun vbraun merged commit 142a1ff into sagemath:develop Mar 31, 2024
@mantepse mantepse deleted the lazy_series/non-commutative branch April 13, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Squares not working in completion of free algebra
4 participants