Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing twice changes the output #2409

Closed
fingolfin opened this issue May 24, 2023 · 2 comments
Closed

Printing twice changes the output #2409

fingolfin opened this issue May 24, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@fingolfin
Copy link
Member

@jankoboehm just sent me this example, maybe @thofma or @fieker have an idea what's going on:
Consider this input:

R, _ = polynomial_ring(QQ, ["x", "y", "z"]);
Z = abelian_group(0);
Rg, (x, y, z) = grade(R,[Z[1], Z[1], Z[1]]);
F1 = graded_free_module(Rg, [2,2,2]);
F2 = graded_free_module(Rg, [2]);
G = graded_free_module(Rg, [1,1]);
V1 = [y*G[1], (x+y)*G[1]+y*G[2], z*G[2]];
V2 = [z*G[2]+y*G[1]];
a1 = hom(F1, G, V1);
a2 = hom(F2, G, V2);
M = subquotient(a1,a2);
m = x*y*z*M[1]

Then we can proceed:

julia> degree(m)
Element of
GrpAb: Z
with components [5]

julia> degree(m)
Element of Z with components [5]

Note that the output changes the second time around.

The problem goes away if I let Z print itself once (e.g. by removing the semicolon at the end of the second line of the initial input).

So my guess is that printing degree(m) somehow leads to the abelian group Z "learning" its name, and then the next time degree(m) is printed, a different path is taken.

Clearly it would be preferable if we get the same printing output in both cases...

@jankoboehm ... but at least the above maybe suggests a temporary workaround for you?

@fingolfin fingolfin added the bug Something isn't working label May 24, 2023
@jankoboehm
Copy link
Contributor

Thanks a lot, did not notice that, it is a good workaround for the moment.

The problem seems not to happen in similar situations, e.g., for polynomial rings. However there is also a (related or unrelated) issue with compact printing, which works in the graded case, but not in the ungraded case.

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> Z = abelian_group(0);
julia> Rg, (a, b, c) = grade(R,[Z[1], Z[1], Z[1]]);
julia> io_compact = IOContext(stdout, :compact => true);

julia> print(io_compact, R)
Multivariate polynomial ring in 3 variables over QQ

julia> print(io_compact, Rg)
Rg

@fieker
Copy link
Contributor

fieker commented Jun 7, 2023

Fixed in Hecke#1106

@fieker fieker closed this as completed Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants