Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Rings/Laurent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ function _polyringquo(R::LaurentMPolyWrapRing)
get_attribute!(R, :polyring) do
n = nvars(R)
C = base_ring(R)
Cx, x, xinv = polynomial_ring(C,"x#" => 1:n, "x#^-1" => 1:n; cached = false)
var_names = symbols(R.mpolyring)
Cx, x, xinv = polynomial_ring(C, var_names, [Symbol("inv(", name, ")") for name in var_names]; cached = false)
I = ideal(Cx, [x[i]*xinv[i] - 1 for i in 1:n])
Q, = quo(Cx, I)
return _LaurentMPolyBackend(R, Q)
Expand Down Expand Up @@ -241,3 +242,13 @@ end



function quo(R::Oscar.LaurentMPolyWrapRing, I::Oscar.LaurentMPolyIdeal)
Comment thread
JohnAAbbott marked this conversation as resolved.
Outdated
Comment thread
fingolfin marked this conversation as resolved.
Outdated
@req R === base_ring(I) "ring and ideal do not match"
poly_repr = Oscar._polyringquo(R)
underlying_poly_ring_quo = codomain(poly_repr)
II = ideal(underlying_poly_ring_quo, poly_repr.(gens(I)))
Q,phi = quo(underlying_poly_ring_quo, II)
map_down(f::AbstractAlgebra.Generic.LaurentMPolyWrap) = phi(poly_repr(f))
Comment thread
fingolfin marked this conversation as resolved.
Outdated
lift_up(f::MPolyQuoRingElem) = poly_repr.inv(preimage(phi,f))
return Q, MapFromFunc(R,Q, map_down, lift_up)
end
42 changes: 42 additions & 0 deletions test/Rings/Laurent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,45 @@
end
end
end


@testset "Laurent quotient" begin
# Quick test

# Taken from issue 4814 (suggested by thofman)
Comment thread
lgoettgens marked this conversation as resolved.
Outdated

R, (x, y) = laurent_polynomial_ring(GF(2), [:x, :y]);
f1 = x^2*y^3 + x*y^3 + 1;
f2 = y + y^2 + x^3;
f3 = x^9 * y^6 - 1;
f4 = y^15 - 1;
Comment thread
lgoettgens marked this conversation as resolved.
Outdated
I = ideal(R, [f1, f2, f3, f4]);

Q,phi = quo(R, I); # same as R/ideal(x^2+x+1, y^2+y+1)

@test parent(phi(x)) == Q;
Comment thread
lgoettgens marked this conversation as resolved.
Outdated
@test parent(phi(y)) == Q;
@test is_one(phi(x^3));
@test is_one(phi(x)^3);
@test is_one(phi(y^3));
@test is_one(phi(y)^3);
@test in(preimage(phi,phi(x)) - x, I);
Comment thread
lgoettgens marked this conversation as resolved.
Outdated
@test preimage(phi,phi(x)) == 1+x^(-1); # would be "more natural" if underlying ring had elim order for the inverses
Comment thread
lgoettgens marked this conversation as resolved.
Outdated


# Ideal generated by non-polynomials
R, (x, y) = laurent_polynomial_ring(QQ, [:x, :y]);
C10 = x^2 -x +1 -x^(-1) +x^(-2);
C28 = y^6 -y^4 +y^2 -1 +y^(-2) -y^(-4) +y^(-6);
J = ideal(R, [C10,C28]);
Q,phi = quo(R,J);
u = phi(x^(-1)*y^3);
@test is_unit(u)
@test is_unit(u^(-1))
@test is_one(u^140)
@test !is_one(u^70)
@test !is_one(u^28)
@test !is_one(u^20)
@test is_one(u*inv(u))
@test 1/u == inv(u)
end
Loading