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

Ideals in Z #229

Closed
fingolfin opened this issue Jan 12, 2021 · 9 comments
Closed

Ideals in Z #229

fingolfin opened this issue Jan 12, 2021 · 9 comments

Comments

@fingolfin
Copy link
Member

For teaching (and simple test), ideals in Z would be nice to have. I guess something like ideal(ring, gens) would be the default patterns, so ideal(ZZ, [ ZZ(7) ]); and perhaps as a special case, also allow producing principal ideals via ideal(ring, gen) (so ideal(ZZ, ZZ(7))) or even gen*ring (so 7*ZZ) ?

And then have some basic features: intersection, sums, containment test, subset test, computing ZZ/I, ... but I guess also properties of the ideals (maximal / prime / ...). All of this is of course "easy", and for my own code, I don't need this, as I can just invoke gcd etc. directly. But as I said: it's very useful for teaching; but also to set an easy example for people who need to implement new, more complicated rings. (Of course if it'd be easy to piggy back all of this into e.g. existing Hecke or Nemo code, that'd be also fine, I absolutely do not insist on a separate implementation just for ZZ ideals).

I am not sure what the "ideal" (haha) place for this would be; personally I'd just start it in experiments here in Oscar, and we can move it to another place later shrug.

@thofma
Copy link
Collaborator

thofma commented Jan 12, 2021

Agreed, this is a good idea. I actually needed a few times, but never found the time to implement it.

@fingolfin
Copy link
Member Author

The same should also be done for plain fields such as QQ and GF(5).

@thofma
Copy link
Collaborator

thofma commented Jul 16, 2021

For ZZ this is implemented now (in Hecke), although not documented and not all the functionality that you mentioned. The syntax for creation is ideal(ZZ, x) or x * ZZ, but we should add the Vector version for consistency.

@mgkurtz
Copy link
Contributor

mgkurtz commented Apr 7, 2022

Well, (at least now) we can just use AbstractAlgebra.Generic.Ideal for ideals over ℤ, ℚ, 𝔽₅ and other rings.

Ideal(ZZ, 3) * Ideal(ZZ, 2) == Ideal(ZZ, 6)
Ideal(QQ, 3) == Ideal(QQ, 1)

So perhaps providing Ideal as generic implementation for ideal (and ideal as generic implementation for element * ring) would mostly solve this issue? Of course quite some of the features @fingolfin wished for are still missing in the Ideal implementation.

For the missing functionality of ideal(ZZ, …) I made up issue 642 in Hecke.

@YueRen
Copy link
Member

YueRen commented Apr 5, 2023

@fingolfin Is the current ideal functionality good enough? If so, we should close the issue:

julia> ideal(ZZ,[3])+ideal(ZZ,[2])
1ZZ
julia> ideal(ZZ,[2])*ideal(ZZ,[3])
6ZZ
julia> intersect(ideal(ZZ,[3]),ideal(ZZ,[2]))
6ZZ

Some things are missing, but I'm not sure whether that is critical:

julia> radical(ideal(ZZ,[9]))
ERROR: MethodError: no method matching radical(::Hecke.ZZIdl)
Closest candidates are:
  radical(::T) where T<:Integer at ~/.julia/packages/Hecke/IGeky/src/Misc/Integer.jl:1267
  radical(::Hecke.AbsAlgAss{T}) where T at ~/.julia/packages/Hecke/IGeky/src/AlgAss/AbsAlgAss.jl:1202
  radical(::MPolyIdeal) at ~/.julia/dev/Oscar/src/Rings/mpoly-ideals.jl:418
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[42]:1

julia> primary_decomposition(ideal(ZZ,[9]))
ERROR: MethodError: no method matching primary_decomposition(::Hecke.ZZIdl)
Closest candidates are:
  primary_decomposition(::Hecke.AlgAssAbsOrdIdl) at ~/.julia/packages/Hecke/IGeky/src/AlgAssAbsOrd/Ideal.jl:2229
  primary_decomposition(::Hecke.AlgAssAbsOrdIdl, ::Hecke.AlgAssAbsOrd) at ~/.julia/packages/Hecke/IGeky/src/AlgAssAbsOrd/Ideal.jl:2229
  primary_decomposition(::MPolyIdeal; alg) at ~/.julia/dev/Oscar/src/Rings/mpoly-ideals.jl:497
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[43]:1

@fieker
Copy link
Contributor

fieker commented Apr 6, 2023 via email

@thofma
Copy link
Collaborator

thofma commented Apr 6, 2023

We actually have the "geometric interface" for all our other ideals:

julia> QQQ, = rationals_as_number_field(); ZZZ = ring_of_integers(QQQ);

julia> primary_decomposition(ideal(ZZZ, 9))
1-element Vector{Tuple{NfOrdIdl, NfOrdIdl}}:
 (<9, 9>
[...]

julia> radical(ideal(ZZZ, 9))
<3, 3>
[...]

@fieker
Copy link
Contributor

fieker commented Apr 6, 2023 via email

@fingolfin
Copy link
Member Author

This is complete to my satisfaction. Adding radical or primary_decomposition is way beyond what I had in mind (but it's also trivial, so I just did it in thofma/Hecke.jl#1409).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants